@rebuy/rebuy 2.30.0 → 2.31.0
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 +4 -0
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +4 -0
- package/dist/index.mjs.map +2 -2
- package/dist/server/analytics.d.ts +13 -0
- package/dist/server/analytics.d.ts.map +1 -1
- package/dist/server/index.js +13 -1
- package/dist/server/index.js.map +2 -2
- package/dist/server/index.mjs +13 -1
- package/dist/server/index.mjs.map +2 -2
- package/dist/transforms/index.js +4 -0
- package/dist/transforms/index.js.map +2 -2
- package/dist/transforms/index.mjs +4 -0
- package/dist/transforms/index.mjs.map +2 -2
- package/dist/transforms/offerV1/offerCard.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/schema/widgets/checkout-and-beyond/image.ts", "../../src/schema/widgets/checkout-and-beyond/common.ts", "../../src/schema/widgets/checkout-and-beyond/regex.ts", "../../src/schema/widgets/checkout-and-beyond/rule.ts", "../../src/schema/widgets/checkout-and-beyond/shared.ts", "../../src/schema/widgets/checkout-and-beyond/banner.ts", "../../src/schema/widgets/checkout-and-beyond/layout.ts", "../../src/schema/widgets/checkout-and-beyond/button.ts", "../../src/schema/widgets/checkout-and-beyond/text.ts", "../../src/schema/widgets/checkout-and-beyond/utils.ts", "../../src/schema/widgets/checkout-and-beyond/carousel.ts", "../../src/schema/widgets/checkout-and-beyond/offers.ts", "../../src/schema/widgets/checkout-and-beyond/dataSource.ts", "../../src/schema/widgets/checkout-and-beyond/constants.ts", "../../src/schema/widgets/checkout-and-beyond/products.ts", "../../src/schema/widgets/checkout-and-beyond/product.ts", "../../src/schema/widgets/checkout-and-beyond/cartLine.ts", "../../src/schema/widgets/checkout-and-beyond/discount.ts", "../../src/schema/widgets/checkout-and-beyond/monetize.ts", "../../src/schema/widgets/checkout-and-beyond/progressBar.ts", "../../src/schema/widgets/checkout-and-beyond/giftLabels.ts", "../../src/schema/widgets/checkout-and-beyond/quantity.ts", "../../src/schema/widgets/checkout-and-beyond/reviews.ts", "../../src/schema/widgets/checkout-and-beyond/reviewLabels.ts", "../../src/schema/widgets/checkout-and-beyond/variants.ts", "../../src/transforms/contentBlockV1/stripContentBlockHtml.ts", "../../src/transforms/contentBlockV1/convertTextToTiptapParagraph.ts", "../../src/transforms/contentBlockV1/types.ts", "../../src/transforms/contentBlockV1/convertContentBlockImageToV2.ts", "../../src/transforms/contentBlockV1/convertContentBlockTextToV2.ts", "../../src/schema/widgets/checkout-and-beyond/root.ts", "../../src/schema/widgets/checkout-and-beyond/uiLabels.ts", "../../src/transforms/contentBlockV1/convertContentBlockToV2.ts", "../../src/transforms/convertNumericObjects.ts", "../../src/transforms/deepCamelCase.ts", "../../src/transforms/htmlToTiptap/buildDefaultTextStyleMark.ts", "../../src/transforms/htmlToTiptap/closeTag.ts", "../../src/transforms/htmlToTiptap/constants.ts", "../../src/transforms/htmlToTiptap/makeParagraph.ts", "../../src/transforms/htmlToTiptap/flushParagraph.ts", "../../src/transforms/htmlToTiptap/isSkipping.ts", "../../src/transforms/htmlToTiptap/makeDoc.ts", "../../src/transforms/htmlToTiptap/isValidHref.ts", "../../src/transforms/htmlToTiptap/buildLinkMark.ts", "../../src/transforms/htmlToTiptap/decodeEntities.ts", "../../src/transforms/htmlToTiptap/parseAttribs.ts", "../../src/transforms/htmlToTiptap/openTag.ts", "../../src/transforms/htmlToTiptap/pushText.ts", "../../src/transforms/htmlToTiptap/stripHtmlComments.ts", "../../src/transforms/htmlToTiptap/htmlToTiptap.ts", "../../src/transforms/isCABRootSection.ts", "../../src/schema/widgets/checkout-and-beyond/switchLabels.ts", "../../src/transforms/localizedContent.ts", "../../src/transforms/lineItemEditorV1/convertLineItemEditorToV2.ts", "../../src/transforms/lineItemEditorV1/types.ts", "../../src/transforms/normalizeTokens.ts", "../../src/transforms/normalizeTextContent.ts", "../../src/transforms/experiments/resolveExperiment.ts", "../../src/schema/widgets/checkout-and-beyond/offerLabels.ts", "../../src/transforms/offerV1/offerTemplateSeed.ts", "../../src/transforms/offerV1/types.ts", "../../src/transforms/offerV1/buildOfferTemplate.ts", "../../src/transforms/offerV1/offerCard.ts", "../../src/transforms/offerV1/convertOfferToV2.ts", "../../src/transforms/parseShielded.ts", "../../src/transforms/progressBarV1/types.ts", "../../src/transforms/progressBarV1/convertProgressBarToV2.ts", "../../src/transforms/smartCart/convertSmartCartProgressBarToV2.ts", "../../src/transforms/smartCart/extractSmartCartBars.ts"],
|
|
4
|
-
"sourcesContent": ["import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { buttonFields, ObjectFit, objectFits, SectionType } from './common';\nimport { DYNAMIC_TOKEN_REGEX } from './regex';\nimport { CABRule } from './rule';\nimport { CABBorder, type SectionDetails } from './shared';\nimport { checkForHTML, NO_HTML } from './utils';\n\nexport const CABImageSection = z.object({\n altText: z.string().refine(checkForHTML, NO_HTML).default(''),\n aspectRatio: z.literal(1).nullable().default(null),\n border: z.lazy(() => CABBorder),\n buttonField: z.enum(buttonFields).optional(),\n category: z.enum(['gallery', 'icons', 'payment-methods', 'secure-checkout']).nullable().default(null),\n name: z.string().optional(),\n naturalHeight: z.number().default(0),\n naturalWidth: z.number().default(0),\n /**\n * `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and\n * `cover` would crop non-square art (payment badges lost their edges \u2014 15993); `contain` letterboxes.\n */\n objectFit: z.enum(objectFits).default(ObjectFit.contain),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.image).default(SectionType.image),\n source: z.union([z.url(), z.literal(''), z.string().regex(DYNAMIC_TOKEN_REGEX)]).default(''),\n width: z.number().default(100),\n});\n\nexport type CABImageSection = z.infer<typeof CABImageSection>;\n\nexport type CABImageSectionProps = CABImageSection & SectionDetails;\n", "export const freezeEnum = <T extends readonly string[]>(values: T) =>\n Object.freeze(Object.fromEntries(values.map((v) => [v, v]))) as { readonly [K in T[number]]: K };\n\nexport const bannerColors = ['info', 'success', 'warning', 'critical'] as const;\nexport const BannerColor = freezeEnum(bannerColors);\nexport type BannerColor = (typeof bannerColors)[number];\n\nexport const borderRadii = ['none', 'small', 'base', 'large', 'fullyRounded'] as const;\nexport const BorderRadius = freezeEnum(borderRadii);\nexport type BorderRadius = (typeof borderRadii)[number];\n\nexport const borderStyles = ['none', 'base', 'dotted', 'dashed'] as const;\nexport const BorderStyle = freezeEnum(borderStyles);\nexport type BorderStyle = (typeof borderStyles)[number];\n\nexport const borderWidths = ['base', 'medium', 'thick'] as const;\nexport const BorderWidth = freezeEnum(borderWidths);\nexport type BorderWidth = (typeof borderWidths)[number];\n\nexport const buttonActions = [\n 'acceptOffer',\n 'addToOrder',\n 'declineAllOffers',\n 'declineOffer',\n 'displayContentInModal',\n 'displayContentInPopover',\n 'goToNextPage',\n 'goToPrevPage',\n 'goToURL',\n 'removeFromOrder',\n 'selectVariant',\n 'showPagination',\n 'switchToSubscription',\n 'undoAddToOrder',\n] as const;\n\nexport const ButtonAction = freezeEnum(buttonActions);\nexport type ButtonAction = (typeof buttonActions)[number];\n\nexport const buttonFields = [\n 'activePage',\n 'addedToCart',\n 'addingToCart',\n 'addToCart',\n 'buttonLabel',\n 'declineAllOffers',\n 'declineOffer',\n 'destinationUrl',\n 'inactivePage',\n 'overlayContent',\n 'payNow',\n 'progressReached',\n 'progressRemaining',\n 'redirectToCheckout',\n 'removeFromOrder',\n 'showVariant',\n 'showVariants',\n 'soldOut',\n 'subscriptionOption',\n 'switchToOneTimePurchase',\n 'switchToSubscriptionNoDiscount',\n 'switchToSubscriptionWithDiscount',\n 'undoAddToOrder',\n] as const;\n\nexport const ButtonField = freezeEnum(buttonFields);\nexport type ButtonField = (typeof buttonFields)[number];\n\nexport const buttonStyles = ['primary', 'secondary', 'plain', 'custom'] as const;\nexport const ButtonStyle = freezeEnum(buttonStyles);\nexport type ButtonStyle = (typeof buttonStyles)[number];\n\nexport const directions = ['columns', 'rows', 'grid'] as const;\nexport const Direction = freezeEnum(directions);\nexport type Direction = (typeof directions)[number];\n\nexport const discountSources = ['price', 'compare_at_price'] as const;\nexport const DiscountSource = freezeEnum(discountSources);\nexport type DiscountSource = (typeof discountSources)[number];\n\nexport const discountTypes = ['none', 'percentage', 'fixed', 'fixed_amount'] as const;\nexport const DiscountType = freezeEnum(discountTypes);\nexport type DiscountType = (typeof discountTypes)[number];\n\nexport const editorModes = [\n 'checkoutExtension',\n 'postPurchaseOffer',\n 'thankYouPage',\n 'orderStatusPage',\n 'ordersIndexPage',\n 'customerProfilePage',\n] as const;\n\nexport const EditorMode = freezeEnum(editorModes);\nexport type EditorMode = (typeof editorModes)[number];\n\nexport const horizontalAlignments = ['start', 'center', 'end'] as const;\nexport const HorizontalAlignment = freezeEnum(horizontalAlignments);\nexport type HorizontalAlignment = (typeof horizontalAlignments)[number];\n\nexport const languageKeys = [\n 'ar',\n 'cs',\n 'da',\n 'de',\n 'en',\n 'es',\n 'fi',\n 'fr',\n 'ga',\n 'he',\n 'hi',\n 'id',\n 'it',\n 'ja',\n 'ko',\n 'nl',\n 'no',\n 'pl',\n 'pt',\n 'ru',\n 'sv',\n 'th',\n 'tr',\n 'uk',\n 'vi',\n 'zh',\n] as const;\n\nexport const LanguageKey = freezeEnum(languageKeys);\nexport type LanguageKey = (typeof languageKeys)[number];\n\nexport const objectFits = ['cover', 'contain'] as const;\nexport const ObjectFit = freezeEnum(objectFits);\nexport type ObjectFit = (typeof objectFits)[number];\n\nexport const popoverPositions = ['inlineStart', 'inlineEnd', 'blockStart', 'blockEnd'] as const;\nexport const PopoverPosition = freezeEnum(popoverPositions);\nexport type PopoverPosition = (typeof popoverPositions)[number];\n\nexport const popoverPositionMap = {\n bottom: 'blockEnd',\n left: 'inlineStart',\n right: 'inlineEnd',\n top: 'blockStart',\n} as const;\n\nexport const productTypes = ['one-time', 'subscription', 'both'] as const;\nexport const ProductType = freezeEnum(productTypes);\nexport type ProductType = (typeof productTypes)[number];\n\nexport const progressTierTypes = ['decorative', 'discount', 'product', 'shipping'] as const;\nexport const ProgressTierType = freezeEnum(progressTierTypes);\nexport type ProgressTierType = (typeof progressTierTypes)[number];\n\nexport const progressTierUnits = ['currency', 'item'] as const;\nexport const ProgressTierUnit = freezeEnum(progressTierUnits);\nexport type ProgressTierUnit = (typeof progressTierUnits)[number];\n\nexport const quantityInputs = ['select', 'number'] as const;\nexport const QuantityInput = freezeEnum(quantityInputs);\nexport type QuantityInput = (typeof quantityInputs)[number];\n\nexport const reviewsSizes = ['small', 'default', 'large'] as const;\nexport const ReviewsSize = freezeEnum(reviewsSizes);\nexport type ReviewsSize = (typeof reviewsSizes)[number];\n\nexport const sectionTypes = [\n 'banner',\n 'button',\n 'carousel',\n 'cartLine',\n 'dataSource',\n 'discount',\n 'image',\n 'layout',\n 'monetize',\n 'offers',\n 'product',\n 'products',\n 'progressBar',\n 'quantity',\n 'reviews',\n 'text',\n 'variants',\n] as const;\n\nexport const SectionType = freezeEnum(sectionTypes);\nexport type SectionType = (typeof sectionTypes)[number];\n\nexport const spacings = ['none', 'extraTight', 'tight', 'base', 'loose', 'extraLoose'] as const;\nexport const Spacing = freezeEnum(spacings);\nexport type Spacing = (typeof spacings)[number];\n\nexport const textAlignments = ['start', 'center', 'end'] as const;\nexport const TextAlignment = freezeEnum(textAlignments);\nexport type TextAlignment = (typeof textAlignments)[number];\n\nexport const textColorNames = ['base', 'subdued', 'accent', 'decorative', 'success', 'warning', 'critical'] as const;\nexport const TextColorName = freezeEnum(textColorNames);\nexport type TextColorName = (typeof textColorNames)[number];\n\nexport const textSizeNames = ['extraSmall', 'small', 'base', 'medium', 'large', 'extraLarge'] as const;\nexport const TextSizeName = freezeEnum(textSizeNames);\nexport type TextSizeName = (typeof textSizeNames)[number];\n\nexport const variantModes = ['multiple', 'single'] as const;\nexport const VariantMode = freezeEnum(variantModes);\nexport type VariantMode = (typeof variantModes)[number];\n\nexport const variantSelectors = ['menu', 'radio', 'button'] as const;\nexport const VariantSelector = freezeEnum(variantSelectors);\nexport type VariantSelector = (typeof variantSelectors)[number];\n\nexport const verticalAlignments = ['top', 'middle', 'bottom'] as const;\nexport const VerticalAlignment = freezeEnum(verticalAlignments);\nexport type VerticalAlignment = (typeof verticalAlignments)[number];\n", "/** Matches a valid array index string (e.g., \"0\", \"1\", \"42\"). */\nexport const ARRAY_INDEX_STRING = /^(0|[1-9]\\d*)$/;\n\n/** Matches a dynamic token. */\nexport const DYNAMIC_TOKEN_REGEX = /^\\{\\{\\s*[A-Za-z]+\\s*\\}\\}$/;\n\n/** Matches a valid hex color code. */\nexport const HEX_COLOR_REGEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;\n\n/**\n * Matches a root-relative, same-origin path (single leading slash, e.g. Shopify's\n * `/policies/privacy-policy`). A protocol-relative `//host` is excluded \u2014 it points off-origin.\n */\nexport const ROOT_RELATIVE_PATH_REGEX = /^\\/(?!\\/)/;\n\n/**\n * Matches an HTML-shaped tag: `<` (or `</`) immediately followed by a tag-name letter. This mirrors\n * both the browser `DOMParser` branch of `isHTML` and `stripContentBlockHtml`'s tag regex, so the\n * server-side check agrees with the client and with whatever the sanitizer removes. It deliberately\n * leaves bare comparison brackets alone (`5 < 10 and 10 > 5`) \u2014 those are text, not markup, and the\n * looser `/<\\/?[^>]+>/` it replaced wrongly rejected them and 500'd otherwise-valid content.\n *\n * Keeps the `g` flag because downstream consumers strip ALL tags with `.replace(HTML_TAGS_REGEX, '')`\n * (rebuy-shopify-extensions, admin-nextjs); without it `.replace` would drop only the first tag. The\n * one in-package consumer, `isHTML`, must therefore NOT use `.test()` on it \u2014 a global regex carries a\n * sticky `lastIndex` that makes repeated `.test()` calls flaky. `isHTML` uses `.search()` instead,\n * which ignores and never mutates `lastIndex`.\n */\nexport const HTML_TAGS_REGEX = /<\\/?[a-zA-Z][^>]*>/g;\n", "import { z } from 'zod';\n\nexport const ruleTypes = [\n 'cart',\n 'cart_count',\n 'cart_item_count',\n 'cart_line_count',\n 'cart_subtotal',\n 'collection',\n 'customer',\n 'customer_order_count',\n 'customer_tag',\n 'customer_total_spent',\n 'date',\n 'product',\n 'product_tag',\n 'product_title',\n 'product_type',\n 'product_vendor',\n] as const;\n\nconst ruleType = z.enum(ruleTypes);\n\nexport const RuleType = ruleType.enum;\nexport type RuleType = z.infer<typeof ruleType>;\n\nexport const ruleOperators = [\n 'after',\n 'anything',\n 'before',\n 'contains',\n 'contains_any',\n 'does_not_contain',\n 'does_not_contain_any',\n 'equals',\n 'does_not_equal',\n 'greater_than',\n 'less_than',\n] as const;\n\nconst ruleOperator = z.enum(ruleOperators);\n\nexport const RuleOperator = ruleOperator.enum;\nexport type RuleOperator = z.infer<typeof ruleOperator>;\n\nexport const RuleCondition = z.object({\n operator: z.enum(ruleOperators).default(RuleOperator.anything),\n products: z.union([z.array(z.unknown()), z.strictObject({}).transform(() => [])]).default(() => []),\n type: z.enum(ruleTypes).default(RuleType.cart_subtotal),\n value: z.coerce.string().default(''),\n});\n\nexport type RuleCondition = z.infer<typeof RuleCondition>;\n\nexport const RuleLogicBlock = z.object({\n rules: z.array(RuleCondition).default(() => []),\n});\n\nexport type RuleLogicBlock = z.infer<typeof RuleLogicBlock>;\n\nexport const CABRule = z.object({\n dataSourceId: z.number().nullable().default(null),\n enabled: z.boolean().default(false),\n ruleset: z\n .union([\n z.array(\n z.object({\n exitIfMatched: z.boolean().default(true),\n logic: z.array(RuleLogicBlock).default(() => []),\n output: z\n .array(\n z.object({\n key: z.string().default('should_show'),\n type: z.literal('data_json').default('data_json'),\n value: z.string().default('true'),\n })\n )\n .default(() => [{ key: 'should_show', type: 'data_json' as const, value: 'true' }]),\n })\n ),\n z.strictObject({}).transform(() => []),\n ])\n .default(() => []),\n});\n\nexport type CABRule = z.infer<typeof CABRule>;\n", "import { type FieldArrayPath } from 'react-hook-form';\nimport { z, type ZodType } from 'zod';\n\nimport { CABBannerSection } from './banner';\nimport { CABButtonSection } from './button';\nimport { CABCarouselSection } from './carousel';\nimport { CABCartLineSection } from './cartLine';\nimport { borderRadii, BorderRadius, BorderStyle, borderStyles, BorderWidth, borderWidths } from './common';\nimport { CABDataSourceSection } from './dataSource';\nimport { CABDiscountSection } from './discount';\nimport { CABImageSection } from './image';\nimport { CABLayoutSection } from './layout';\nimport { CABMonetizeSection } from './monetize';\nimport { CABOffersSection } from './offers';\nimport { CABProductSection } from './product';\nimport { CABProductsSection } from './products';\nimport { CABProgressBarSection } from './progressBar';\nimport { CABQuantitySection } from './quantity';\nimport { CABReviewsSection } from './reviews';\nimport { type CABRootSection } from './root';\nimport { CABTextSection } from './text';\nimport { CABVariantsSection } from './variants';\n\nexport const CABBorder = z\n .object({\n radius: z.enum(borderRadii).default(BorderRadius.base),\n style: z.enum(borderStyles).default(BorderStyle.none),\n width: z.enum(borderWidths).default(BorderWidth.base),\n })\n .default({\n radius: BorderRadius.base,\n style: BorderStyle.none,\n width: BorderWidth.base,\n });\n\nexport type CABBorder = z.infer<typeof CABBorder>;\n\nexport const CABSection: ZodType<CABSection> = z.lazy(() =>\n z.discriminatedUnion('sectionType', [\n CABBannerSection,\n CABButtonSection,\n CABCarouselSection,\n CABCartLineSection,\n CABDataSourceSection,\n CABDiscountSection,\n CABImageSection,\n CABLayoutSection,\n CABMonetizeSection,\n CABOffersSection,\n CABProductSection,\n CABProductsSection,\n CABProgressBarSection,\n CABQuantitySection,\n CABReviewsSection,\n CABTextSection,\n CABVariantsSection,\n ])\n);\n\nexport type CABSection =\n | CABBannerSection\n | CABButtonSection\n | CABCarouselSection\n | CABCartLineSection\n | CABDataSourceSection\n | CABDiscountSection\n | CABImageSection\n | CABLayoutSection\n | CABMonetizeSection\n | CABOffersSection\n | CABProductSection\n | CABProductsSection\n | CABProgressBarSection\n | CABQuantitySection\n | CABReviewsSection\n | CABTextSection\n | CABVariantsSection;\n\nexport type SectionId = CABSection['sectionId'];\n\n/* @ts-expect-error: TS2589: Type instantiation _is_ excessively deep and infinite. */\nexport type SectionArrayPath = FieldArrayPath<CABRootSection>;\n\nexport type SectionPrefixPath = `${SectionArrayPath}.${number}` | null;\n\nexport type SectionDetails = {\n /**\n * The full React Hook Form dot-notation path to the section object itself,\n * for use with `register` or `control`, e.g. `sections.0.sections.1`.\n *\n * Returns `null` for the root section.\n */\n fieldArrayPath: SectionArrayPath | null;\n /**\n * The index of the found section within its parent `sections` array.\n *\n * Returns `null` for the root section.\n */\n index: number | null;\n /**\n * The parent `sections` object.\n *\n * Returns `null` for the root section.\n */\n parent: CABSection[] | null;\n /**\n * The parent `sectionId`.\n *\n * Returns `undefined` for the root section.\n */\n parentId: SectionId | undefined;\n /**\n * The full React Hook Form dot-notation path to the section object itself,\n * for use with `register` or `control`, e.g. `sections.0.sections.1`.\n *\n * Returns `null` for the root section.\n */\n prefixPath: SectionPrefixPath | null;\n};\n\nexport type CABSectionProps = CABSection & SectionDetails;\n", "import { z } from 'zod';\n\nimport { bannerColors, buttonFields, SectionType, type BannerColor } from './common';\nimport { CABLayoutSection } from './layout';\nimport { type SectionDetails } from './shared';\n\nexport const CABBannerSection = z.lazy(() =>\n CABLayoutSection.omit({ sectionType: true }).extend({\n buttonField: z.enum(buttonFields).optional(),\n color: z.enum(bannerColors).default('info'),\n dismissible: z.boolean().default(true),\n sectionType: z.literal(SectionType.banner).default(SectionType.banner),\n })\n);\n\nexport type CABBannerSection = Omit<CABLayoutSection, 'sectionType'> & {\n color: BannerColor;\n dismissible: boolean;\n sectionType: 'banner';\n};\n\nexport type CABBannerSectionProps = CABBannerSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport {\n buttonFields,\n Direction,\n directions,\n HorizontalAlignment,\n horizontalAlignments,\n SectionType,\n Spacing,\n spacings,\n VerticalAlignment,\n verticalAlignments,\n type ButtonField,\n} from './common';\nimport { CABRule } from './rule';\nimport { CABBorder, CABSection, type SectionDetails } from './shared';\n\nexport const GridItem = z.union([z.literal('auto'), z.literal('fill'), z.string().regex(/^\\d+%$/), z.number()]);\nexport type GridItem = z.infer<typeof GridItem>;\n\nexport const CABLayoutSection = z.object({\n alignment: z\n .object({\n horizontal: z.enum(horizontalAlignments).default(HorizontalAlignment.start),\n vertical: z.enum(verticalAlignments).default(VerticalAlignment.top),\n })\n .default({\n horizontal: HorizontalAlignment.start,\n vertical: VerticalAlignment.top,\n }),\n border: z.lazy(() => CABBorder),\n buttonField: z.enum(buttonFields).optional(),\n direction: z.enum(directions).default(Direction.rows),\n grid: z\n .object({\n columns: z.union([z.array(GridItem), z.undefined()]).default(() => ['auto']),\n rows: z.union([z.array(GridItem), z.undefined()]).default(() => ['auto']),\n })\n .default({ columns: ['auto'], rows: ['auto'] })\n .optional(),\n name: z.string().optional(),\n padding: z.enum(spacings).default(Spacing.none),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sections: z.union([z.array(z.lazy(() => CABSection)), z.strictObject({}).transform(() => [])]).default(() => []),\n sectionType: z.literal(SectionType.layout).default(SectionType.layout),\n spacing: z.enum(spacings).default(Spacing.base),\n /** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */\n viewUrl: z.string().optional(),\n width: z.number().default(100),\n});\n\nexport type CABLayoutSection = {\n alignment: {\n horizontal: HorizontalAlignment;\n vertical: VerticalAlignment;\n };\n border: CABBorder;\n buttonField?: ButtonField;\n direction: Direction;\n grid?: {\n columns: GridItem[];\n rows: GridItem[];\n };\n name?: string;\n padding: Spacing;\n rule?: CABRule;\n sectionId: string;\n sections: CABSection[];\n sectionType: 'layout';\n spacing: Spacing;\n viewUrl?: string;\n width: number;\n};\n\nexport type CABLayoutSectionProps = CABLayoutSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z, type ZodType } from 'zod';\n\nimport {\n buttonActions,\n ButtonStyle,\n buttonStyles,\n PopoverPosition,\n popoverPositions,\n SectionType,\n TextAlignment,\n textAlignments,\n} from './common';\nimport { CABImageSection } from './image';\nimport { CABLayoutSection } from './layout';\nimport { HEX_COLOR_REGEX } from './regex';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\nimport { CABTextSection } from './text';\n\nexport type CABButtonContent = CABImageSection | CABLayoutSection | CABTextSection;\n\nexport const CABButtonContent: ZodType<CABButtonContent> = z.lazy(() =>\n z.discriminatedUnion('sectionType', [CABImageSection, CABLayoutSection, CABTextSection])\n);\n\nexport const CABButtonSection = z.object({\n action: z.union([z.literal(''), z.enum(buttonActions)]).default(''),\n buttonStyle: z.enum(buttonStyles).default(ButtonStyle.primary),\n custom: z\n .object({\n color: z.string().regex(HEX_COLOR_REGEX).default('#005bd3'),\n height: z.number().default(52),\n width: z.number().default(300),\n })\n .default({\n color: '#005bd3',\n height: 52,\n width: 300,\n }),\n disableDowngrade: z.boolean().default(false),\n name: z.string().optional(),\n optionId: z.number().optional(),\n popover: z\n .object({\n alignment: z.enum(textAlignments).default(TextAlignment.center),\n position: z.enum(popoverPositions).default(PopoverPosition.blockStart),\n })\n .optional()\n .default(() => ({\n alignment: TextAlignment.center,\n position: PopoverPosition.blockStart,\n })),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sections: z.union([z.array(CABButtonContent), z.strictObject({}).transform(() => [])]).default(() => []),\n sectionType: z.literal(SectionType.button).default(SectionType.button),\n /** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */\n trackingUrl: z.string().optional(),\n});\n\nexport type CABButtonSection = z.infer<typeof CABButtonSection>;\n\nexport type CABButtonSectionProps = CABButtonSection & SectionDetails;\n", "import { forEach, isString } from 'es-toolkit/compat';\nimport { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport {\n ButtonField,\n buttonFields,\n progressTierTypes,\n ProgressTierType,\n SectionType,\n Spacing,\n spacings,\n TextAlignment,\n textAlignments,\n TextColorName,\n textColorNames,\n TextSizeName,\n textSizeNames,\n} from './common';\nimport { DYNAMIC_TOKEN_REGEX, ROOT_RELATIVE_PATH_REGEX } from './regex';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\nimport { checkForHTML, NO_HTML } from './utils';\n\nconst enumOrOmit = <T extends readonly [string, ...string[]]>(...vals: T) =>\n z\n .string()\n .transform((val) => (vals.includes(val as T[number]) ? (val as T[number]) : undefined))\n .optional();\n\nexport const TiptapText = z.object({\n marks: z\n .union([\n z.array(\n z.discriminatedUnion('type', [\n z.object({ type: z.literal('bold') }),\n z.object({ type: z.literal('italic') }),\n z.object({\n attrs: z.object({\n class: z.string().nullable(),\n href: z.union([\n z.url(),\n z.literal('#'),\n z.string().regex(DYNAMIC_TOKEN_REGEX),\n z.string().regex(ROOT_RELATIVE_PATH_REGEX),\n ]),\n rel: z.string().default('noopener noreferrer nofollow'),\n target: z.string().default('_blank'),\n }),\n type: z.literal('link'),\n }),\n z.object({ type: z.literal('strike') }),\n z.object({\n attrs: z.object({\n color: enumOrOmit(...textColorNames).default(TextColorName.base),\n fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base),\n }),\n type: z.literal('textStyle'),\n }),\n ])\n ),\n z.strictObject({}).transform(() => []),\n ])\n .optional(),\n text: z.string().default(''),\n type: z.literal('text').default('text'),\n});\n\nexport type TiptapText = z.infer<typeof TiptapText>;\n\nexport const TiptapParagraph = z.object({\n attrs: z\n .object({\n textAlign: enumOrOmit(...textAlignments),\n })\n .default({ textAlign: TextAlignment.start }),\n content: z.union([z.array(TiptapText), z.strictObject({}).transform(() => [])]).default(() => []),\n type: z.literal('paragraph').default('paragraph'),\n});\n\nexport type TiptapParagraph = z.infer<typeof TiptapParagraph>;\n\nexport const TiptapDocument = z.object({\n attrs: z\n .object({\n blockSpacing: enumOrOmit(...spacings),\n })\n .default({ blockSpacing: Spacing.base }),\n content: z\n .union([z.array(TiptapParagraph), z.strictObject({}).transform(() => [])])\n .default(() => [TiptapParagraph.parse({})]),\n type: z.literal('doc').default('doc'),\n});\n\nexport type TiptapDocument = z.infer<typeof TiptapDocument>;\n\n/**\n * A text section's tier reference. On the smart-cart per-tier feedback copy it carries the `tierId`, so\n * the renderer shows this section only while its tier is the active (current/last-reached) one \u2014 the\n * full tier (gift/threshold) lives on progressBar.\n */\nexport const CABTextTier = z.object({\n threshold: z.number().int().nonnegative(),\n thresholds: z.record(z.string(), z.number().int().nonnegative()).default(() => ({})),\n tierId: z.string().optional(),\n tierType: z.enum(progressTierTypes).default(ProgressTierType.shipping),\n});\n\nexport type CABTextTier = z.infer<typeof CABTextTier>;\n\nexport const CABTextSection = z\n .object({\n buttonField: z.enum(buttonFields).optional(),\n content: z\n .record(z.string(), z.union([z.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional())\n .default({ en: TiptapDocument.parse({}) })\n .optional(),\n name: z.string().optional(),\n optionId: z.number().optional(),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.text).default(SectionType.text),\n tier: CABTextTier.optional(),\n })\n .superRefine(({ buttonField, content }, ctx) => {\n if (buttonField === ButtonField.destinationUrl && content) {\n forEach(content, (value, lang) => {\n if (value && isString(value)) {\n if (DYNAMIC_TOKEN_REGEX.test(value)) return;\n\n try {\n new URL(value);\n } catch {\n ctx.addIssue({\n code: 'custom',\n message: 'Invalid URL',\n path: ['content', lang],\n });\n }\n }\n });\n }\n });\n\nexport type CABTextSection = z.infer<typeof CABTextSection>;\n\nexport type CABTextSectionProps = CABTextSection & SectionDetails;\n", "import { isPlainObject, mapValues } from 'es-toolkit';\nimport { every, get, isArray, isString, map, size, toPairs } from 'es-toolkit/compat';\n\nimport { type CABBannerSection } from './banner';\nimport { type CABButtonSection } from './button';\nimport { type CABCarouselSection } from './carousel';\nimport { type CABCartLineSection } from './cartLine';\nimport { ButtonField, SectionType } from './common';\nimport { type CABDataSourceSection } from './dataSource';\nimport { type CABDiscountSection } from './discount';\nimport { type CABImageSection } from './image';\nimport { type CABLayoutSection } from './layout';\nimport { type CABMonetizeSection } from './monetize';\nimport { type CABOffersSection } from './offers';\nimport { type CABProductSection } from './product';\nimport { type CABProductsSection } from './products';\nimport { type CABProgressBarSection } from './progressBar';\nimport { type CABQuantitySection } from './quantity';\nimport { ARRAY_INDEX_STRING, HTML_TAGS_REGEX } from './regex';\nimport { type CABReviewsSection } from './reviews';\nimport { type CABTextSection, type TiptapDocument } from './text';\nimport { type CABVariantsSection } from './variants';\n\nexport const isHTML = (html: string | undefined = ''): boolean => {\n if (typeof window !== 'undefined') {\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, 'text/html');\n\n const hasHTML = (nodeList: NodeList) => Array.from(nodeList).some((node) => node.nodeType === 1);\n\n return hasHTML(doc.body.childNodes) || hasHTML(doc.head.childNodes);\n }\n\n // `.search()` (not `.test()`) because HTML_TAGS_REGEX is global for downstream `.replace` callers;\n // `.search()` ignores and never advances `lastIndex`, so repeated calls stay deterministic.\n return html.search(HTML_TAGS_REGEX) !== -1;\n};\n\nexport const hasHTMLInDoc = (doc: TiptapDocument): boolean =>\n doc.content.some(({ content = [] }) => content.some(({ text }) => isHTML(text)));\n\nexport const checkForHTML = (input: string | TiptapDocument): boolean =>\n !((isString(input) && isHTML(input)) || (isPlainObject(input) && hasHTMLInDoc(input as TiptapDocument)));\n\nexport const NO_HTML = { message: 'HTML is not supported' };\n\nexport const isBannerType = (section: unknown): section is CABBannerSection =>\n get(section, 'sectionType') === SectionType.banner;\n\nexport const isButtonType = (section: unknown): section is CABButtonSection =>\n get(section, 'sectionType') === SectionType.button;\n\nexport const isCarouselType = (section: unknown): section is CABCarouselSection =>\n get(section, 'sectionType') === SectionType.carousel;\n\nexport const isCartLineType = (section: unknown): section is CABCartLineSection =>\n get(section, 'sectionType') === SectionType.cartLine;\n\nexport const isDataSourceType = (section: unknown): section is CABDataSourceSection =>\n get(section, 'sectionType') === SectionType.dataSource;\n\nexport const isDiscountType = (section: unknown): section is CABDiscountSection =>\n get(section, 'sectionType') === SectionType.discount;\n\nexport const isImageType = (section: unknown): section is CABImageSection =>\n get(section, 'sectionType') === SectionType.image;\n\nexport const isLayoutType = (section: unknown): section is CABLayoutSection =>\n get(section, 'sectionType') === SectionType.layout;\n\nexport const isMonetizeType = (section: unknown): section is CABMonetizeSection =>\n get(section, 'sectionType') === SectionType.monetize;\n\nexport const isOffersType = (section: unknown): section is CABOffersSection =>\n get(section, 'sectionType') === SectionType.offers;\n\nexport const isOverlayType = (section: unknown): section is CABLayoutSection =>\n isLayoutType(section) && get(section, 'buttonField') === ButtonField.overlayContent;\n\nexport const isProductType = (section: unknown): section is CABProductSection =>\n get(section, 'sectionType') === SectionType.product;\n\nexport const isProductsType = (section: unknown): section is CABProductsSection =>\n get(section, 'sectionType') === SectionType.products;\n\nexport const isProgressBarType = (section: unknown): section is CABProgressBarSection =>\n get(section, 'sectionType') === SectionType.progressBar;\n\nexport const isQuantityType = (section: unknown): section is CABQuantitySection =>\n get(section, 'sectionType') === SectionType.quantity;\n\nexport const isReviewsType = (section: unknown): section is CABReviewsSection =>\n get(section, 'sectionType') === SectionType.reviews;\n\nexport const isTextType = (section: unknown): section is CABTextSection =>\n get(section, 'sectionType') === SectionType.text;\n\nexport const isVariantsType = (section: unknown): section is CABVariantsSection =>\n get(section, 'sectionType') === SectionType.variants;\n\nconst hasOnlyNumericKeys = (input: Record<string, unknown>) =>\n !!size(input) && every(input, (_, key) => ARRAY_INDEX_STRING.test(key) && Number.isSafeInteger(Number(key)));\n\nconst numericObjectToArray = (input: Record<string, unknown>) =>\n toPairs(input)\n .sort(([a], [b]) => Number(a) - Number(b))\n .map(([_, value]) => value);\n\nexport const convertNumericObjects = (input: unknown): unknown => {\n if (isArray(input)) return map(input, convertNumericObjects);\n\n if (isPlainObject(input)) {\n const obj = input as Record<string, unknown>;\n\n return hasOnlyNumericKeys(obj)\n ? map(numericObjectToArray(obj), convertNumericObjects)\n : mapValues(obj, convertNumericObjects);\n }\n\n return input;\n};\n", "import { z } from 'zod';\n\nimport { SectionType } from './common';\nimport { CABLayoutSection } from './layout';\nimport { CABOffersSection } from './offers';\nimport { CABSection, type SectionDetails } from './shared';\n\nexport const CABCarouselSection = z.lazy(() =>\n CABLayoutSection.omit({ sections: true, sectionType: true }).extend({\n autoAdvanceInterval: z.number().default(0),\n itemsAtOnce: z.number().min(1).default(1),\n sections: z\n .union([z.array(z.lazy(() => CABSection)), z.strictObject({}).transform(() => [])])\n .default(() => [CABOffersSection.parse({})]),\n sectionType: z.literal(SectionType.carousel).default(SectionType.carousel),\n })\n);\n\nexport type CABCarouselSection = Omit<CABLayoutSection, 'sectionType'> & {\n autoAdvanceInterval: number;\n itemsAtOnce: number;\n sectionType: 'carousel';\n};\n\nexport type CABCarouselSectionProps = CABCarouselSection & SectionDetails;\n", "import { z } from 'zod';\n\nimport { CABBannerSection } from './banner';\nimport { CABButtonSection } from './button';\nimport { ButtonStyle, SectionType } from './common';\nimport { CABDataSourceSection } from './dataSource';\nimport { CABLayoutSection } from './layout';\nimport { CABProductsSection } from './products';\nimport { CABSection, type SectionDetails } from './shared';\nimport { CABTextSection } from './text';\n\nexport const CABOffersSection = z.lazy(() =>\n CABLayoutSection.omit({ sections: true, sectionType: true }).extend({\n sections: z.union([z.array(z.lazy(() => CABSection)), z.strictObject({}).transform(() => [])]).default(() => [\n CABBannerSection.parse({\n buttonField: 'undoAddToOrder',\n color: 'success',\n dismissible: true,\n name: 'Success Banner',\n sections: [\n CABTextSection.parse({ content: { en: '{{quantity}} {{productTitle}} added to cart.' } }),\n CABButtonSection.parse({ action: 'undoAddToOrder', buttonStyle: ButtonStyle.plain }),\n ],\n }),\n CABDataSourceSection.parse({}),\n CABProductsSection.parse({}),\n ]),\n sectionType: z.literal(SectionType.offers).default(SectionType.offers),\n })\n);\n\nexport type CABOffersSection = Omit<CABLayoutSection, 'sectionType'> & {\n sectionType: 'offers';\n};\n\nexport type CABOffersSectionProps = CABOffersSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { discountSources, discountTypes, productTypes, SectionType } from './common';\nimport { DEFAULT_ENDPOINTS } from './constants';\nimport { type SectionDetails } from './shared';\n\nexport const CABDiscount = z.object({\n amount: z.union([z.number(), z.string()]).catch(0),\n discountedBy: z.string().optional(),\n discountedFrom: z.enum(discountSources).optional().catch(undefined),\n type: z.enum(discountTypes).catch('none'),\n});\n\nexport type CABDiscount = z.infer<typeof CABDiscount>;\n\nexport const CABIntegrations = z.object({\n judgeme: z.boolean().default(false),\n junip: z.boolean().default(false),\n klaviyo: z.boolean().default(false),\n loox: z.boolean().default(false),\n okendo: z.boolean().default(false),\n opinew: z.boolean().default(false),\n reviewsio: z.boolean().default(false),\n stamped: z.boolean().default(false),\n yotpo: z.boolean().default(false),\n});\n\nexport type CABIntegrations = z.infer<typeof CABIntegrations>;\n\nexport const CABDataSourceSection = z.object({\n dataSourceId: z.number().nullable().default(null),\n dataSourcePath: z.string().default(DEFAULT_ENDPOINTS[0].value),\n discount: CABDiscount.optional(),\n integrations: CABIntegrations.optional(),\n limit: z.number().default(1),\n matchVariant: z.boolean().default(false),\n matchVariantOutOfStock: z.boolean().default(false),\n name: z.string().default(DEFAULT_ENDPOINTS[0].label),\n productType: z.enum(productTypes).optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.dataSource).default(SectionType.dataSource),\n /** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */\n subscriptionIsDefault: z.boolean().default(false),\n treatAsGwp: z.boolean().default(false),\n});\n\nexport type CABDataSourceSection = z.infer<typeof CABDataSourceSection>;\n\nexport type CABDataSourceSectionProps = CABDataSourceSection & SectionDetails;\n", "import { uniqBy } from 'es-toolkit';\n\nimport { EditorMode, freezeEnum } from './common';\nimport { type TargetArea } from './root';\n\nexport const DEFAULT_ENDPOINTS = [\n { label: 'Recommended (AI)', value: '/products/recommended' },\n { label: 'Top Sellers', value: '/products/top_sellers' },\n { label: 'Buy It Again', value: '/products/purchased' },\n { label: 'Recently Viewed', value: '/products/viewed' },\n { label: 'Products Search', value: '/products/search' },\n { label: 'Collection Products', value: '/products/collections' },\n { label: 'Similar Products (AI)', value: '/products/similar_products' },\n] as const;\n\nexport const STATIC_ENDPOINTS = [\n { label: 'Recommended (AI)', value: '/products/recommended' },\n { label: 'Top Sellers', value: '/products/top_sellers' },\n { label: 'Trending Products', value: '/products/trending_products' },\n { label: 'Buy It Again', value: '/products/purchased' },\n { label: 'Collection Products', value: '/products/collections' },\n { label: 'Recently Viewed', value: '/products/viewed' },\n { label: 'Static Products', value: '/products/static' },\n { label: 'Products Search', value: '/products/search' },\n { label: 'Similar Products (AI)', value: '/products/similar_products' },\n] as const;\n\nexport const COMBINED_ENDPOINTS = uniqBy([...DEFAULT_ENDPOINTS, ...STATIC_ENDPOINTS], (item) => item.value);\n\nexport const targetAreas = {\n [EditorMode.checkoutExtension]: [\n { icon: 'splitscreen_top', label: 'Header Area', width: '984px' },\n { icon: 'splitscreen_left', label: 'Main Column', width: '503px' },\n { icon: 'splitscreen_right', label: 'Summary Column', width: '404px' },\n ] satisfies TargetArea[],\n [EditorMode.postPurchaseOffer]: null,\n [EditorMode.thankYouPage]: [\n { icon: 'splitscreen_top', label: 'Header Area', width: '984px' },\n { icon: 'splitscreen_left', label: 'Main Column', width: '503px' },\n { icon: 'splitscreen_right', label: 'Summary Column', width: '404px' },\n ] satisfies TargetArea[],\n [EditorMode.orderStatusPage]: [\n // { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },\n { icon: 'splitscreen_top', label: 'Header Area', width: '1124px' },\n { fill: true, icon: 'view_column_2', label: 'Main Area', width: '646px' },\n { icon: 'splitscreen_bottom', label: 'Footer Area', width: '1124px' },\n ] satisfies TargetArea[],\n [EditorMode.ordersIndexPage]: [\n // { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },\n { icon: 'splitscreen_top', label: 'Main Area', width: '1124px' },\n ] satisfies TargetArea[],\n [EditorMode.customerProfilePage]: [\n // { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },\n { icon: 'splitscreen_top', label: 'Main Area', width: '1124px' },\n ] satisfies TargetArea[],\n} as const;\n\nexport const widgetTypes = [\n 'bundle_builder',\n 'cart',\n 'cart_subscription',\n 'dynamic_bundle',\n 'gift_with_purchase',\n 'pre_purchase',\n 'product',\n 'product_addon',\n 'product_upsell',\n 'recharge_checkout',\n 'recharge_customer_portal',\n 'recharge_post_purchase',\n 'shopify_checkout',\n 'shopify_checkout_extension',\n 'shopify_post_purchase',\n 'shopify_post_purchase_extension',\n 'switch_to_subscription',\n 'ui_extension_ad',\n 'ui_extension_button',\n 'ui_extension_content_block',\n 'ui_extension_line_item_editor',\n 'ui_extension_progress_bar',\n] as const;\n\nexport const WidgetType = freezeEnum(widgetTypes);\nexport type WidgetType = (typeof widgetTypes)[number];\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { SectionType } from './common';\nimport { CABProductSection } from './product';\nimport { type SectionDetails } from './shared';\n\nexport const CABProductsSection = z.object({\n name: z.string().optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sections: z\n .union([z.array(z.lazy(() => CABProductSection)), z.strictObject({}).transform(() => [])])\n .default(() => []),\n sectionType: z.literal(SectionType.products).default(SectionType.products),\n});\n\nexport type CABProductsSection = z.infer<typeof CABProductsSection>;\n\nexport type CABProductsSectionProps = CABProductsSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z, type ZodType } from 'zod';\n\nimport { CABButtonSection } from './button';\nimport { SectionType, VariantMode, variantModes, VariantSelector, variantSelectors } from './common';\nimport { type SectionDetails } from './shared';\nimport { CABTextSection } from './text';\n\nexport type CABVariantContent = CABButtonSection | CABTextSection;\n\nexport const CABVariantContent: ZodType<CABVariantContent> = z.lazy(() =>\n z.discriminatedUnion('sectionType', [CABButtonSection, CABTextSection])\n);\n\nexport const CABProductSection = z.object({\n name: z.string().optional(),\n productId: z.number().nullable().default(null),\n sectionId: z.uuid().default(() => uuidv7()),\n sections: z.union([z.array(CABVariantContent), z.strictObject({}).transform(() => [])]).default(() => []),\n sectionType: z.literal(SectionType.product).default(SectionType.product),\n selectors: z.record(z.string(), z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),\n variantMode: z.enum(variantModes).default(VariantMode.multiple),\n});\n\nexport type CABProductSection = z.infer<typeof CABProductSection>;\n\nexport type CABProductSectionProps = CABProductSection & SectionDetails;\n", "import { z } from 'zod';\n\nimport { CABButtonSection } from './button';\nimport { ButtonAction, SectionType } from './common';\nimport { CABLayoutSection } from './layout';\nimport { CABSection, type SectionDetails } from './shared';\n\nexport const CABCartLineSection = z.lazy(() =>\n CABLayoutSection.omit({ sections: true, sectionType: true }).extend({\n sections: z\n .union([z.array(z.lazy(() => CABSection)), z.strictObject({}).transform(() => [])])\n .default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),\n sectionType: z.literal(SectionType.cartLine).default(SectionType.cartLine),\n })\n);\n\nexport type CABCartLineSection = Omit<CABLayoutSection, 'sectionType'> & {\n sectionType: 'cartLine';\n};\n\nexport type CABCartLineSectionProps = CABCartLineSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { discountSources, discountTypes, SectionType } from './common';\nimport { type SectionDetails } from './shared';\n\n/**\n * The widget discount, modeled as its own offers child section (toggled on/off in the editor and\n * rendered nowhere \u2014 it's config-only). Discounting is Shopify Functions-only (Scripts is sunset), so a\n * configured discount always applies via Functions and the amount is in Functions (minor-unit) form for\n * fixed types. `discountedFrom` is the compare-from source; `message` is the Functions discount title.\n */\nexport const CABDiscountSection = z.object({\n amount: z.union([z.number(), z.string()]).catch(0),\n discountedBy: z.string().optional(),\n discountedFrom: z.enum(discountSources).optional().catch(undefined),\n message: z.string().optional(),\n name: z.string().optional(),\n quantity: z.number().default(1),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.discount).default(SectionType.discount),\n type: z.enum(discountTypes).catch('none'),\n});\n\nexport type CABDiscountSection = z.infer<typeof CABDiscountSection>;\n\nexport type CABDiscountSectionProps = CABDiscountSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { SectionType } from './common';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\n\nexport const CABMonetizeSection = z.object({\n name: z.string().optional(),\n /** Privacy Policy footer href (the widget's `privacy_policy_url` setting); the client relays it to `/cab/monetize`. */\n privacyPolicyUrl: z.string().optional(),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.monetize).default(SectionType.monetize),\n});\n\nexport type CABMonetizeSection = z.infer<typeof CABMonetizeSection>;\n\nexport type CABMonetizeSectionProps = CABMonetizeSection & SectionDetails;\n", "import { z } from 'zod';\n\nimport { ProgressTierType, progressTierTypes, ProgressTierUnit, progressTierUnits, SectionType } from './common';\nimport { GIFT_LABELS } from './giftLabels';\nimport { CABLayoutSection } from './layout';\nimport { type SectionDetails } from './shared';\n\nexport const CABProgressTier = z.object({\n /**\n * Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at\n * cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.\n * `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});\n * `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.\n */\n discount: z.object({ amount: z.number().nonnegative(), type: z.enum(['fixedAmount', 'percentage']) }).optional(),\n /**\n * Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches\n * `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart\n * when the tier is reached (attribution `_tier` = {@link CABProgressTier.tierId}). Absent on shipping\n * tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the\n * tree is complete.\n */\n gift: z\n .object({\n productId: z.number().int().positive(),\n title: z.string().optional(),\n variantIds: z.array(z.number().int().positive()).default(() => []),\n })\n .optional(),\n /**\n * The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the\n * type default ('Free Shipping' / product title / '{n}% Discount'). Localized content; blank \u21D2 no\n * label under the tier's icon. Plain text \u2014 the step row is a compact icon+label, not rich copy.\n */\n label: z.record(z.string(), z.string()).optional(),\n /**\n * The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents \u2014 the canonical\n * fallback: when the buyer's presentment currency has no entry in `thresholds`, the client\n * multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` \u2192 `7500`).\n * `item`: a raw item count \u2014 no cents, no FX, no `thresholds` overrides.\n */\n threshold: z.number().int().nonnegative(),\n /**\n * Per-presentment-currency goal overrides \u2014 lowercased ISO currency code \u2192 cents (e.g. `{ cad: 9900 }`).\n * When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting\n * `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a\n * converted base. Defaults to `{}` \u2014 no overrides means always fall back to `threshold`.\n */\n thresholds: z.record(z.string(), z.number().int().nonnegative()).default(() => ({})),\n /**\n * Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can\n * match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the\n * shipping bar (single unlabeled tier, no gift).\n */\n tierId: z.string().optional(),\n tierType: z.enum(progressTierTypes).default(ProgressTierType.shipping),\n /**\n * What this tier's progress is measured in \u2014 PER TIER (onsite's `unlock_condition_type` model, NOT\n * the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the\n * adjusted subtotal; `item` compares the raw quantity sum of non-excluded lines (the SAME exclusion\n * set as the money path). A mixed-unit bar stays coherent tier by tier: reach, fill share, and\n * `{{remainingAmount}}` (count-formatted + item/items-pluralized for `item` tiers) each resolve in\n * their own tier's unit \u2014 cross-tier arithmetic never mixes counts with cents.\n */\n unit: z.enum(progressTierUnits).default(ProgressTierUnit.currency),\n});\n\nexport type CABProgressTier = z.infer<typeof CABProgressTier>;\n\n/**\n * A self-contained progress-bar container. Extends `layout` (alignment/border/spacing/`sections`/\u2026), so it\n * holds ALL its pieces as composable children \u2014 the tier display (a `columns \u2192 rows \u2192 text/image` layout)\n * and the reached/remaining message `text`s \u2014 while the renderer adds the bar fill from `tiers` and shows\n * the active message. Everything is encapsulated under this one named section (and one country/FX gate).\n */\nexport const CABProgressBarSection = z.lazy(() =>\n CABLayoutSection.omit({ sectionType: true }).extend({\n /** Empty = shown everywhere; otherwise uppercase ISO country codes. */\n countryCodes: z.array(z.string().transform((code) => code.trim().toUpperCase())).default(() => []),\n /**\n * Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is\n * hidden there \u2014 replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.\n */\n excludeCountryCodes: z.array(z.string().transform((code) => code.trim().toUpperCase())).default(() => []),\n /**\n * Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and\n * forced on for bars with a discount tier so its own reward can't un-reach the tier). The client\n * adds the cart's discount allocations back to the live subtotal.\n */\n excludeDiscountInSubtotal: z.boolean().default(false),\n /** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */\n excludedVariantIds: z.array(z.number().int().positive()).default(() => []),\n /**\n * When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React\n * `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.\n */\n freeShippingOnSubscription: z.boolean().default(false),\n /** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */\n giftAreaTitle: z.record(z.string(), z.string()).default(() => ({ en: 'FREE GIFTS' })),\n /** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */\n giftLabels: z\n .object({\n addGift: z.record(z.string(), z.string()).default(() => ({ ...GIFT_LABELS.addGift })),\n remove: z.record(z.string(), z.string()).default(() => ({ ...GIFT_LABELS.remove })),\n selectOptions: z.record(z.string(), z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),\n yourGift: z.record(z.string(), z.string()).default(() => ({ ...GIFT_LABELS.yourGift })),\n })\n .default(() => ({\n addGift: { ...GIFT_LABELS.addGift },\n remove: { ...GIFT_LABELS.remove },\n selectOptions: { ...GIFT_LABELS.selectOptions },\n yourGift: { ...GIFT_LABELS.yourGift },\n })),\n /** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */\n name: z.string().default('Order progress'),\n /**\n * Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server\n * fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still\n * absent after that \u21D2 the theme fetch failed and the client renders its platform-default bar \u2014\n * optional, not defaulted, so \"merchant chose no color\" stays distinguishable from any real value.\n */\n progressColor: z.string().optional(),\n sectionType: z.literal(SectionType.progressBar).default(SectionType.progressBar),\n /**\n * The bar's milestones, in any order \u2014 the renderer sorts by resolved threshold. Drives the fill\n * (even slot per tier) and, for smart-cart product tiers, the gift add/remove. The visual tier\n * display lives in `sections` (composable), NOT here.\n */\n tiers: z.union([z.array(CABProgressTier), z.strictObject({}).transform(() => [])]).default(() => []),\n })\n);\n\nexport type CABProgressBarSection = Omit<CABLayoutSection, 'name' | 'sectionType'> & {\n countryCodes: string[];\n excludeCountryCodes: string[];\n excludeDiscountInSubtotal: boolean;\n excludedVariantIds: number[];\n freeShippingOnSubscription: boolean;\n giftAreaTitle: Record<string, string>;\n giftLabels: Record<'addGift' | 'remove' | 'selectOptions' | 'yourGift', Record<string, string>>;\n name: string;\n progressColor?: string;\n sectionType: 'progressBar';\n tiers: CABProgressTier[];\n};\n\nexport type CABProgressBarSectionProps = CABProgressBarSection & SectionDetails;\n", "/**\n * Default localized labels for the smart-cart gift controls, keyed by slot then locale (same 26 locales\n * as `SWITCH_LABELS`). Schema-default content, never a client dictionary (Peter, 2026-07-06: visible\n * customer strings must be localized). `yourGift` is the generic heading \u2014 a tier's configured gift\n * `title` beats it when present.\n */\nexport const GIFT_LABELS = {\n addGift: {\n ar: '\u0623\u0636\u0641 \u0627\u0644\u0647\u062F\u064A\u0629',\n cs: 'P\u0159idat d\u00E1rek',\n da: 'Tilf\u00F8j gave',\n de: 'Geschenk hinzuf\u00FCgen',\n en: 'Add gift',\n es: 'A\u00F1adir regalo',\n fi: 'Lis\u00E4\u00E4 lahja',\n fr: 'Ajouter le cadeau',\n ga: 'Cuir bronntanas leis',\n he: '\u05D4\u05D5\u05E1\u05E3 \u05DE\u05EA\u05E0\u05D4',\n hi: '\u0909\u092A\u0939\u093E\u0930 \u091C\u094B\u0921\u093C\u0947\u0902',\n id: 'Tambahkan hadiah',\n it: 'Aggiungi regalo',\n ja: '\u30AE\u30D5\u30C8\u3092\u8FFD\u52A0',\n ko: '\uC0AC\uC740\uD488 \uCD94\uAC00',\n nl: 'Cadeau toevoegen',\n no: 'Legg til gave',\n pl: 'Dodaj prezent',\n pt: 'Adicionar presente',\n ru: '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u0434\u0430\u0440\u043E\u043A',\n sv: 'L\u00E4gg till g\u00E5va',\n th: '\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E02\u0E2D\u0E07\u0E02\u0E27\u0E31\u0E0D',\n tr: 'Hediye ekle',\n uk: '\u0414\u043E\u0434\u0430\u0442\u0438 \u043F\u043E\u0434\u0430\u0440\u0443\u043D\u043E\u043A',\n vi: 'Th\u00EAm qu\u00E0 t\u1EB7ng',\n zh: '\u6DFB\u52A0\u8D60\u54C1',\n },\n remove: {\n ar: '\u0625\u0632\u0627\u0644\u0629',\n cs: 'Odebrat',\n da: 'Fjern',\n de: 'Entfernen',\n en: 'Remove',\n es: 'Eliminar',\n fi: 'Poista',\n fr: 'Retirer',\n ga: 'Bain',\n he: '\u05D4\u05E1\u05E8',\n hi: '\u0939\u091F\u093E\u090F\u0901',\n id: 'Hapus',\n it: 'Rimuovi',\n ja: '\u524A\u9664',\n ko: '\uC81C\uAC70',\n nl: 'Verwijderen',\n no: 'Fjern',\n pl: 'Usu\u0144',\n pt: 'Remover',\n ru: '\u0423\u0434\u0430\u043B\u0438\u0442\u044C',\n sv: 'Ta bort',\n th: '\u0E19\u0E33\u0E2D\u0E2D\u0E01',\n tr: 'Kald\u0131r',\n uk: '\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438',\n vi: 'X\u00F3a',\n zh: '\u79FB\u9664',\n },\n selectOptions: {\n ar: '\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A',\n cs: 'Vyberte mo\u017Enosti',\n da: 'V\u00E6lg muligheder',\n de: 'Optionen w\u00E4hlen',\n en: 'Select Options',\n es: 'Seleccionar opciones',\n fi: 'Valitse vaihtoehdot',\n fr: 'Choisir les options',\n ga: 'Roghnaigh roghanna',\n he: '\u05D1\u05D7\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA',\n hi: '\u0935\u093F\u0915\u0932\u094D\u092A \u091A\u0941\u0928\u0947\u0902',\n id: 'Pilih opsi',\n it: 'Seleziona le opzioni',\n ja: '\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E',\n ko: '\uC635\uC158 \uC120\uD0DD',\n nl: 'Opties kiezen',\n no: 'Velg alternativer',\n pl: 'Wybierz opcje',\n pt: 'Selecionar op\u00E7\u00F5es',\n ru: '\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B',\n sv: 'V\u00E4lj alternativ',\n th: '\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01',\n tr: 'Se\u00E7enekleri se\u00E7',\n uk: '\u0412\u0438\u0431\u0440\u0430\u0442\u0438 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0438',\n vi: 'Ch\u1ECDn t\u00F9y ch\u1ECDn',\n zh: '\u9009\u62E9\u9009\u9879',\n },\n yourGift: {\n ar: '\u0647\u062F\u064A\u062A\u0643',\n cs: 'V\u00E1\u0161 d\u00E1rek',\n da: 'Din gave',\n de: 'Ihr Geschenk',\n en: 'Your gift',\n es: 'Tu regalo',\n fi: 'Lahjasi',\n fr: 'Votre cadeau',\n ga: 'Do bhronntanas',\n he: '\u05D4\u05DE\u05EA\u05E0\u05D4 \u05E9\u05DC\u05DA',\n hi: '\u0906\u092A\u0915\u093E \u0909\u092A\u0939\u093E\u0930',\n id: 'Hadiah Anda',\n it: 'Il tuo regalo',\n ja: '\u3042\u306A\u305F\u306E\u30AE\u30D5\u30C8',\n ko: '\uACE0\uAC1D\uB2D8\uC758 \uC0AC\uC740\uD488',\n nl: 'Uw cadeau',\n no: 'Din gave',\n pl: 'Tw\u00F3j prezent',\n pt: 'Seu presente',\n ru: '\u0412\u0430\u0448 \u043F\u043E\u0434\u0430\u0440\u043E\u043A',\n sv: 'Din g\u00E5va',\n th: '\u0E02\u0E2D\u0E07\u0E02\u0E27\u0E31\u0E0D\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n tr: 'Hediyeniz',\n uk: '\u0412\u0430\u0448 \u043F\u043E\u0434\u0430\u0440\u0443\u043D\u043E\u043A',\n vi: 'Qu\u00E0 c\u1EE7a b\u1EA1n',\n zh: '\u60A8\u7684\u8D60\u54C1',\n },\n} satisfies Record<string, Record<string, string>>;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { QuantityInput, quantityInputs, SectionType } from './common';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\n\nexport const CABQuantitySection = z.object({\n errorMessages: z\n .record(\n z.string(),\n z.object({\n /** `{{step}}` is interpolated at render \u2014 the off-increment message React never gave a merchant key. */\n increment: z.string().optional(),\n max: z.string().optional(),\n min: z.string().optional(),\n neg: z.string().optional(),\n })\n )\n .default({\n en: {\n increment: 'Quantity must be in increments of {{step}}',\n max: 'Maximum quantity allowed is {{max}}',\n min: 'Minimum quantity required is {{min}}',\n neg: 'Quantity cannot be negative',\n },\n }),\n inputType: z.enum(quantityInputs).default(QuantityInput.select),\n max: z.number().min(1).max(100).default(10),\n min: z.number().min(1).default(1),\n /** The a11y label for the quantity control; the merchant names it in the editor, else this default. */\n name: z.string().default('Quantity'),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.quantity).default(SectionType.quantity),\n});\n\nexport type CABQuantitySection = z.infer<typeof CABQuantitySection>;\n\nexport type CABQuantitySectionProps = CABQuantitySection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { ReviewsSize, reviewsSizes, SectionType } from './common';\nimport { REVIEW_LABELS } from './reviewLabels';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\n\nexport const CABReviewsSection = z.object({\n color: z.string().default('#fadb14'),\n /**\n * Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the\n * form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter\n * or merchant work.\n */\n countLabels: z\n .object({\n one: z.record(z.string(), z.string()).default(() => ({ ...REVIEW_LABELS.one })),\n other: z.record(z.string(), z.string()).default(() => ({ ...REVIEW_LABELS.other })),\n })\n .default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),\n name: z.string().optional(),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.reviews).default(SectionType.reviews),\n size: z.enum(reviewsSizes).default(ReviewsSize.default),\n});\n\nexport type CABReviewsSection = z.infer<typeof CABReviewsSection>;\n\nexport type CABReviewsSectionProps = CABReviewsSection & SectionDetails;\n", "/**\n * Default localized review-count templates for the reviews section, keyed by CLDR-ish plural form then\n * locale (same 26 locales as `SWITCH_LABELS`). The client picks `one` vs `other` via `Intl.PluralRules`\n * and interpolates `{{reviewCount}}` \u2014 the two-form simplification maps every non-`one` category\n * (few/many/other) to `other`. Schema-default content, never a client dictionary (Peter, 2026-07-06:\n * visible customer strings must be localized).\n */\nexport const REVIEW_LABELS = {\n one: {\n ar: '({{reviewCount}} \u062A\u0642\u064A\u064A\u0645)',\n cs: '({{reviewCount}} recenze)',\n da: '({{reviewCount}} anmeldelse)',\n de: '({{reviewCount}} Bewertung)',\n en: '({{reviewCount}} review)',\n es: '({{reviewCount}} rese\u00F1a)',\n fi: '({{reviewCount}} arvostelu)',\n fr: '({{reviewCount}} avis)',\n ga: '({{reviewCount}} l\u00E9irmheas)',\n he: '({{reviewCount}} \u05D1\u05D9\u05E7\u05D5\u05E8\u05EA)',\n hi: '({{reviewCount}} \u0938\u092E\u0940\u0915\u094D\u0937\u093E)',\n id: '({{reviewCount}} ulasan)',\n it: '({{reviewCount}} recensione)',\n ja: '({{reviewCount}}\u4EF6\u306E\u30EC\u30D3\u30E5\u30FC)',\n ko: '({{reviewCount}}\uAC1C \uB9AC\uBDF0)',\n nl: '({{reviewCount}} beoordeling)',\n no: '({{reviewCount}} anmeldelse)',\n pl: '({{reviewCount}} opinia)',\n pt: '({{reviewCount}} avalia\u00E7\u00E3o)',\n ru: '({{reviewCount}} \u043E\u0442\u0437\u044B\u0432)',\n sv: '({{reviewCount}} recension)',\n th: '({{reviewCount}} \u0E23\u0E35\u0E27\u0E34\u0E27)',\n tr: '({{reviewCount}} de\u011Ferlendirme)',\n uk: '({{reviewCount}} \u0432\u0456\u0434\u0433\u0443\u043A)',\n vi: '({{reviewCount}} \u0111\u00E1nh gi\u00E1)',\n zh: '({{reviewCount}} \u6761\u8BC4\u4EF7)',\n },\n other: {\n ar: '({{reviewCount}} \u062A\u0642\u064A\u064A\u0645\u0627\u062A)',\n cs: '({{reviewCount}} recenz\u00ED)',\n da: '({{reviewCount}} anmeldelser)',\n de: '({{reviewCount}} Bewertungen)',\n en: '({{reviewCount}} reviews)',\n es: '({{reviewCount}} rese\u00F1as)',\n fi: '({{reviewCount}} arvostelua)',\n fr: '({{reviewCount}} avis)',\n ga: '({{reviewCount}} l\u00E9irmheasanna)',\n he: '({{reviewCount}} \u05D1\u05D9\u05E7\u05D5\u05E8\u05D5\u05EA)',\n hi: '({{reviewCount}} \u0938\u092E\u0940\u0915\u094D\u0937\u093E\u090F\u0901)',\n id: '({{reviewCount}} ulasan)',\n it: '({{reviewCount}} recensioni)',\n ja: '({{reviewCount}}\u4EF6\u306E\u30EC\u30D3\u30E5\u30FC)',\n ko: '({{reviewCount}}\uAC1C \uB9AC\uBDF0)',\n nl: '({{reviewCount}} beoordelingen)',\n no: '({{reviewCount}} anmeldelser)',\n pl: '({{reviewCount}} opinii)',\n pt: '({{reviewCount}} avalia\u00E7\u00F5es)',\n ru: '({{reviewCount}} \u043E\u0442\u0437\u044B\u0432\u043E\u0432)',\n sv: '({{reviewCount}} recensioner)',\n th: '({{reviewCount}} \u0E23\u0E35\u0E27\u0E34\u0E27)',\n tr: '({{reviewCount}} de\u011Ferlendirme)',\n uk: '({{reviewCount}} \u0432\u0456\u0434\u0433\u0443\u043A\u0456\u0432)',\n vi: '({{reviewCount}} \u0111\u00E1nh gi\u00E1)',\n zh: '({{reviewCount}} \u6761\u8BC4\u4EF7)',\n },\n} satisfies Record<'one' | 'other', Record<string, string>>;\n", "import { slice } from 'es-toolkit/compat';\nimport { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { SectionType, VariantMode, variantModes, VariantSelector, variantSelectors } from './common';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\n\nexport const CABVariantsSection = z.object({\n hideOutOfStockVariants: z.boolean().default(false),\n name: z.string().optional(),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.variants).default(SectionType.variants),\n selector: z.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),\n variantMode: z.enum(variantModes).default(VariantMode.multiple),\n});\n\nexport type CABVariantsSection = z.infer<typeof CABVariantsSection>;\n\nexport type CABVariantsSectionProps = CABVariantsSection & SectionDetails;\n", "const HTML_COMMENT_RE = /<!--[\\s\\S]*?-->/g;\nconst STRIPPED_ELEMENT_RE = /<(script|style|iframe|object|embed|noscript|template)\\b[^>]*>[\\s\\S]*?(?:<\\/\\1\\s*>|$)/gi;\nconst HTML_TAG_RE = /<\\/?[a-zA-Z][^>]*>/g;\n\nexport const stripContentBlockHtml = (text: string): string =>\n text.replace(HTML_COMMENT_RE, '').replace(STRIPPED_ELEMENT_RE, '').replace(HTML_TAG_RE, '');\n", "import { TiptapParagraph, type TiptapText } from '~/schema/widgets/checkout-and-beyond/text';\nimport { stripContentBlockHtml } from '~/transforms/contentBlockV1/stripContentBlockHtml';\n\ntype ConvertTextToTiptapArgs = {\n color: string;\n fontSize: string;\n marks?: NonNullable<TiptapText['marks']>;\n text: string;\n textAlign: 'start' | 'center' | 'end';\n};\n\nexport const convertTextToTiptapParagraph = ({\n color,\n fontSize,\n marks = [],\n text,\n textAlign,\n}: ConvertTextToTiptapArgs): TiptapParagraph => {\n const sanitizedText = stripContentBlockHtml(text);\n\n return TiptapParagraph.parse({\n attrs: { textAlign },\n content: sanitizedText\n ? [\n {\n marks: [{ attrs: { color, fontSize }, type: 'textStyle' }, ...marks],\n text: sanitizedText,\n type: 'text',\n },\n ]\n : [],\n type: 'paragraph',\n });\n};\n", "/**\n * Minimal v1 content-block input types. The legacy `/widgets/settings` endpoint\n * returns the widget's settings object directly (no envelope), so the converter\n * input is just `{ id, settings }` \u2014 `name` / `owner` aren't in the upstream\n * response and would be set to schema defaults in the produced `CABRootSection`.\n */\n\nexport const SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK = 'ui_extension_content_block' as const;\n\n/** Pixel threshold above which an aside-placed image is forced to top placement. */\nexport const CONTENT_BLOCK_MAX_IMAGE_WIDTH = 560;\n\nexport type V1ImagePlacement = 'top' | 'right' | 'bottom' | 'left';\n\nexport type V1ImageBlock = {\n altText?: string | null;\n category?: string;\n description?: string | null;\n filename?: string;\n id: string;\n imagePlacement: V1ImagePlacement;\n imageSize: number;\n imageUrl: string;\n index?: number;\n textAlignment?: 'left' | 'center' | 'right';\n textSize?: string;\n};\n\nexport type V1Language = {\n description?: string;\n superTitle?: string;\n title?: string;\n};\n\nexport type V1Settings = {\n blockSpacing?: string;\n imageBlocks?: V1ImageBlock[];\n imageLayout?: 'row' | 'column';\n language?: V1Language;\n location?: 'checkout' | 'order-status' | 'thank-you';\n previewMode?: boolean;\n type: typeof SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK;\n version: 1;\n};\n\nexport type V1ConvertInput = {\n id: number;\n settings: V1Settings;\n};\n\nexport const isContentBlockV1 = (data: unknown): data is V1Settings => {\n if (!data || typeof data !== 'object') return false;\n\n const obj = data as Record<string, unknown>;\n\n return obj.version === 1 && obj.type === SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK;\n};\n", "import { CABImageSection } from '~/schema/widgets/checkout-and-beyond/image';\nimport { CABLayoutSection } from '~/schema/widgets/checkout-and-beyond/layout';\nimport { CABTextSection } from '~/schema/widgets/checkout-and-beyond/text';\nimport { convertTextToTiptapParagraph } from '~/transforms/contentBlockV1/convertTextToTiptapParagraph';\nimport { stripContentBlockHtml } from '~/transforms/contentBlockV1/stripContentBlockHtml';\nimport {\n CONTENT_BLOCK_MAX_IMAGE_WIDTH,\n type V1ImageBlock,\n type V1ImagePlacement,\n} from '~/transforms/contentBlockV1/types';\n\nconst V1_TO_CAB_ALIGN = { center: 'center', left: 'start', right: 'end' } as const;\n\n/**\n * When an aside-placed image hits the max width, the legacy renderer forces\n * placement to `top` so the description doesn't get squeezed into a zero-width\n * column. Replicate here so the v2 layout matches what the legacy React widget\n * actually displayed.\n */\nconst resolveEffectivePlacement = (placement: V1ImagePlacement, imageSize: number): V1ImagePlacement => {\n const isAside = placement === 'left' || placement === 'right';\n\n return imageSize >= CONTENT_BLOCK_MAX_IMAGE_WIDTH && isAside ? 'top' : placement;\n};\n\n/**\n * The divisor is the same constant the legacy renderer clamps at (560), so an\n * `imageSize = 560` block renders at 100% \u2014 matching the legacy behavior\n * where 560 was the full layout width.\n */\nconst widthPercentForImageSize = (imageSize: number): number =>\n Math.min(Math.round((imageSize / CONTENT_BLOCK_MAX_IMAGE_WIDTH) * 100), 100);\n\nexport const convertContentBlockImageToV2 = (block: V1ImageBlock): CABImageSection | CABLayoutSection => {\n const { altText, category, description, id, imagePlacement, imageSize, imageUrl, textAlignment, textSize } = block;\n const placement = resolveEffectivePlacement(imagePlacement, imageSize);\n\n const imageSection = CABImageSection.parse({\n altText: stripContentBlockHtml(altText ?? ''),\n category,\n sectionId: id,\n sectionType: 'image',\n source: imageUrl,\n width: widthPercentForImageSize(imageSize),\n });\n\n if (!description) return imageSection;\n\n const textSection = CABTextSection.parse({\n content: {\n en: {\n attrs: { blockSpacing: 'base' },\n content: [\n convertTextToTiptapParagraph({\n color: 'base',\n fontSize: textSize ?? 'base',\n text: description,\n textAlign: textAlignment ? V1_TO_CAB_ALIGN[textAlignment] : 'start',\n }),\n ],\n type: 'doc',\n },\n },\n sectionType: 'text',\n });\n\n return CABLayoutSection.parse({\n alignment: { horizontal: 'center', vertical: 'middle' },\n direction: placement === 'left' || placement === 'right' ? 'columns' : 'rows',\n sections:\n placement === 'left' || placement === 'top' ? [imageSection, textSection] : [textSection, imageSection],\n sectionType: 'layout',\n spacing: 'tight',\n });\n};\n", "import { TiptapDocument } from '~/schema/widgets/checkout-and-beyond/text';\nimport { convertTextToTiptapParagraph } from '~/transforms/contentBlockV1/convertTextToTiptapParagraph';\nimport { type V1Language } from '~/transforms/contentBlockV1/types';\n\nexport const convertContentBlockTextToV2 = (language: V1Language | undefined): TiptapDocument => {\n const description = language?.description;\n const superTitle = language?.superTitle;\n const title = language?.title;\n\n return TiptapDocument.parse({\n attrs: { blockSpacing: 'tight' },\n content: [\n superTitle\n ? convertTextToTiptapParagraph({\n color: 'base',\n fontSize: 'extraLarge',\n marks: [{ type: 'bold' }],\n text: superTitle,\n textAlign: 'center',\n })\n : null,\n title\n ? convertTextToTiptapParagraph({\n color: 'base',\n fontSize: 'medium',\n marks: [{ type: 'bold' }],\n text: title,\n textAlign: 'center',\n })\n : null,\n description\n ? convertTextToTiptapParagraph({\n color: 'base',\n fontSize: 'base',\n text: description,\n textAlign: 'center',\n })\n : null,\n ].filter((p): p is NonNullable<typeof p> => p !== null),\n type: 'doc',\n });\n};\n", "import { z } from 'zod';\n\nimport { EditorMode, editorModes } from './common';\nimport { targetAreas, WidgetType, widgetTypes } from './constants';\nimport { CABLayoutSection } from './layout';\nimport { UI_LABELS } from './uiLabels';\n\n/**\n * A per-slot `Record<locale, string>` defaulted from {@link UI_LABELS}: a missing slot gets the fallback,\n * and a present-but-empty slot (`{}`) is guarded back to the fallback too \u2014 otherwise the per-slot default\n * (which only fires for `undefined`) is bypassed and the client renders a blank aria label.\n */\nconst localized = (fallback: Record<string, string>) =>\n z\n .record(z.string(), z.string())\n .default(() => ({ ...fallback }))\n .transform((labels) => (Object.keys(labels).length > 0 ? labels : { ...fallback }));\n\n/**\n * Localized UI-chrome labels for the tree, defaulted from {@link UI_LABELS} at parse so every widget\n * carries them without converter or merchant work. Per-slot `Record<locale, string>`; the client indexes\n * the buyer language with `selectLanguage`. Lives on the root (not per section) because these strings \u2014\n * spinner/carousel/select-label/variant-state chrome \u2014 are shared across the whole tree.\n */\nexport const CABUILabels = z\n .object({\n currentPage: localized(UI_LABELS.currentPage),\n loadingOptions: localized(UI_LABELS.loadingOptions),\n nextPage: localized(UI_LABELS.nextPage),\n offerDialog: localized(UI_LABELS.offerDialog),\n page: localized(UI_LABELS.page),\n previousPage: localized(UI_LABELS.previousPage),\n selected: localized(UI_LABELS.selected),\n subscriptionOptions: localized(UI_LABELS.subscriptionOptions),\n updating: localized(UI_LABELS.updating),\n })\n .default(() => ({\n currentPage: { ...UI_LABELS.currentPage },\n loadingOptions: { ...UI_LABELS.loadingOptions },\n nextPage: { ...UI_LABELS.nextPage },\n offerDialog: { ...UI_LABELS.offerDialog },\n page: { ...UI_LABELS.page },\n previousPage: { ...UI_LABELS.previousPage },\n selected: { ...UI_LABELS.selected },\n subscriptionOptions: { ...UI_LABELS.subscriptionOptions },\n updating: { ...UI_LABELS.updating },\n }));\n\nexport type CABUILabels = Record<keyof typeof UI_LABELS, Record<string, string>>;\n\nconst TargetArea = z\n .object({\n fill: z.boolean().optional(),\n flip: z.enum(['both', 'horizontal', 'vertical']).optional(),\n icon: z.string(),\n label: z.string(),\n width: z.string(),\n })\n .default(targetAreas[EditorMode.checkoutExtension][1]);\n\nexport type TargetArea = {\n fill?: boolean;\n flip?: 'horizontal' | 'vertical' | 'both';\n icon: string;\n label: string;\n width: string;\n};\n\nexport const CABTracking = z\n .object({\n enableAttribution: z.boolean().default(true),\n enableSource: z.boolean().default(true),\n enableWidget: z.boolean().default(true),\n })\n .default({ enableAttribution: true, enableSource: true, enableWidget: true });\n\nexport type CABTracking = z.infer<typeof CABTracking>;\n\n/**\n * The A/B experiment this tree was selected for, attached server-side when the placeholder widget is an\n * experiment target (else absent). The client renders the chosen variant's tree as usual and emits the\n * `ab-test-viewed` / `ABN.TEST` analytics from these fields \u2014 replicating React's `useAnalyticsEvent`.\n */\nexport const CABExperiment = z.object({\n elementId: z.number(),\n experimentId: z.number(),\n experimentType: z.string(),\n selectedId: z.number(),\n});\n\nexport type CABExperiment = z.infer<typeof CABExperiment>;\n\nexport const CABRootSection = CABLayoutSection.extend({\n editorMode: z.enum(editorModes).default(EditorMode.checkoutExtension),\n experiment: CABExperiment.optional(),\n previewMode: z.boolean().default(false),\n storeId: z.number().nullable().default(null),\n targetArea: TargetArea.nullable(),\n tracking: CABTracking,\n type: z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),\n uiLabels: CABUILabels,\n version: z.literal(2).default(2),\n widgetId: z.number().nullable().default(null),\n});\n\nexport type CABRootSection = CABLayoutSection & {\n editorMode: EditorMode;\n experiment?: CABExperiment;\n previewMode: boolean;\n storeId: number | null;\n targetArea: TargetArea | null;\n tracking: CABTracking;\n type: WidgetType;\n uiLabels: CABUILabels;\n version: number;\n widgetId: number | null;\n};\n", "/**\n * Default UI-chrome labels \u2014 the buyer-visible and screen-reader strings that have no per-section\n * merchant slot: the subscription-frequency select's group label, spinner busy text, carousel control\n * names + current-page semantics, the variant selected-state suffix, and the Monetize offer dialog\n * name. Keyed by slot then locale, shipped in the payload so the client never bundles a dictionary\n * (Peter, 2026-07-06: visible customer strings must be localized). English defaults only \u2014 unlike the\n * merchant-authored `SWITCH_LABELS`/`GIFT_LABELS`, these mirror strings legacy hardcoded in English, so\n * the fix is making them payload-sourced (localizable, zero bundle) rather than inventing 25 unreviewed\n * translations; a merchant or a later localization pass can populate other locales. `{{page}}` in the\n * pagination slots is interpolated per control at render.\n */\nexport const UI_LABELS = {\n currentPage: { en: 'Page {{page}}, current' },\n loadingOptions: { en: 'Loading subscription options' },\n nextPage: { en: 'Next' },\n offerDialog: { en: 'Offer' },\n page: { en: 'Page {{page}}' },\n previousPage: { en: 'Previous' },\n selected: { en: 'selected' },\n subscriptionOptions: { en: 'Subscription Options' },\n updating: { en: 'Updating' },\n} satisfies Record<string, Record<string, string>>;\n", "import { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { convertContentBlockImageToV2 } from '~/transforms/contentBlockV1/convertContentBlockImageToV2';\nimport { convertContentBlockTextToV2 } from '~/transforms/contentBlockV1/convertContentBlockTextToV2';\nimport {\n SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK,\n type V1ConvertInput,\n type V1Language,\n} from '~/transforms/contentBlockV1/types';\n\nconst LOCATION_TO_EDITOR_MODE = {\n checkout: 'checkoutExtension',\n 'order-status': 'orderStatusPage',\n 'thank-you': 'thankYouPage',\n} as const;\n\nconst hasText = (language: V1Language | undefined): boolean =>\n !!language && !!(language.description || language.superTitle || language.title);\n\n/** Translates a v1 content-block widget into a fully-formed `CABRootSection`. */\nexport const convertContentBlockToV2 = ({ id, settings }: V1ConvertInput): CABRootSection => {\n const imageBlocks = settings.imageBlocks ?? [];\n\n return CABRootSection.parse({\n alignment: { horizontal: 'center', vertical: 'top' },\n direction: 'rows',\n editorMode: LOCATION_TO_EDITOR_MODE[settings.location ?? 'checkout'],\n previewMode: settings.previewMode,\n sections: [\n hasText(settings.language)\n ? {\n content: { en: convertContentBlockTextToV2(settings.language) },\n sectionType: 'text',\n }\n : null,\n imageBlocks.length > 0\n ? {\n // Legacy centers every image block (`InlineLayout inlineAlignment=\"center\"`).\n alignment: { horizontal: 'center', vertical: 'middle' },\n // Legacy: `image_layout === 'row' ? BlockStack : InlineStack` \u2014 an UNSET layout is\n // horizontal (columns), so only an explicit 'row' may stack vertically.\n direction: settings.imageLayout === 'row' ? 'rows' : 'columns',\n sections: imageBlocks.map(convertContentBlockImageToV2),\n sectionType: 'layout',\n spacing: settings.blockSpacing ?? 'extraTight',\n }\n : null,\n ].filter((section): section is NonNullable<typeof section> => section !== null),\n sectionType: 'layout',\n type: SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK,\n version: 2,\n widgetId: id,\n });\n};\n", "const ARRAY_INDEX_STRING = /^(?:0|[1-9]\\d*)$/;\n\nconst isPlainObject = (input: unknown): input is Record<string, unknown> => {\n if (input === null || typeof input !== 'object') return false;\n\n const proto = Object.getPrototypeOf(input) as object | null;\n\n return proto === Object.prototype || proto === null;\n};\n\nconst hasOnlyNumericKeys = (input: Record<string, unknown>): boolean => {\n const keys = Object.keys(input);\n\n if (keys.length === 0) return false;\n\n if (!keys.every((key) => ARRAY_INDEX_STRING.test(key) && Number.isSafeInteger(Number(key)))) return false;\n\n // Require the indices to form a complete `0..n-1` sequence \u2014 `{ \"10\": \"a\", \"20\": \"b\" }`\n // would otherwise silently collapse into `[\"a\", \"b\"]` and lose its original positions.\n const sorted = keys.map(Number).sort((a, b) => a - b);\n\n return sorted.every((n, i) => n === i);\n};\n\nconst numericObjectToArray = (input: Record<string, unknown>): unknown[] =>\n Object.entries(input)\n .sort(([a], [b]) => Number(a) - Number(b))\n .map(([, value]) => value);\n\n/**\n * Recursively converts objects whose keys are a complete `0..n-1` sequence\n * (PHP-serialized \"sparse\" arrays) into real arrays. Everything else passes\n * through unchanged.\n */\nexport const convertNumericObjects = (input: unknown): unknown => {\n if (Array.isArray(input)) return input.map(convertNumericObjects);\n\n if (isPlainObject(input)) {\n if (hasOnlyNumericKeys(input)) return numericObjectToArray(input).map(convertNumericObjects);\n\n const out: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(input)) out[key] = convertNumericObjects(value);\n\n return out;\n }\n\n return input;\n};\n", "const isPlainObject = (input: unknown): input is Record<string, unknown> => {\n if (input === null || typeof input !== 'object') return false;\n\n const proto = Object.getPrototypeOf(input) as object | null;\n\n return proto === Object.prototype || proto === null;\n};\n\nconst camelCase = (key: string): string =>\n key.replace(/[-_\\s]+(.)?/g, (_, char: string | undefined) => (char ? char.toUpperCase() : ''));\n\nexport type ToCamelCase<S extends string> = S extends `${infer Head}_${infer Tail}` | `${infer Head}-${infer Tail}`\n ? `${Head}${Capitalize<ToCamelCase<Tail>>}`\n : S;\n\nexport type DeepCamelCase<T> = T extends (infer U)[]\n ? DeepCamelCase<U>[]\n : T extends object\n ? { [K in keyof T as ToCamelCase<K & string>]: DeepCamelCase<T[K]> }\n : T;\n\n/**\n * Recursively converts object keys to camelCase. Snake_case and kebab-case\n * are both handled; numeric array indices and primitives pass through\n * unchanged.\n *\n * Language keys used by the CAB schema (`text.content[<lang>]`, etc.) are\n * authored as plain lowercase tags (`en`, `de`, `fr`) by us \u2014 they have no\n * `_` or `-` to convert and survive camelCase as-is.\n */\nexport const deepCamelCase = <T>(input: T): DeepCamelCase<T> => {\n if (Array.isArray(input)) return input.map((item) => deepCamelCase(item)) as DeepCamelCase<T>;\n\n if (isPlainObject(input)) {\n const out: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(input)) {\n out[camelCase(key)] = deepCamelCase(value);\n }\n\n return out as DeepCamelCase<T>;\n }\n\n return input as DeepCamelCase<T>;\n};\n", "import { type TextColorName, type TextSizeName } from '~/schema/widgets/checkout-and-beyond/common';\nimport { type Mark } from '~/transforms/htmlToTiptap/types';\n\nexport const buildDefaultTextStyleMark = (\n style: { color?: TextColorName; fontSize?: TextSizeName } | undefined\n): Mark | null => {\n if (!style || (style.color === undefined && style.fontSize === undefined)) return null;\n\n return {\n attrs: {\n color: style.color ?? 'base',\n fontSize: style.fontSize ?? 'base',\n },\n type: 'textStyle',\n };\n};\n", "import { type StackEntry } from '~/transforms/htmlToTiptap/types';\n\nexport const closeTag = (stack: StackEntry[], name: string): void => {\n for (let index = stack.length - 1; index >= 0; index--) {\n if (stack[index].tag === name) {\n stack.length = index;\n break;\n }\n }\n};\n", "export const TAG_RE = /<(\\/)?([a-zA-Z][a-zA-Z0-9]*)((?:\\s+[^>]*?)?)\\s*(\\/)?>/g;\n\n/**\n * Tags that introduce a paragraph break on both open and close. Container tags\n * like `ul`/`ol`/`dl` are intentionally NOT here \u2014 their child `li`/`dt`/`dd`\n * elements already break, and including the containers would double-flush.\n */\nexport const BLOCK_TAGS = new Set([\n 'article',\n 'aside',\n 'blockquote',\n 'dd',\n 'div',\n 'dt',\n 'figcaption',\n 'figure',\n 'footer',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hr',\n 'li',\n 'main',\n 'nav',\n 'p',\n 'pre',\n 'section',\n]);\n", "import { TiptapParagraph, type TiptapText } from '~/schema/widgets/checkout-and-beyond/text';\n\nexport const makeParagraph = (content: TiptapText[]): TiptapParagraph => TiptapParagraph.parse({ content });\n", "import { makeParagraph } from '~/transforms/htmlToTiptap/makeParagraph';\nimport { type State } from '~/transforms/htmlToTiptap/types';\n\nexport const flushParagraph = (state: State): void => {\n state.paragraphs.push(makeParagraph(state.currentRuns));\n state.currentRuns = [];\n};\n", "import { type StackEntry } from '~/transforms/htmlToTiptap/types';\n\nexport const isSkipping = (stack: StackEntry[] = []): boolean => stack.some(({ skip }) => skip);\n", "import { type Spacing } from '~/schema/widgets/checkout-and-beyond/common';\nimport { TiptapDocument, type TiptapParagraph } from '~/schema/widgets/checkout-and-beyond/text';\n\nexport const makeDoc = (content: TiptapParagraph[], blockSpacing: Spacing): TiptapDocument =>\n TiptapDocument.parse({ attrs: { blockSpacing }, content });\n", "const DYNAMIC_TOKEN_REGEX = /^\\{\\{\\s*[A-Za-z]+\\s*\\}\\}$/;\n\n/**\n * Protocols we'll preserve on `<a href>` when converting HTML to Tiptap. Any URL\n * whose `URL.protocol` falls outside this set (e.g. `javascript:`, `data:`,\n * `file:`, `vbscript:`) is dropped from the link mark \u2014 the text content is\n * kept but the click target is not. Renderers downstream still get to do their\n * own validation, but the package shouldn't be the one preserving an XSS\n * payload through the conversion.\n */\nconst ALLOWED_PROTOCOLS = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\n/**\n * Decides whether an `<a href>` value should survive HTML \u2192 Tiptap conversion\n * as a link mark. Allows `#`, dynamic `{{token}}` placeholders, root-relative\n * same-origin paths (e.g. Shopify's `/policies/privacy-policy`), and a fixed\n * allowlist of URL schemes; everything else (including `javascript:`, `data:`,\n * protocol-relative `//host` paths, other relative paths, and malformed URLs)\n * drops the link mark while keeping the surrounding text.\n *\n * @param href - Raw `href` attribute from the source HTML.\n *\n * @returns `true` if the URL should be preserved as a link mark.\n */\nexport const isValidHref = (href: string): boolean => {\n if (!href) return false;\n\n if (href === '#') return true;\n\n if (DYNAMIC_TOKEN_REGEX.test(href)) return true;\n\n /** Root-relative same-origin path (single leading slash); `//host` is protocol-relative, not same-origin. */\n if (href.startsWith('/') && !href.startsWith('//')) return true;\n\n try {\n const url = new URL(href);\n\n return ALLOWED_PROTOCOLS.has(url.protocol);\n } catch {\n return false;\n }\n};\n", "import { isValidHref } from '~/transforms/htmlToTiptap/isValidHref';\nimport { type Mark } from '~/transforms/htmlToTiptap/types';\n\n/**\n * The schema defaults for an `<a>` mark when the source HTML omits them. Match\n * `TiptapText` in `~/schema/widgets/checkout-and-beyond/text` so the sanitizer\n * resolves the same effective values the downstream parse would have used.\n */\nconst DEFAULT_TARGET = '_blank';\nconst DEFAULT_REL = 'noopener noreferrer nofollow';\n\n/**\n * Forces `noopener noreferrer` on every `_blank` link to defend against\n * reverse-tabnabbing (window.opener attacks). When the source omits `rel`\n * entirely, fall back to the schema default (`noopener noreferrer nofollow`).\n * When source `rel` is non-empty, preserve the existing tokens, drop `opener`,\n * and ensure the safe pair is present.\n *\n * Non-`_blank` targets pass through unchanged \u2014 they can't be tabnabbed.\n */\nconst ensureSafeRel = (rel: string, target: string): string => {\n if (target !== '_blank') return rel;\n\n const sourceTokens = (rel ?? '').split(/\\s+/).filter(Boolean);\n\n if (sourceTokens.length === 0) return DEFAULT_REL;\n\n const tokens = new Set(sourceTokens.filter((token) => token.toLowerCase() !== 'opener'));\n\n tokens.add('noopener');\n tokens.add('noreferrer');\n\n return Array.from(tokens).join(' ');\n};\n\nexport const buildLinkMark = (attrs: Record<string, string> = {}): Mark | null => {\n const { href } = attrs;\n\n if (!href || !isValidHref(href)) return null;\n\n // Resolve target BEFORE sanitizing rel so the safety guard sees the same\n // value the downstream schema parse will use.\n const target = attrs.target ?? DEFAULT_TARGET;\n\n return {\n attrs: {\n class: null,\n href,\n rel: ensureSafeRel(attrs.rel, target),\n target,\n },\n type: 'link',\n };\n};\n", "const NAMED_ENTITIES: Record<string, string> = {\n amp: '&',\n apos: \"'\",\n copy: '\u00A9',\n gt: '>',\n hellip: '\u2026',\n ldquo: '\u201C',\n lsquo: '\u2018',\n lt: '<',\n mdash: '\u2014',\n nbsp: ' ',\n ndash: '\u2013',\n quot: '\"',\n rdquo: '\u201D',\n reg: '\u00AE',\n rsquo: '\u2019',\n trade: '\u2122',\n} as const;\n\nexport const decodeEntities = (input: string = ''): string =>\n input.replace(/&(#x[\\da-f]+|#\\d+|[a-z][a-z\\d]*);/gi, (match, code: string) => {\n if (code[0] !== '#') return NAMED_ENTITIES[code.toLowerCase()] ?? match;\n\n const isHex = /^#x/i.test(code);\n const cp = parseInt(code.slice(isHex ? 2 : 1), isHex ? 16 : 10);\n\n return Number.isInteger(cp) && cp >= 0 && cp <= 0x10ffff ? String.fromCodePoint(cp) : match;\n });\n", "import { decodeEntities } from '~/transforms/htmlToTiptap/decodeEntities';\n\nconst ATTRIB_RE = /([a-zA-Z_:][\\w:.-]*)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'`=<>]+)))?/g;\n\nexport const parseAttribs = (attrString: string): Record<string, string> => {\n const result: Record<string, string> = {};\n let match: RegExpExecArray | null;\n\n ATTRIB_RE.lastIndex = 0;\n\n while ((match = ATTRIB_RE.exec(attrString)) !== null) {\n result[match[1].toLowerCase()] = decodeEntities(match[2] ?? match[3] ?? match[4] ?? '');\n }\n\n return result;\n};\n", "import { type TextSizeName } from '~/schema/widgets/checkout-and-beyond/common';\nimport { buildLinkMark } from '~/transforms/htmlToTiptap/buildLinkMark';\nimport { parseAttribs } from '~/transforms/htmlToTiptap/parseAttribs';\nimport { type Mark, type StackEntry } from '~/transforms/htmlToTiptap/types';\n\nconst INLINE_MARK_TAGS: Record<string, 'bold' | 'italic' | 'strike'> = {\n b: 'bold',\n del: 'strike',\n em: 'italic',\n i: 'italic',\n s: 'strike',\n strike: 'strike',\n strong: 'bold',\n};\n\nconst HEADING_FONT_SIZE: Record<string, TextSizeName> = {\n h1: 'extraLarge',\n h2: 'large',\n h3: 'medium',\n h4: 'base',\n h5: 'small',\n h6: 'small',\n};\n\nconst STRIPPED_TAGS = ['embed', 'iframe', 'noscript', 'object', 'script', 'style', 'template'];\n\nconst marksForTag = (name: string, attrs: string): Mark[] => {\n if (INLINE_MARK_TAGS[name]) return [{ type: INLINE_MARK_TAGS[name] }];\n\n if (HEADING_FONT_SIZE[name]) {\n return [{ type: 'bold' }, { attrs: { color: 'base', fontSize: HEADING_FONT_SIZE[name] }, type: 'textStyle' }];\n }\n\n if (name === 'a') {\n const link = buildLinkMark(parseAttribs(attrs));\n\n return link ? [link] : [];\n }\n\n return [];\n};\n\nexport const openTag = (stack: StackEntry[], name: string, attrs: string): void => {\n stack.push({\n marks: marksForTag(name, attrs),\n skip: STRIPPED_TAGS.includes(name),\n tag: name,\n });\n};\n", "import { TiptapText } from '~/schema/widgets/checkout-and-beyond/text';\n\nimport { decodeEntities } from '~/transforms/htmlToTiptap/decodeEntities';\nimport { flushParagraph } from '~/transforms/htmlToTiptap/flushParagraph';\nimport { isSkipping } from '~/transforms/htmlToTiptap/isSkipping';\nimport { type Mark, type State } from '~/transforms/htmlToTiptap/types';\n\nexport const pushText = (state: State, rawText: string): void => {\n if (!rawText || isSkipping(state.stack)) return;\n\n decodeEntities(rawText)\n .split('\\n')\n .forEach((segment, index) => {\n if (index > 0) flushParagraph(state);\n\n if (!segment) return;\n\n const marks: Mark[] = state.stack.flatMap((entry) => entry.marks);\n\n if (state.defaultTextStyleMark && !marks.some((mark) => mark.type === 'textStyle')) {\n marks.push(state.defaultTextStyleMark);\n }\n\n state.currentRuns.push(TiptapText.parse(marks.length > 0 ? { marks, text: segment } : { text: segment }));\n });\n};\n", "const HTML_COMMENT_RE = /<!--[\\s\\S]*?-->/g;\n\nexport const stripHtmlComments = (html: string = ''): string => html.replace(HTML_COMMENT_RE, '');\n", "import { type Spacing, type TextColorName, type TextSizeName } from '~/schema/widgets/checkout-and-beyond/common';\nimport { type TiptapDocument } from '~/schema/widgets/checkout-and-beyond/text';\nimport { buildDefaultTextStyleMark } from '~/transforms/htmlToTiptap/buildDefaultTextStyleMark';\nimport { closeTag } from '~/transforms/htmlToTiptap/closeTag';\nimport { BLOCK_TAGS, TAG_RE } from '~/transforms/htmlToTiptap/constants';\nimport { flushParagraph } from '~/transforms/htmlToTiptap/flushParagraph';\nimport { isSkipping } from '~/transforms/htmlToTiptap/isSkipping';\nimport { makeDoc } from '~/transforms/htmlToTiptap/makeDoc';\nimport { makeParagraph } from '~/transforms/htmlToTiptap/makeParagraph';\nimport { openTag } from '~/transforms/htmlToTiptap/openTag';\nimport { pushText } from '~/transforms/htmlToTiptap/pushText';\nimport { stripHtmlComments } from '~/transforms/htmlToTiptap/stripHtmlComments';\nimport { type State } from '~/transforms/htmlToTiptap/types';\n\nexport type HtmlToTiptapOptions = {\n blockSpacing?: Spacing;\n defaultTextStyle?: { color?: TextColorName; fontSize?: TextSizeName };\n};\n\nconst maybeFlushParagraph = (state: State): void => {\n if (state.currentRuns.length > 0) flushParagraph(state);\n};\n\nexport const htmlToTiptap = (html: string, options: HtmlToTiptapOptions = {}): TiptapDocument => {\n const state: State = {\n currentRuns: [],\n defaultTextStyleMark: buildDefaultTextStyleMark(options.defaultTextStyle),\n listStack: [],\n paragraphs: [],\n stack: [],\n };\n const blockSpacing = options.blockSpacing ?? 'base';\n\n if (typeof html !== 'string' || !html) return makeDoc([makeParagraph([])], blockSpacing);\n\n const htmlWithoutComments = stripHtmlComments(html);\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n TAG_RE.lastIndex = 0;\n\n while ((match = TAG_RE.exec(htmlWithoutComments)) !== null) {\n const [full, slash, rawName, attrs, selfClose] = match;\n\n if (match.index > lastIndex) pushText(state, htmlWithoutComments.slice(lastIndex, match.index));\n\n lastIndex = match.index + full.length;\n\n const name = rawName.toLowerCase();\n\n if (slash) {\n closeTag(state.stack, name);\n\n if (name === 'ul' || name === 'ol') state.listStack.pop();\n\n if (BLOCK_TAGS.has(name) && !isSkipping(state.stack)) maybeFlushParagraph(state);\n } else if (name === 'br') {\n if (!isSkipping(state.stack)) flushParagraph(state);\n } else if (name === 'hr') {\n if (!isSkipping(state.stack)) {\n maybeFlushParagraph(state);\n pushText(state, '\u2014\u2014\u2014');\n flushParagraph(state);\n }\n } else if (!selfClose) {\n if (BLOCK_TAGS.has(name) && !isSkipping(state.stack)) maybeFlushParagraph(state);\n\n if (name === 'ul' || name === 'ol') state.listStack.push({ counter: 0, ordered: name === 'ol' });\n\n openTag(state.stack, name, attrs);\n\n if (name === 'li' && state.listStack.length > 0) {\n const top = state.listStack[state.listStack.length - 1]!;\n\n if (top.ordered) top.counter += 1;\n\n pushText(state, top.ordered ? `${top.counter}. ` : '\u2022 ');\n }\n }\n }\n\n if (lastIndex < htmlWithoutComments.length) pushText(state, htmlWithoutComments.slice(lastIndex));\n\n maybeFlushParagraph(state);\n\n if (state.paragraphs.length === 0) flushParagraph(state);\n\n return makeDoc(state.paragraphs, blockSpacing);\n};\n", "/**\n * True when the input has `version === 2` \u2014 the marker for a current-generation\n * Checkout-and-Beyond root section. The transformer for CAB (`CABRootSection.parse`)\n * should ONLY run on values that pass this check; v1 widget shapes either get\n * converted (e.g. via `convertContentBlockToV2`) or pass through unchanged.\n *\n * @param input - The post-camelCase, post-numeric-fix upstream payload.\n *\n * @returns `true` if `input.version === 2`, otherwise `false`.\n */\nexport const isCABRootSection = (input: unknown): boolean => {\n if (!input || typeof input !== 'object') return false;\n\n return (input as { version?: unknown }).version === 2;\n};\n", "/**\n * Default localized labels for the switch-to-subscription button content, keyed by `buttonField` then locale.\n * The single source of truth shared by the admin editor and the read-time `convertLineItemEditorToV2` transform\n * so a widget renders identically whether migrated in admin or converted on the fly. `{{subscriptionDiscount}}`\n * is substituted per-plan at render \u2014 CAB tokens are camelCase by default; a legacy snake_case token in a v1\n * merchant override still resolves (the client camelCases unknown token keys against its camelCase variables).\n * `subscriptionOption` is the frequency-select option template (legacy\n * `SwitchToSubscriptionLanguageDefaults.subscription_option_label`); the client resolves `{{interval}}`\n * through `Intl.NumberFormat` unit style, so the noun arrives in the buyer's language, pluralized per count\n * from the runtime's CLDR data (English CLDR nouns are lowercase \u2014 an accepted divergence from legacy).\n */\nexport const SWITCH_LABELS = {\n subscriptionOption: {\n ar: '\u064A\u062A\u0645 \u0627\u0644\u062A\u0648\u0635\u064A\u0644 \u0643\u0644 {{frequency}} {{interval}}',\n cs: 'Doru\u010Den\u00ED ka\u017Ed\u00FDch {{frequency}} {{interval}}',\n da: 'Leveres hver {{frequency}} {{interval}}',\n de: 'Lieferung alle {{frequency}} {{interval}}',\n en: 'Delivers every {{frequency}} {{interval}}',\n es: 'Entrega cada {{frequency}} {{interval}}',\n fi: 'Toimitus {{frequency}} {{interval}} v\u00E4lein',\n fr: 'Livraison tous les {{frequency}} {{interval}}',\n ga: 'Seachadtar gach {{frequency}} {{interval}}',\n he: '\u05DE\u05E9\u05DC\u05D5\u05D7 \u05DB\u05DC {{frequency}} {{interval}}',\n hi: '\u0939\u0930 {{frequency}} {{interval}} \u092E\u0947\u0902 \u0921\u093F\u0932\u0940\u0935\u0930\u0940',\n id: 'Dikirim setiap {{frequency}} {{interval}}',\n it: 'Consegna ogni {{frequency}} {{interval}}',\n ja: '{{frequency}} {{interval}}\u3054\u3068\u306B\u304A\u5C4A\u3051',\n ko: '{{frequency}} {{interval}}\uB9C8\uB2E4 \uBC30\uC1A1',\n nl: 'Wordt elke {{frequency}} {{interval}} geleverd',\n no: 'Leveres hver {{frequency}} {{interval}}',\n pl: 'Dostawa co {{frequency}} {{interval}}',\n pt: 'Entrega a cada {{frequency}} {{interval}}',\n ru: '\u0414\u043E\u0441\u0442\u0430\u0432\u043A\u0430 \u043A\u0430\u0436\u0434\u044B\u0435 {{frequency}} {{interval}}',\n sv: 'Levereras var {{frequency}} {{interval}}',\n th: '\u0E08\u0E31\u0E14\u0E2A\u0E48\u0E07\u0E17\u0E38\u0E01 {{frequency}} {{interval}}',\n tr: 'Her {{frequency}} {{interval}} aral\u0131\u011F\u0131nda teslimat',\n uk: '\u0414\u043E\u0441\u0442\u0430\u0432\u043A\u0430 \u043A\u043E\u0436\u043D\u0456 {{frequency}} {{interval}}',\n vi: 'Giao h\u00E0ng m\u1ED7i {{frequency}} {{interval}}',\n zh: '\u6BCF {{frequency}} {{interval}} \u914D\u9001\u4E00\u6B21',\n },\n switchToOneTimePurchase: {\n ar: '\u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0625\u0644\u0649 \u0634\u0631\u0627\u0621 \u0644\u0645\u0631\u0629 \u0648\u0627\u062D\u062F\u0629',\n cs: 'P\u0159epnout na jednor\u00E1zov\u00FD n\u00E1kup',\n da: 'Skift til engangsk\u00F8b',\n de: 'Zu einmaligem Kauf wechseln',\n en: 'Switch to One-time Purchase',\n es: 'Cambiar a compra \u00FAnica',\n fi: 'Vaihda kertaluonteiseen ostoon',\n fr: 'Passer \u00E0 un achat unique',\n ga: 'Athraigh go ceannach aonuaire',\n he: '\u05E2\u05D1\u05D5\u05E8 \u05DC\u05E8\u05DB\u05D9\u05E9\u05D4 \u05D7\u05D3-\u05E4\u05E2\u05DE\u05D9\u05EA',\n hi: '\u090F\u0915 \u092C\u093E\u0930 \u0915\u0940 \u0916\u0930\u0940\u0926 \u092A\u0930 \u0938\u094D\u0935\u093F\u091A \u0915\u0930\u0947\u0902',\n id: 'Beralih ke pembelian satu kali',\n it: 'Passa all\u2019acquisto una tantum',\n ja: '1\u56DE\u9650\u308A\u306E\u8CFC\u5165\u306B\u5207\u308A\u66FF\u3048\u308B',\n ko: '\uC77C\uD68C\uC131 \uAD6C\uB9E4\uB85C \uC804\uD658',\n nl: 'Overschakelen naar eenmalige aankoop',\n no: 'Bytt til engangskj\u00F8p',\n pl: 'Prze\u0142\u0105cz na jednorazowy zakup',\n pt: 'Mudar para compra \u00FAnica',\n ru: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u0440\u0430\u0437\u043E\u0432\u0443\u044E \u043F\u043E\u043A\u0443\u043F\u043A\u0443',\n sv: 'Byt till eng\u00E5ngsk\u00F6p',\n th: '\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E40\u0E1B\u0E47\u0E19\u0E01\u0E32\u0E23\u0E0B\u0E37\u0E49\u0E2D\u0E04\u0E23\u0E31\u0E49\u0E07\u0E40\u0E14\u0E35\u0E22\u0E27',\n tr: 'Tek seferlik sat\u0131n almaya ge\u00E7',\n uk: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u0438\u0441\u044F \u043D\u0430 \u043E\u0434\u043D\u043E\u0440\u0430\u0437\u043E\u0432\u0443 \u043F\u043E\u043A\u0443\u043F\u043A\u0443',\n vi: 'Chuy\u1EC3n sang mua m\u1ED9t l\u1EA7n',\n zh: '\u5207\u6362\u4E3A\u4E00\u6B21\u6027\u8D2D\u4E70',\n },\n switchToSubscriptionNoDiscount: {\n ar: '\u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0625\u0644\u0649 \u0627\u0634\u062A\u0631\u0627\u0643',\n cs: 'P\u0159epnout na p\u0159edplatn\u00E9',\n da: 'Skift til abonnement',\n de: 'Zu einem Abonnement wechseln',\n en: 'Switch to Subscription',\n es: 'Cambiar a suscripci\u00F3n',\n fi: 'Vaihda tilaukseen',\n fr: 'Passer \u00E0 un abonnement',\n ga: 'Athraigh go s\u00EDnti\u00FAs',\n he: '\u05E2\u05D1\u05D5\u05E8 \u05DC\u05DE\u05E0\u05D5\u05D9',\n hi: '\u0938\u0926\u0938\u094D\u092F\u0924\u093E \u092A\u0930 \u0938\u094D\u0935\u093F\u091A \u0915\u0930\u0947\u0902',\n id: 'Beralih ke langganan',\n it: 'Passa all\u2019abbonamento',\n ja: '\u5B9A\u671F\u8CFC\u5165\u306B\u5207\u308A\u66FF\u3048\u308B',\n ko: '\uAD6C\uB3C5\uC73C\uB85C \uC804\uD658',\n nl: 'Overschakelen naar abonnement',\n no: 'Bytt til abonnement',\n pl: 'Prze\u0142\u0105cz na subskrypcj\u0119',\n pt: 'Mudar para assinatura',\n ru: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0443',\n sv: 'Byt till prenumeration',\n th: '\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E40\u0E1B\u0E47\u0E19\u0E01\u0E32\u0E23\u0E2A\u0E21\u0E31\u0E04\u0E23\u0E2A\u0E21\u0E32\u0E0A\u0E34\u0E01',\n tr: 'Aboneli\u011Fe ge\u00E7',\n uk: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u0438\u0441\u044F \u043D\u0430 \u043F\u0456\u0434\u043F\u0438\u0441\u043A\u0443',\n vi: 'Chuy\u1EC3n sang \u0111\u0103ng k\u00FD',\n zh: '\u5207\u6362\u4E3A\u8BA2\u9605',\n },\n switchToSubscriptionWithDiscount: {\n ar: '\u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0625\u0644\u0649 \u0627\u0634\u062A\u0631\u0627\u0643 \u0648\u062A\u0648\u0641\u064A\u0631 {{subscriptionDiscount}}%',\n cs: 'P\u0159epnout na p\u0159edplatn\u00E9 a u\u0161et\u0159it {{subscriptionDiscount}} %',\n da: 'Skift til abonnement og spar {{subscriptionDiscount}}%',\n de: 'Zu einem Abonnement wechseln und {{subscriptionDiscount}} % sparen',\n en: 'Switch to Subscription & Save {{subscriptionDiscount}}%',\n es: 'Cambiar a suscripci\u00F3n y ahorrar {{subscriptionDiscount}}%',\n fi: 'Vaihda tilaukseen ja s\u00E4\u00E4st\u00E4 {{subscriptionDiscount}} %',\n fr: 'Passer \u00E0 un abonnement et \u00E9conomiser {{subscriptionDiscount}} %',\n ga: 'Athraigh go s\u00EDnti\u00FAs agus s\u00E1bh\u00E1il {{subscriptionDiscount}}%',\n he: '\u05E2\u05D1\u05D5\u05E8 \u05DC\u05DE\u05E0\u05D5\u05D9 \u05D5\u05D7\u05E1\u05D5\u05DA {{subscriptionDiscount}}%',\n hi: '\u0938\u0926\u0938\u094D\u092F\u0924\u093E \u092A\u0930 \u0938\u094D\u0935\u093F\u091A \u0915\u0930\u0947\u0902 \u0914\u0930 {{subscriptionDiscount}}% \u092C\u091A\u093E\u090F\u0902',\n id: 'Beralih ke langganan dan hemat {{subscriptionDiscount}}%',\n it: 'Passa all\u2019abbonamento e risparmia {{subscriptionDiscount}}%',\n ja: '\u5B9A\u671F\u8CFC\u5165\u306B\u5207\u308A\u66FF\u3048\u3066{{subscriptionDiscount}}%\u304A\u5F97',\n ko: '\uAD6C\uB3C5\uC73C\uB85C \uC804\uD658\uD558\uACE0 {{subscriptionDiscount}}% \uC808\uC57D',\n nl: 'Overschakelen naar abonnement en {{subscriptionDiscount}}% besparen',\n no: 'Bytt til abonnement og spar {{subscriptionDiscount}}%',\n pl: 'Prze\u0142\u0105cz na subskrypcj\u0119 i oszcz\u0119d\u017A {{subscriptionDiscount}}%',\n pt: 'Mudar para assinatura e economizar {{subscriptionDiscount}}%',\n ru: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0443 \u0438 \u0441\u044D\u043A\u043E\u043D\u043E\u043C\u0438\u0442\u044C {{subscriptionDiscount}}%',\n sv: 'Byt till prenumeration och spara {{subscriptionDiscount}}%',\n th: '\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E40\u0E1B\u0E47\u0E19\u0E01\u0E32\u0E23\u0E2A\u0E21\u0E31\u0E04\u0E23\u0E2A\u0E21\u0E32\u0E0A\u0E34\u0E01\u0E41\u0E25\u0E30\u0E1B\u0E23\u0E30\u0E2B\u0E22\u0E31\u0E14 {{subscriptionDiscount}}%',\n tr: 'Aboneli\u011Fe ge\u00E7 ve {{subscriptionDiscount}}% tasarruf et',\n uk: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u0438\u0441\u044F \u043D\u0430 \u043F\u0456\u0434\u043F\u0438\u0441\u043A\u0443 \u0442\u0430 \u0437\u0430\u043E\u0449\u0430\u0434\u0438\u0442\u0438 {{subscriptionDiscount}}%',\n vi: 'Chuy\u1EC3n sang \u0111\u0103ng k\u00FD v\u00E0 ti\u1EBFt ki\u1EC7m {{subscriptionDiscount}}%',\n zh: '\u5207\u6362\u4E3A\u8BA2\u9605\u5E76\u8282\u7701 {{subscriptionDiscount}}%',\n },\n} as const satisfies Record<string, Record<string, string>>;\n", "import { stripContentBlockHtml } from '~/transforms/contentBlockV1/stripContentBlockHtml';\n\n/**\n * The v1 label-override policy shared by the offer-card and line-item-editor converters: a defined v1\n * label ALWAYS passes through verbatim as the `en` entry over the localized defaults \u2014 existing widget\n * language is never rewritten (product owner, 2026-07-02); blank/whitespace falls back to the full\n * default locale set (legacy `getLabelWithFallback` parity). HTML the merchant typed into a label is\n * stripped first \u2014 `CABTextSection.content` rejects tag-shaped strings at parse, so a raw `<b>`-style\n * label would otherwise 500 the whole widget.\n */\nexport const localizedContent = (defaults: Record<string, string>, override: string | undefined) => {\n const trimmed = stripContentBlockHtml(override ?? '').trim();\n\n return trimmed ? { ...defaults, en: trimmed } : defaults;\n};\n", "import { WidgetType } from '~/schema/widgets/checkout-and-beyond/constants';\nimport { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { SWITCH_LABELS } from '~/schema/widgets/checkout-and-beyond/switchLabels';\nimport { type LineItemEditorSwitchLanguageV1 } from '~/schema/widgets/lineItemEditor';\nimport { type V1LineItemEditorConvertInput } from '~/transforms/lineItemEditorV1/types';\nimport { localizedContent } from '~/transforms/localizedContent';\n\n/** The v1 `switchToSubscription.language` key that overrides each `buttonField`'s English label. */\nconst OVERRIDE_KEY = {\n subscriptionOption: 'subscriptionOptionLabel',\n switchToOneTimePurchase: 'downgradeToOneTimeLabel',\n switchToSubscriptionNoDiscount: 'upgradeToSubscriptionWithoutDiscountLabel',\n switchToSubscriptionWithDiscount: 'upgradeToSubscriptionLabel',\n} as const satisfies Record<keyof typeof SWITCH_LABELS, keyof LineItemEditorSwitchLanguageV1>;\n\n/**\n * Translate a v1 line-item-editor widget into a `CABRootSection`: a `cartLine` section holding a\n * switch-to-subscription button, whose `buttonField`-tagged text labels use the shared localized\n * `SWITCH_LABELS` defaults with the v1 `switchToSubscription.language` value overriding `en` (same output the\n * admin editor produces, so runtime-converted and admin-migrated widgets render identically). The button is\n * omitted when the widget's switch is disabled.\n */\nconst BUTTON_KINDS = ['plain', 'primary', 'secondary'] as const;\n\nexport const convertLineItemEditorToV2 = ({ id, settings }: V1LineItemEditorConvertInput): CABRootSection => {\n const { switchToSubscription, switchToSubscriptionEnabled, tracking } = settings;\n const kind = settings.button?.kind;\n const buttonStyle = BUTTON_KINDS.includes(kind as (typeof BUTTON_KINDS)[number]) ? kind : 'plain';\n\n const labelSections = (Object.keys(SWITCH_LABELS) as (keyof typeof SWITCH_LABELS)[]).map((buttonField) => ({\n buttonField,\n content: localizedContent(\n SWITCH_LABELS[buttonField],\n switchToSubscription?.language?.[OVERRIDE_KEY[buttonField]]\n ),\n sectionType: 'text',\n }));\n\n return CABRootSection.parse({\n previewMode: settings.previewMode,\n sections: [\n {\n sections: switchToSubscriptionEnabled\n ? [\n {\n action: 'switchToSubscription',\n buttonStyle,\n disableDowngrade: switchToSubscription?.disableDowngrade ?? false,\n sections: labelSections,\n sectionType: 'button',\n },\n ]\n : [],\n sectionType: 'cartLine',\n },\n ],\n sectionType: 'layout',\n tracking: {\n enableAttribution: tracking?.enableAttribution ?? true,\n enableSource: tracking?.enableSource ?? true,\n enableWidget: tracking?.enableWidget ?? true,\n },\n type: WidgetType.ui_extension_line_item_editor,\n version: 2,\n widgetId: id,\n });\n};\n", "import { WidgetType } from '~/schema/widgets/checkout-and-beyond/constants';\nimport { type LineItemEditorV1 } from '~/schema/widgets/lineItemEditor';\n\n/**\n * The legacy `/widgets/settings` endpoint returns the widget's settings object directly (no envelope), so\n * the converter input is just `{ id, settings }` \u2014 the settings shape lives in the schema\n * (`LineItemEditorV1`) and is derived here, never re-declared.\n */\nexport type V1LineItemEditorConvertInput = {\n id: number;\n settings: LineItemEditorV1;\n};\n\n/** Identifies a v1 line-item-editor payload by version + type (mirrors `isContentBlockV1`). */\nexport const isLineItemEditorV1 = (data: unknown): data is LineItemEditorV1 => {\n if (!data || typeof data !== 'object') return false;\n\n const obj = data as Record<string, unknown>;\n\n return obj.version === 1 && obj.type === WidgetType.ui_extension_line_item_editor;\n};\n", "const DEFAULT_KNOWN_TOKENS = ['firstName', 'lastName', 'email'] as const;\n\nconst escapeForRegex = (literal: string): string => literal.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n/**\n * Rewrites legacy personalization tokens into the CAB-canonical `{{tokenName}}`\n * form expected by the client's `replaceVariables`. Specifically:\n *\n * - `{firstName}` (single brace) \u2192 `{{firstName}}`\n * - `{FirstName}` / `{FIRSTNAME}` (case variants) \u2192 `{{firstName}}`\n * - `{ firstName }` (internal whitespace) \u2192 `{{firstName}}`\n * - `{{firstName}}` (already canonical) \u2192 unchanged\n *\n * Pass `knownTokens` to control which names are normalized; anything not in the\n * list (e.g., an unrelated `{{foo}}` token) passes through untouched.\n */\nexport const normalizeTokens = (text: string, knownTokens: readonly string[] = DEFAULT_KNOWN_TOKENS): string => {\n if (typeof text !== 'string') return text;\n\n return knownTokens.reduce((acc, token) => {\n /**\n * Tokens standardize on camelCase; `_?` before each capital also matches the legacy snake_case\n * spelling ({remaining_amount} \u2192 {{remainingAmount}}).\n */\n const snakeTolerant = escapeForRegex(token).replace(/([A-Z])/g, '_?$1');\n const pattern = new RegExp(`\\\\{{1,2}\\\\s*${snakeTolerant}\\\\s*\\\\}{1,2}`, 'gi');\n\n return acc.replace(pattern, `{{${token}}}`);\n }, text);\n};\n", "import { htmlToTiptap } from '~/transforms/htmlToTiptap/htmlToTiptap';\nimport { normalizeTokens } from '~/transforms/normalizeTokens';\n\nconst HTML_TAG_RE = /<[a-zA-Z]/;\n\nconst containsHtml = (text: string): boolean => HTML_TAG_RE.test(text);\n\nconst isObject = (x: unknown): x is Record<string, unknown> => x !== null && typeof x === 'object' && !Array.isArray(x);\n\nconst normalizeLangValue = (value: unknown): unknown => {\n if (typeof value !== 'string') return value;\n\n const tokenized = normalizeTokens(value);\n\n return containsHtml(tokenized) ? htmlToTiptap(tokenized) : tokenized;\n};\n\n/**\n * Walks an untyped CABRootSection-shaped object (post deepCamelCase, pre schema\n * parse) and rewrites `text` sections' `content[lang]` strings so that:\n *\n * - `{firstName}` (single brace) becomes `{{firstName}}` (canonical), and\n * - HTML-laden strings become a fully-formed `TiptapDocument`.\n *\n * Plain strings pass through unchanged. Non-text sections only recurse into\n * their `sections` array; Tiptap docs and other nested objects are not walked.\n */\nexport const normalizeTextContent = (node: unknown): unknown => {\n if (Array.isArray(node)) return node.map(normalizeTextContent);\n\n if (!isObject(node)) return node;\n\n if (node.sectionType === 'text' && isObject(node.content)) {\n const nextContent: Record<string, unknown> = {};\n\n for (const [lang, value] of Object.entries(node.content)) {\n nextContent[lang] = normalizeLangValue(value);\n }\n\n return { ...node, content: nextContent };\n }\n\n if (Array.isArray(node.sections)) {\n return { ...node, sections: node.sections.map(normalizeTextContent) };\n }\n\n return node;\n};\n", "import { type CabShopConfig } from '~/schema/cabShopConfig';\n\nexport type ActiveExperiment = CabShopConfig['activeExperiments'][number];\n\n/** What the client needs to render the chosen variant and emit the A/B analytics. */\nexport type ResolvedExperiment = {\n /** The widget whose settings actually render \u2014 the chosen variant (not the placeholder). */\n elementId: number;\n experimentId: number;\n /** The experiment's raw engine type (e.g. `CheckoutOffer`); the analytics layer snake-cases it. */\n experimentType: string;\n /** The variant's experiment-element id \u2014 `abTestViewed`'s `defined_noun_id` half. */\n selectedId: number;\n};\n\n/**\n * Deterministic [0, 100) bucket from a seed string (FNV-1a \u2192 two-decimal percent). Replaces React's\n * `Math.random() * 100`: hashing `visitorId:experimentId` keeps a visitor in the SAME variant across\n * requests WITHOUT a client-stored selection \u2014 the server can't read the client's storage, so\n * stickiness has to come from a stable input it is handed (the visitor id).\n */\nconst rollPercent = (seed: string): number => {\n let hash = 0x811c9dc5;\n\n for (let index = 0; index < seed.length; index++) {\n hash ^= seed.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n\n return ((hash >>> 0) % 10000) / 100;\n};\n\n/**\n * Picks the A/B variant for the placeholder widget `placeholderId`, or `undefined` when no experiment\n * targets it (the common case \u2014 render the placeholder itself). Walks the variants by cumulative\n * `traffic` weight against a visitor-stable roll, mirroring React's `useABTesting` selection but\n * server-side and deterministic. Falls back to the first variant when the weights under-cover the roll.\n */\nexport const resolveExperiment = (\n experiments: ActiveExperiment[],\n placeholderId: number,\n visitorId: string\n): ResolvedExperiment | undefined => {\n const experiment = experiments.find((candidate) => candidate.placeholderId === placeholderId);\n\n if (!experiment || experiment.data.length === 0) return undefined;\n\n const roll = rollPercent(`${visitorId}:${experiment.id}`);\n let cumulative = 0;\n\n const variant =\n experiment.data.find((candidate) => {\n cumulative += candidate.traffic;\n\n // Half-open roll [0, 100) with `<` (not `<=`): a 0-traffic bucket is never entered (so a paused\n // head can't capture the roll-0 visitor), and boundaries split evenly (50/50 \u2192 5000/5000).\n return roll < cumulative;\n }) ?? experiment.data[0];\n\n return {\n elementId: variant.elementId,\n experimentId: experiment.id,\n experimentType: experiment.type,\n selectedId: variant.id,\n };\n};\n", "/**\n * Default localized labels for the offer card's add-to-order button states and the opt-in undo banner,\n * keyed by slot then locale (same 26 locales as `SWITCH_LABELS`). The converter overlays a defined v1\n * merchant value as the `en` entry (verbatim) and falls back to these for blank/absent values, so a\n * migrated widget keeps its copy while new/unset widgets localize. `addedToCartMessage` tokens are\n * camelCase (CAB default); legacy snake_case tokens in merchant overrides still resolve client-side.\n */\nexport const OFFER_LABELS = {\n addedToCart: {\n ar: '\u062A\u0645\u062A \u0627\u0644\u0625\u0636\u0627\u0641\u0629!',\n cs: 'P\u0159id\u00E1no!',\n da: 'Tilf\u00F8jet!',\n de: 'Hinzugef\u00FCgt!',\n en: 'Added!',\n es: '\u00A1A\u00F1adido!',\n fi: 'Lis\u00E4tty!',\n fr: 'Ajout\u00E9 !',\n ga: 'Curtha leis!',\n he: '\u05E0\u05D5\u05E1\u05E3!',\n hi: '\u091C\u094B\u0921\u093C\u093E \u0917\u092F\u093E!',\n id: 'Ditambahkan!',\n it: 'Aggiunto!',\n ja: '\u8FFD\u52A0\u3057\u307E\u3057\u305F\uFF01',\n ko: '\uCD94\uAC00\uB428!',\n nl: 'Toegevoegd!',\n no: 'Lagt til!',\n pl: 'Dodano!',\n pt: 'Adicionado!',\n ru: '\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E!',\n sv: 'Tillagd!',\n th: '\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E41\u0E25\u0E49\u0E27!',\n tr: 'Eklendi!',\n uk: '\u0414\u043E\u0434\u0430\u043D\u043E!',\n vi: '\u0110\u00E3 th\u00EAm!',\n zh: '\u5DF2\u6DFB\u52A0\uFF01',\n },\n addedToCartMessage: {\n ar: '\u062A\u0645\u062A \u0625\u0636\u0627\u0641\u0629 {{quantity}} {{productTitle}} \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629.',\n cs: '{{quantity}} {{productTitle}} p\u0159id\u00E1no do ko\u0161\u00EDku.',\n da: '{{quantity}} {{productTitle}} lagt i kurven.',\n de: '{{quantity}} {{productTitle}} zum Warenkorb hinzugef\u00FCgt.',\n en: '{{quantity}} {{productTitle}} successfully added to cart.',\n es: '{{quantity}} {{productTitle}} a\u00F1adido al carrito.',\n fi: '{{quantity}} {{productTitle}} lis\u00E4tty ostoskoriin.',\n fr: '{{quantity}} {{productTitle}} ajout\u00E9 au panier.',\n ga: 'Cuireadh {{quantity}} {{productTitle}} sa chairt.',\n he: '{{quantity}} {{productTitle}} \u05E0\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4.',\n hi: '{{quantity}} {{productTitle}} \u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u093E \u0917\u092F\u093E\u0964',\n id: '{{quantity}} {{productTitle}} ditambahkan ke keranjang.',\n it: '{{quantity}} {{productTitle}} aggiunto al carrello.',\n ja: '{{quantity}} {{productTitle}}\u3092\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0\u3057\u307E\u3057\u305F\u3002',\n ko: '{{quantity}} {{productTitle}}\uC774(\uAC00) \uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00\uB418\uC5C8\uC2B5\uB2C8\uB2E4.',\n nl: '{{quantity}} {{productTitle}} toegevoegd aan winkelwagen.',\n no: '{{quantity}} {{productTitle}} lagt i handlekurven.',\n pl: '{{quantity}} {{productTitle}} dodano do koszyka.',\n pt: '{{quantity}} {{productTitle}} adicionado ao carrinho.',\n ru: '{{quantity}} {{productTitle}} \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443.',\n sv: '{{quantity}} {{productTitle}} har lagts i varukorgen.',\n th: '\u0E40\u0E1E\u0E34\u0E48\u0E21 {{quantity}} {{productTitle}} \u0E25\u0E07\u0E15\u0E30\u0E01\u0E23\u0E49\u0E32\u0E41\u0E25\u0E49\u0E27',\n tr: '{{quantity}} {{productTitle}} sepete eklendi.',\n uk: '{{quantity}} {{productTitle}} \u0434\u043E\u0434\u0430\u043D\u043E \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430.',\n vi: '\u0110\u00E3 th\u00EAm {{quantity}} {{productTitle}} v\u00E0o gi\u1ECF h\u00E0ng.',\n zh: '{{quantity}} {{productTitle}} \u5DF2\u52A0\u5165\u8D2D\u7269\u8F66\u3002',\n },\n addingToCart: {\n ar: '\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0636\u0627\u0641\u0629...',\n cs: 'P\u0159id\u00E1v\u00E1n\u00ED...',\n da: 'Tilf\u00F8jer...',\n de: 'Wird hinzugef\u00FCgt...',\n en: 'Adding...',\n es: 'A\u00F1adiendo...',\n fi: 'Lis\u00E4t\u00E4\u00E4n...',\n fr: 'Ajout en cours...',\n ga: '\u00C1 chur leis...',\n he: '\u05DE\u05D5\u05E1\u05D9\u05E3...',\n hi: '\u091C\u094B\u0921\u093C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948...',\n id: 'Menambahkan...',\n it: 'Aggiunta in corso...',\n ja: '\u8FFD\u52A0\u4E2D...',\n ko: '\uCD94\uAC00 \uC911...',\n nl: 'Toevoegen...',\n no: 'Legger til...',\n pl: 'Dodawanie...',\n pt: 'Adicionando...',\n ru: '\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435...',\n sv: 'L\u00E4gger till...',\n th: '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E40\u0E1E\u0E34\u0E48\u0E21...',\n tr: 'Ekleniyor...',\n uk: '\u0414\u043E\u0434\u0430\u0432\u0430\u043D\u043D\u044F...',\n vi: '\u0110ang th\u00EAm...',\n zh: '\u6B63\u5728\u6DFB\u52A0...',\n },\n addToCart: {\n ar: '\u0623\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629',\n cs: 'P\u0159idat do ko\u0161\u00EDku',\n da: 'L\u00E6g i kurv',\n de: 'In den Warenkorb',\n en: 'Add to cart',\n es: 'A\u00F1adir al carrito',\n fi: 'Lis\u00E4\u00E4 ostoskoriin',\n fr: 'Ajouter au panier',\n ga: 'Cuir sa chairt',\n he: '\u05D4\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4',\n hi: '\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u0947\u0902',\n id: 'Tambahkan ke keranjang',\n it: 'Aggiungi al carrello',\n ja: '\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0',\n ko: '\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00',\n nl: 'In winkelwagen',\n no: 'Legg i handlekurven',\n pl: 'Dodaj do koszyka',\n pt: 'Adicionar ao carrinho',\n ru: '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443',\n sv: 'L\u00E4gg i varukorgen',\n th: '\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E15\u0E30\u0E01\u0E23\u0E49\u0E32',\n tr: 'Sepete ekle',\n uk: '\u0414\u043E\u0434\u0430\u0442\u0438 \u0432 \u043A\u043E\u0448\u0438\u043A',\n vi: 'Th\u00EAm v\u00E0o gi\u1ECF h\u00E0ng',\n zh: '\u52A0\u5165\u8D2D\u7269\u8F66',\n },\n redirectToCheckout: {\n ar: '\u0627\u0644\u062F\u0641\u0639',\n cs: 'Pokladna',\n da: 'Til kassen',\n de: 'Zur Kasse',\n en: 'Checkout',\n es: 'Finalizar compra',\n fi: 'Kassalle',\n fr: 'Paiement',\n ga: 'Seice\u00E1il amach',\n he: '\u05DC\u05EA\u05E9\u05DC\u05D5\u05DD',\n hi: '\u091A\u0947\u0915\u0906\u0909\u091F',\n id: 'Checkout',\n it: 'Cassa',\n ja: '\u30C1\u30A7\u30C3\u30AF\u30A2\u30A6\u30C8',\n ko: '\uACB0\uC81C\uD558\uAE30',\n nl: 'Afrekenen',\n no: 'Til kassen',\n pl: 'Do kasy',\n pt: 'Finalizar compra',\n ru: '\u041E\u0444\u043E\u0440\u043C\u0438\u0442\u044C \u0437\u0430\u043A\u0430\u0437',\n sv: 'Till kassan',\n th: '\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19',\n tr: '\u00D6deme',\n uk: '\u041E\u0444\u043E\u0440\u043C\u0438\u0442\u0438 \u0437\u0430\u043C\u043E\u0432\u043B\u0435\u043D\u043D\u044F',\n vi: 'Thanh to\u00E1n',\n zh: '\u7ED3\u8D26',\n },\n soldOut: {\n ar: '\u0646\u0641\u062F\u062A \u0627\u0644\u0643\u0645\u064A\u0629',\n cs: 'Vyprod\u00E1no',\n da: 'Udsolgt',\n de: 'Ausverkauft',\n en: 'Sold out',\n es: 'Agotado',\n fi: 'Loppuunmyyty',\n fr: '\u00C9puis\u00E9',\n ga: 'D\u00EDolta amach',\n he: '\u05D0\u05D6\u05DC \u05DE\u05D4\u05DE\u05DC\u05D0\u05D9',\n hi: '\u0938\u094D\u091F\u0949\u0915 \u0916\u093C\u0924\u094D\u092E',\n id: 'Habis terjual',\n it: 'Esaurito',\n ja: '\u58F2\u308A\u5207\u308C',\n ko: '\uD488\uC808',\n nl: 'Uitverkocht',\n no: 'Utsolgt',\n pl: 'Wyprzedane',\n pt: 'Esgotado',\n ru: '\u0420\u0430\u0441\u043F\u0440\u043E\u0434\u0430\u043D\u043E',\n sv: 'Sluts\u00E5ld',\n th: '\u0E2A\u0E34\u0E19\u0E04\u0E49\u0E32\u0E2B\u0E21\u0E14',\n tr: 'T\u00FCkendi',\n uk: '\u0420\u043E\u0437\u043F\u0440\u043E\u0434\u0430\u043D\u043E',\n vi: 'H\u1EBFt h\u00E0ng',\n zh: '\u5DF2\u552E\u7F44',\n },\n undo: {\n ar: '\u062A\u0631\u0627\u062C\u0639',\n cs: 'Zp\u011Bt',\n da: 'Fortryd',\n de: 'R\u00FCckg\u00E4ngig',\n en: 'Undo',\n es: 'Deshacer',\n fi: 'Kumoa',\n fr: 'Annuler',\n ga: 'Cealaigh',\n he: '\u05D1\u05D8\u05DC',\n hi: '\u092A\u0942\u0930\u094D\u0935\u0935\u0924 \u0915\u0930\u0947\u0902',\n id: 'Urungkan',\n it: 'Annulla',\n ja: '\u5143\u306B\u623B\u3059',\n ko: '\uC2E4\uD589 \uCDE8\uC18C',\n nl: 'Ongedaan maken',\n no: 'Angre',\n pl: 'Cofnij',\n pt: 'Desfazer',\n ru: '\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C',\n sv: '\u00C5ngra',\n th: '\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33',\n tr: 'Geri al',\n uk: '\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438',\n vi: 'Ho\u00E0n t\u00E1c',\n zh: '\u64A4\u9500',\n },\n} as const satisfies Record<string, Record<string, string>>;\n", "import { OFFER_LABELS } from '~/schema/widgets/checkout-and-beyond/offerLabels';\n\n/**\n * The canonical base \"Checkout Offers\" CAB layout \u2014 designed in the editor by Jeff (REB-23182) and\n * exported. It was authored inside the content-block editor (the only surface that can lay out an\n * offers section), so the export originally carried that widget type + the test store's data source;\n * those have been cleaned here to read as a real offer template. `buildOfferTemplate` still strips any\n * residual section ids (so each created widget gets fresh ones) and injects the per-widget name +\n * editor mode at runtime. Regenerate by re-exporting + the generator script, not by hand \u2014 with ONE\n * hand-completed exception a re-export must preserve: the add button's `addedToCart`/`soldOut`/\n * `redirectToCheckout` slots (`OFFER_LABELS` defaults). The editor export carried only\n * `addingToCart`/`addToCart`, which left the sold-out/added/Buy-Now states falling back to the add\n * label at runtime (guarded by a `buildOfferTemplate` test).\n */\nexport const OFFER_TEMPLATE_SEED = {\n alignment: {\n horizontal: 'center',\n vertical: 'top',\n },\n border: {\n radius: 'base',\n style: 'none',\n width: 'thick',\n },\n direction: 'rows',\n editorMode: 'checkoutExtension',\n grid: {\n columns: ['auto'],\n rows: ['auto'],\n },\n padding: 'tight',\n previewMode: false,\n sections: [\n {\n alignment: {\n horizontal: 'end',\n vertical: 'top',\n },\n autoAdvanceInterval: 0,\n border: {\n radius: 'base',\n style: 'none',\n width: 'base',\n },\n direction: 'rows',\n grid: {\n columns: ['auto'],\n rows: ['auto', 'auto'],\n },\n itemsAtOnce: 2,\n padding: 'none',\n sections: [\n {\n alignment: {\n horizontal: 'start',\n vertical: 'middle',\n },\n border: {\n radius: 'base',\n style: 'none',\n width: 'base',\n },\n direction: 'columns',\n grid: {\n columns: ['auto', 'auto'],\n rows: ['auto'],\n },\n name: 'pagination',\n padding: 'none',\n sections: [\n {\n action: 'goToPrevPage',\n buttonStyle: 'plain',\n disableDowngrade: false,\n popover: {\n alignment: 'center',\n position: 'blockStart',\n },\n sections: [\n {\n buttonField: 'buttonLabel',\n content: {\n ar: '\u2039',\n cs: '\u2039',\n da: '\u2039',\n de: '\u2039',\n en: '\u2039',\n es: '\u2039',\n fi: '\u2039',\n fr: '\u2039',\n ga: '\u2039',\n he: '\u2039',\n hi: '\u2039',\n id: '\u2039',\n it: '\u2039',\n ja: '\u2039',\n ko: '\u2039',\n nl: '\u2039',\n no: '\u2039',\n pl: '\u2039',\n pt: '\u2039',\n ru: '\u2039',\n sv: '\u2039',\n th: '\u2039',\n tr: '\u2039',\n uk: '\u2039',\n vi: '\u2039',\n zh: '\u2039',\n },\n sectionType: 'text',\n },\n ],\n sectionType: 'button',\n },\n {\n action: 'goToNextPage',\n buttonStyle: 'plain',\n disableDowngrade: false,\n popover: {\n alignment: 'center',\n position: 'blockStart',\n },\n sections: [\n {\n buttonField: 'buttonLabel',\n content: {\n ar: '\u203A',\n cs: '\u203A',\n da: '\u203A',\n de: '\u203A',\n en: '\u203A',\n es: '\u203A',\n fi: '\u203A',\n fr: '\u203A',\n ga: '\u203A',\n he: '\u203A',\n hi: '\u203A',\n id: '\u203A',\n it: '\u203A',\n ja: '\u203A',\n ko: '\u203A',\n nl: '\u203A',\n no: '\u203A',\n pl: '\u203A',\n pt: '\u203A',\n ru: '\u203A',\n sv: '\u203A',\n th: '\u203A',\n tr: '\u203A',\n uk: '\u203A',\n vi: '\u203A',\n zh: '\u203A',\n },\n sectionType: 'text',\n },\n ],\n sectionType: 'button',\n },\n ],\n sectionType: 'layout',\n spacing: 'base',\n width: 100,\n },\n {\n alignment: {\n horizontal: 'start',\n vertical: 'middle',\n },\n border: {\n radius: 'base',\n style: 'base',\n width: 'base',\n },\n direction: 'rows',\n grid: {\n columns: ['15%'],\n rows: ['auto', 'auto'],\n },\n padding: 'base',\n sections: [\n {\n alignment: {\n horizontal: 'start',\n vertical: 'middle',\n },\n border: {\n radius: 'base',\n style: 'none',\n width: 'base',\n },\n direction: 'grid',\n grid: {\n columns: ['15%', 'fill', 'auto'],\n rows: ['auto'],\n },\n padding: 'none',\n sections: [\n {\n altText: '',\n aspectRatio: null,\n border: {\n radius: 'base',\n style: 'none',\n width: 'base',\n },\n category: null,\n name: 'Product Image',\n naturalHeight: 0,\n naturalWidth: 0,\n objectFit: 'cover',\n sectionType: 'image',\n source: '{{productImage}}',\n width: 100,\n },\n {\n content: {\n en: {\n attrs: {\n blockSpacing: 'none',\n },\n content: [\n {\n attrs: {\n textAlign: 'start',\n },\n content: [\n {\n marks: [\n {\n attrs: {\n color: 'base',\n fontSize: 'medium',\n },\n type: 'textStyle',\n },\n {\n type: 'bold',\n },\n ],\n text: '{{productAndVariantTitle}}',\n type: 'text',\n },\n ],\n type: 'paragraph',\n },\n {\n attrs: {\n textAlign: 'start',\n },\n content: [\n {\n marks: [\n {\n attrs: {\n color: 'accent',\n fontSize: 'medium',\n },\n type: 'textStyle',\n },\n ],\n text: '{{variantPrice}}',\n type: 'text',\n },\n ],\n type: 'paragraph',\n },\n ],\n type: 'doc',\n },\n },\n name: 'Product Info',\n sectionType: 'text',\n },\n {\n action: 'addToOrder',\n buttonStyle: 'primary',\n disableDowngrade: false,\n popover: {\n alignment: 'center',\n position: 'blockStart',\n },\n sections: [\n {\n buttonField: 'addingToCart',\n content: {\n ar: '\u064A\u062A\u0645 \u0627\u0644\u0625\u0636\u0627\u0641\u0629 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629',\n cs: 'P\u0159id\u00E1v\u00E1m do ko\u0161\u00EDku',\n da: 'Tilf\u00F8jer til kurv',\n de: 'Wird zum Warenkorb hinzugef\u00FCgt',\n en: 'Adding...',\n es: 'Agregando al carrito',\n fi: 'Lis\u00E4t\u00E4\u00E4n ostoskoriin',\n fr: 'Ajout au panier',\n ga: '\u00C1 Chur le Cairt',\n he: '\u05DE\u05D5\u05E1\u05D9\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4',\n hi: '\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C \u0930\u0939\u0947 \u0939\u0948\u0902',\n id: 'Menambahkan ke Keranjang',\n it: 'Aggiungendo al carrello',\n ja: '\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0\u4E2D',\n ko: '\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00 \uC911',\n nl: 'Toevoegen aan winkelwagen',\n no: 'Legger i handlekurv',\n pl: 'Dodaj\u0119 do koszyka',\n pt: 'Adicionando ao carrinho',\n ru: '\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443',\n sv: 'L\u00E4gger till i varukorg',\n th: '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E43\u0E19\u0E23\u0E16\u0E40\u0E02\u0E47\u0E19',\n tr: 'Sepete Ekleniyor',\n uk: '\u0414\u043E\u0434\u0430\u0454\u043C\u043E \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430',\n vi: '\u0110ang th\u00EAm v\u00E0o gi\u1ECF h\u00E0ng',\n zh: '\u6B63\u5728\u52A0\u5165\u8D2D\u7269\u8F66',\n },\n sectionType: 'text',\n },\n {\n buttonField: 'addToCart',\n content: {\n ar: '\u0623\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629',\n cs: 'P\u0159idat do ko\u0161\u00EDku',\n da: 'F\u00F8j til kurv',\n de: 'In den Warenkorb',\n en: 'Add',\n es: 'Agregar al carrito',\n fi: 'Lis\u00E4\u00E4 ostoskoriin',\n fr: 'Ajouter au panier',\n ga: 'Cuir le Cairt',\n he: '\u05D4\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4',\n hi: '\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u0947\u0902',\n id: 'Tambah ke Keranjang',\n it: 'Aggiungi al carrello',\n ja: '\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0',\n ko: '\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00',\n nl: 'Toevoegen aan winkelwagen',\n no: 'Legg i handlekurv',\n pl: 'Dodaj do koszyka',\n pt: 'Adicionar ao carrinho',\n ru: '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443',\n sv: 'L\u00E4gg i varukorg',\n th: '\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E43\u0E19\u0E23\u0E16\u0E40\u0E02\u0E47\u0E19',\n tr: 'Sepete Ekle',\n uk: '\u0414\u043E\u0434\u0430\u0442\u0438 \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430',\n vi: 'Th\u00EAm v\u00E0o gi\u1ECF h\u00E0ng',\n zh: '\u52A0\u5165\u8D2D\u7269\u8F66',\n },\n sectionType: 'text',\n },\n {\n buttonField: 'addedToCart',\n content: OFFER_LABELS.addedToCart,\n sectionType: 'text',\n },\n {\n buttonField: 'soldOut',\n content: OFFER_LABELS.soldOut,\n sectionType: 'text',\n },\n {\n buttonField: 'redirectToCheckout',\n content: OFFER_LABELS.redirectToCheckout,\n sectionType: 'text',\n },\n ],\n sectionType: 'button',\n },\n ],\n sectionType: 'layout',\n spacing: 'base',\n width: 100,\n },\n {\n alignment: {\n horizontal: 'start',\n vertical: 'top',\n },\n border: {\n radius: 'base',\n style: 'none',\n width: 'base',\n },\n direction: 'rows',\n grid: {\n columns: ['auto'],\n rows: ['auto'],\n },\n padding: 'none',\n sections: [\n {\n errorMessages: {\n en: {\n max: 'Maximum quantity allowed is {{max}}',\n min: 'Minimum quantity required is {{min}}',\n neg: 'Quantity cannot be negative',\n },\n },\n inputType: 'select',\n max: 10,\n min: 1,\n sectionType: 'quantity',\n },\n ],\n sectionType: 'layout',\n spacing: 'base',\n width: 100,\n },\n {\n limit: 3,\n sectionType: 'dataSource',\n },\n {\n sectionType: 'products',\n },\n ],\n sectionType: 'offers',\n spacing: 'base',\n width: 100,\n },\n ],\n sectionType: 'carousel',\n spacing: 'base',\n width: 100,\n },\n ],\n sectionType: 'layout',\n spacing: 'base',\n targetArea: {\n icon: 'splitscreen_left',\n label: 'Main Column',\n width: '503px',\n },\n type: 'shopify_checkout_extension',\n version: 2,\n width: 100,\n};\n", "/**\n * Minimal v1 Offer (Checkout Offers / product recommendations) input types.\n * The legacy widget's settings `type` is the generic `shopify_checkout_extension`\n * (the offer is the \"base\" checkout-extension type; other widgets carry\n * `ui_extension_*`), which uniquely identifies it at the settings level.\n */\nimport { type TiptapDocument } from '~/schema/widgets/checkout-and-beyond/text';\n\nexport const SHOPIFY_CHECKOUT_EXTENSION = 'shopify_checkout_extension' as const;\n\nexport type V1OfferLanguage = {\n addedToCart?: string;\n addingToCart?: string;\n addToCart?: string;\n /** Subscribe \u2192 one-time label for the offers `switchToSubscription` button. */\n cartSwitchToOnetime?: string;\n /** One-time \u2192 subscribe label (carries `{{subscription_discount}}`) for the `switchToSubscription` button. */\n cartSwitchToSubscription?: string;\n description?: string;\n /** Buy Now link label on off-checkout surfaces (thank-you / order-status), real key `redirect_to_checkout`. */\n redirectToCheckout?: string;\n /** Real payload key is `sold_out_label` \u2192 `soldOutLabel` (NOT `soldOut`). */\n soldOutLabel?: string;\n /** Opt-in undo banner shown after a buyer adds a recommended product. */\n successBannerEnabled?: boolean;\n successBannerMessageRte?: TiptapDocument | string;\n superTitle?: string;\n title?: string;\n /** Legacy \"Upgrade to Subscription and Save {{subscription_discount}}%\" upsell label. */\n upgradeToSubscription?: string;\n};\n\n/** v1 per-product text styling; `textSize` is the CAB `textSizeNames` enum verbatim. */\nexport type V1TextStyle = {\n textEmphasis?: 'base' | 'bold' | 'italic';\n textSize?: 'extraSmall' | 'small' | 'base' | 'medium' | 'large' | 'extraLarge';\n};\n\n/** v1 `displaySettings` \u2014 the controls behind product/variant/image/review presentation. */\nexport type V1OfferDisplaySettings = {\n image?: { imageFit?: 'contain' | 'cover' };\n product?: V1TextStyle;\n reviews?: { color?: string; size?: 'small' | 'default' | 'large' };\n variant?: V1TextStyle;\n};\n\n/**\n * v1 layout is per-breakpoint; CAB has no breakpoints, so the converter collapses them.\n * `style` drives orientation: list \u2192 rows, line \u2192 columns, grid \u2192 grid (none \u2192 rows).\n */\nexport type V1OfferBreakpointLayout = {\n carousel?: boolean;\n columns?: number;\n showPaginations?: boolean;\n style?: 'grid' | 'line' | 'list' | 'none';\n};\n\nexport type V1OfferSettings = {\n /** Free-form in real payloads; the converter safelists to the CAB enum (junk \u2192 'primary'). */\n button?: { kind?: string };\n /** `showSavingAmount` false hides the compare-at (sale) price; `amount`/`type`/`discountedFrom`/`discountedBy` drive the discount-setting price computation (emitted onto the offers section for the client's pricing pass). */\n discount?: {\n amount?: number | string;\n discountedBy?: string;\n discountedFrom?: string;\n /** Merchant-facing promo label (e.g. \"Enjoy 10% off!\") \u2192 carried onto the data-source discount. */\n message?: string;\n /** How many items the discount applies to (defaults to 1) \u2192 carried onto the discount section. */\n quantity?: number;\n showSavingAmount?: boolean;\n type?: string;\n };\n /** Per-product/variant/image/review presentation controls. */\n displaySettings?: V1OfferDisplaySettings;\n /** Engine path appended to `/api/v1` (e.g. '/products/recommended'). */\n endpoint?: string | null;\n images?: { source?: 'product' | 'variant' };\n /**\n * Nominally boolean, but legacy data carries \"yes\"/\"no\" strings (reviewsio, in prod) and numeric\n * 1/0 (PHP serialization) \u2014 the converter coerces both so neither throws at the schema boolean.\n */\n integrations?: Record<string, boolean | number | string>;\n language?: V1OfferLanguage;\n layout?: { large?: V1OfferBreakpointLayout; medium?: V1OfferBreakpointLayout; small?: V1OfferBreakpointLayout };\n limit?: number;\n location?: 'checkout' | 'order-status' | 'thank-you';\n /** The legacy widget's name, present in the settings payload; carried to the converted root. */\n name?: string;\n previewMode?: boolean;\n productOptions?: {\n hideOutOfStockVariants?: boolean;\n matchVariant?: boolean;\n matchVariantOutOfStock?: boolean;\n /** 'hide' (or absent) hides the per-card product description; any other value shows it. */\n showProductDescription?: string;\n showVariantOptions?: 'always' | 'default' | 'never';\n showVariantsAsProducts?: boolean;\n /** 'hide' (or absent) hides the selected-variant title line; any other value shows it. */\n showVariantTitle?: string;\n };\n productType?: 'both' | 'one-time' | 'subscription';\n quantityInputs?: {\n enabled?: boolean;\n /** Custom over-max error copy \u2192 CAB `errorMessages.en.max`. */\n maxError?: string;\n maxValue?: number;\n /** Custom under-min error copy \u2192 CAB `errorMessages.en.min`. */\n minError?: string;\n minValue?: number;\n /** Custom negative-value error copy \u2192 CAB `errorMessages.en.neg`. */\n negativeError?: string;\n /** Stepper kind ('dropdown-select' | 'buttons-manual-input') \u2192 CAB `inputType` (select | number). */\n type?: string;\n };\n /** Default subscribe-vs-one-time when `productType` is `both`. */\n subscriptionIsDefault?: boolean;\n tracking?: { enableAttribution?: boolean; enableSource?: boolean; enableWidget?: boolean };\n treatAsGwp?: boolean;\n type: typeof SHOPIFY_CHECKOUT_EXTENSION;\n /** Absent on real checkout-offers payloads; only `type` is the reliable discriminator. */\n version?: 1;\n /** v1 `viewOptions`: `displayActions === false` hides the variant selector (legacy `getVariantSelect`). */\n viewOptions?: { displayActions?: boolean; variantSelector?: 'select' | 'radio' | 'button' };\n};\n\nexport type V1OfferConvertInput = {\n id: number;\n /** The legacy widget's name; set on the converted root (the admin save schema requires it). */\n name?: string;\n settings: V1OfferSettings;\n};\n\n/**\n * The offer's settings `type` uniquely identifies it. Unlike the `ui_extension_*` widgets, the legacy\n * checkout-offers payload carries NO top-level `version` \u2014 so we must NOT gate on it (doing so silently\n * dropped real offers to the passthrough branch). `version: 2` payloads are already claimed upstream by\n * `isCABRootSection`, so they never reach here.\n */\nexport const isOfferV1 = (data: unknown): data is V1OfferSettings => {\n if (!data || typeof data !== 'object') return false;\n\n return (data as Record<string, unknown>).type === SHOPIFY_CHECKOUT_EXTENSION;\n};\n", "import { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { OFFER_TEMPLATE_SEED } from '~/transforms/offerV1/offerTemplateSeed';\nimport { SHOPIFY_CHECKOUT_EXTENSION } from '~/transforms/offerV1/types';\n\nconst LOCATION_TO_EDITOR_MODE = {\n checkout: 'checkoutExtension',\n 'order-status': 'orderStatusPage',\n 'thank-you': 'thankYouPage',\n} as const;\n\nexport type BuildOfferTemplateInput = {\n location?: 'checkout' | 'order-status' | 'thank-you';\n name?: string;\n};\n\n/**\n * Build a brand-new \"Checkout Offers\" widget as a `CABRootSection` from the designed base layout.\n * Pure and synchronous (admin-side, network-free): overlays the per-widget `name` + editor mode and\n * the offer widget type, then parses. The seed carries NO section ids (enforced by a test), so `parse`\n * mints fresh `uuidv7`s on every call \u2014 two created widgets never share section ids.\n */\nexport const buildOfferTemplate = ({ location, name }: BuildOfferTemplateInput = {}): CABRootSection =>\n CABRootSection.parse({\n ...OFFER_TEMPLATE_SEED,\n editorMode: LOCATION_TO_EDITOR_MODE[location ?? 'checkout'],\n ...(name && { name }),\n previewMode: false,\n type: SHOPIFY_CHECKOUT_EXTENSION,\n });\n", "import { OFFER_LABELS } from '~/schema/widgets/checkout-and-beyond/offerLabels';\nimport { SWITCH_LABELS } from '~/schema/widgets/checkout-and-beyond/switchLabels';\nimport { localizedContent } from '~/transforms/localizedContent';\nimport { type V1OfferSettings, type V1TextStyle } from '~/transforms/offerV1/types';\n\n/** v1 `viewOptions.variantSelector` \u2192 CAB `variants.selector` ('select' is the v1 name for a dropdown menu). */\nconst VARIANT_SELECTOR = { button: 'button', radio: 'radio', select: 'menu' } as const;\n\n/**\n * A single-token Tiptap doc carrying a v1 text style: `textSize` is the CAB `fontSize`\n * verbatim (identical enums); `textEmphasis` adds a bold/italic mark ('base' adds none).\n */\nconst buildStyledText = (token: string, style: V1TextStyle | undefined, color = 'base') => {\n const marks: Record<string, unknown>[] = [\n { attrs: { color, fontSize: style?.textSize ?? 'base' }, type: 'textStyle' },\n ];\n\n if (style?.textEmphasis === 'bold') marks.push({ type: 'bold' });\n\n if (style?.textEmphasis === 'italic') marks.push({ type: 'italic' });\n\n return { content: [{ content: [{ marks, text: token, type: 'text' }], type: 'paragraph' }], type: 'doc' };\n};\n\n/**\n * The price line: the variant price, optionally followed by a strikethrough,\n * subdued compare-at price. The extension resolves `{{variantCompareAtPrice}}`\n * to '' off-sale, so the strikethrough disappears unless the variant is genuinely\n * discounted. `discount.showSavingAmount` false drops the compare-at node entirely.\n */\nconst buildPriceContent = (settings: V1OfferSettings) => {\n const content: Record<string, unknown>[] = [{ text: '{{variantPrice}}', type: 'text' }];\n\n if (settings.discount?.showSavingAmount !== false) {\n content.push(\n { text: ' ', type: 'text' },\n {\n marks: [{ type: 'strike' }, { attrs: { color: 'subdued' }, type: 'textStyle' }],\n text: '{{variantCompareAtPrice}}',\n type: 'text',\n }\n );\n }\n\n return { content: [{ content, type: 'paragraph' }], type: 'doc' };\n};\n\n/** A `reviews` star section, emitted only when the merchant has a review integration enabled. */\nconst buildReviews = (settings: V1OfferSettings): Record<string, unknown>[] => {\n if (!settings.integrations || !Object.values(settings.integrations).some(Boolean)) return [];\n\n const reviews = settings.displaySettings?.reviews;\n\n return [\n {\n ...(reviews?.color && { color: reviews.color }),\n sectionType: 'reviews',\n ...(reviews?.size && { size: reviews.size }),\n },\n ];\n};\n\n/** The recommended product's image; objectFit comes from v1 `displaySettings.image.imageFit`. */\nconst buildImage = (settings: V1OfferSettings): Record<string, unknown> => ({\n ...(settings.displaySettings?.image?.imageFit && {\n objectFit: settings.displaySettings.image.imageFit,\n }),\n sectionType: 'image',\n source: settings.images?.source === 'product' ? '{{productImage}}' : '{{variantImage}}',\n width: 100,\n});\n\n/** The product title text, styled from v1 `displaySettings.product`. */\nconst buildTitle = (settings: V1OfferSettings): Record<string, unknown> => ({\n content: { en: buildStyledText('{{productTitle}}', settings.displaySettings?.product) },\n sectionType: 'text',\n});\n\n/** The price line (variant price + on-sale compare-at strikethrough). */\nconst buildPrice = (settings: V1OfferSettings): Record<string, unknown> => ({\n content: { en: buildPriceContent(settings) },\n sectionType: 'text',\n});\n\n/** The selected-variant title line, gated by `productOptions.showVariantTitle` ('hide'/absent = off). */\nconst buildVariantTitle = (settings: V1OfferSettings): Record<string, unknown>[] => {\n const show = settings.productOptions?.showVariantTitle;\n\n if (!show || show === 'hide') return [];\n\n return [\n {\n content: { en: buildStyledText('{{variantTitle}}', settings.displaySettings?.variant) },\n sectionType: 'text',\n },\n ];\n};\n\n/** The per-card product description, gated by `productOptions.showProductDescription` ('hide'/absent = off). */\nconst buildDescription = (settings: V1OfferSettings): Record<string, unknown>[] => {\n const show = settings.productOptions?.showProductDescription;\n\n if (!show || show === 'hide') return [];\n\n return [{ content: { en: buildStyledText('{{productDescription}}', undefined) }, sectionType: 'text' }];\n};\n\n/** The variant selector, unless the merchant hid variant options or turned actions off entirely. */\nconst buildVariants = (settings: V1OfferSettings): Record<string, unknown>[] => {\n /** Legacy `getVariantSelect`: `view_options.display_actions === false` suppresses the selector. */\n if (settings.viewOptions?.displayActions === false) return [];\n\n if (settings.productOptions?.showVariantOptions === 'never') return [];\n\n const selector = settings.viewOptions?.variantSelector;\n\n return [\n {\n hideOutOfStockVariants: !!settings.productOptions?.hideOutOfStockVariants,\n ...(selector && { selector: VARIANT_SELECTOR[selector] }),\n sectionType: 'variants',\n },\n ];\n};\n\n/** v1 stepper kind \u2192 CAB `inputType`. Unknown/absent \u2192 omitted so the schema default ('select') applies. */\nconst QUANTITY_INPUT_TYPE: Record<string, 'number' | 'select'> = {\n 'buttons-manual-input': 'number',\n 'dropdown-select': 'select',\n};\n\n/** Custom quantity error copy \u2192 CAB `errorMessages.en.{min,max,neg}`; omitted entirely when none is set. */\nconst buildQuantityErrors = (quantity: NonNullable<V1OfferSettings['quantityInputs']>) => {\n const en = {\n ...(quantity.maxError && { max: quantity.maxError }),\n ...(quantity.minError && { min: quantity.minError }),\n ...(quantity.negativeError && { neg: quantity.negativeError }),\n };\n\n return Object.keys(en).length ? { errorMessages: { en } } : {};\n};\n\n/** The quantity stepper, when the merchant enabled quantity input. */\nconst buildQuantity = (settings: V1OfferSettings): Record<string, unknown>[] => {\n const quantity = settings.quantityInputs;\n\n if (!quantity?.enabled) return [];\n\n const inputType = quantity.type ? QUANTITY_INPUT_TYPE[quantity.type] : undefined;\n\n // Legacy quantity had no upper bound (DefaultQuantityRule.MAX = null) and allowed 0; the CAB\n // schema pins `max` to [1, 100] and `min` to >= 1. Clamp instead of passing through so a legacy\n // `maxValue: 250` (or a 0) degrades to a valid widget rather than throwing at parse.\n const max = Math.min(Math.max(quantity.maxValue ?? 10, 1), 100);\n // Also cap `min` at `max` \u2014 the schema has no cross-field refine, so a legacy `min > max` (e.g.\n // {maxValue: 5, minValue: 8}) would parse but render a degenerate stepper (REB #766).\n const min = Math.min(Math.max(quantity.minValue ?? 1, 1), max);\n\n return [\n {\n ...buildQuantityErrors(quantity),\n ...(inputType && { inputType }),\n max,\n min,\n sectionType: 'quantity',\n },\n ];\n};\n\n/**\n * The in-card subscribe / one-time toggle: a `switchToSubscription` button with its four label slots\n * (the same `SWITCH_LABELS` slot set as the line-item editor, including the `subscriptionOption`\n * frequency template, so the frequency select localizes). Emitted when the merchant offers\n * subscriptions (`productType` both/subscription); the extension shows it per-product by selling-plan\n * availability. v1 carries the with-discount upsell (`upgradeToSubscription`) plus the cart switch\n * labels; anything blank/absent falls back to the shared localized defaults.\n */\nconst buildSubscriptionButton = (settings: V1OfferSettings): Record<string, unknown>[] => {\n if (settings.productType !== 'both' && settings.productType !== 'subscription') return [];\n\n const language = settings.language;\n\n const slot = (buttonField: keyof typeof SWITCH_LABELS, override: string | undefined) => ({\n buttonField,\n content: localizedContent(SWITCH_LABELS[buttonField], override),\n sectionType: 'text',\n });\n\n return [\n {\n action: 'switchToSubscription',\n buttonStyle: 'plain',\n sections: [\n slot('subscriptionOption', undefined),\n slot('switchToOneTimePurchase', language?.cartSwitchToOnetime),\n slot('switchToSubscriptionNoDiscount', language?.cartSwitchToSubscription),\n slot('switchToSubscriptionWithDiscount', language?.upgradeToSubscription),\n ],\n sectionType: 'button',\n },\n ];\n};\n\n/** v1 stores free-form `button.kind`; anything outside the CAB enum falls back to the legacy 'primary'. */\nconst BUTTON_KINDS = ['plain', 'primary', 'secondary'] as const;\n\n/** The add-to-order button with its four label slots (add / adding / added / sold-out). */\nconst buildAddButton = (settings: V1OfferSettings): Record<string, unknown> => {\n const kind = settings.button?.kind;\n\n const slot = (\n buttonField: 'addedToCart' | 'addingToCart' | 'addToCart' | 'redirectToCheckout' | 'soldOut',\n override?: string\n ) => ({\n buttonField,\n content: localizedContent(OFFER_LABELS[buttonField], override),\n sectionType: 'text',\n });\n\n return {\n action: 'addToOrder',\n buttonStyle: BUTTON_KINDS.includes(kind as (typeof BUTTON_KINDS)[number]) ? kind : 'primary',\n sections: [\n slot('addToCart', settings.language?.addToCart),\n slot('addingToCart', settings.language?.addingToCart),\n slot('addedToCart', settings.language?.addedToCart),\n slot('soldOut', settings.language?.soldOutLabel),\n // Off-checkout Buy Now: the label the button shows once it links to the created checkout.\n slot('redirectToCheckout', settings.language?.redirectToCheckout),\n ],\n sectionType: 'button',\n };\n};\n\n/** A `rows` layout wrapping sections into one grid cell (so they stack within a column of the card). */\nconst rowsLayout = (sections: Record<string, unknown>[]): Record<string, unknown> => ({\n direction: 'rows',\n sections,\n sectionType: 'layout',\n});\n\n/**\n * The per-offer product card: the sections rendered once per recommended product (the\n * offers renderer mounts a product context, so the `{{...}}` tokens resolve per product).\n *\n * `horizontal` mirrors the v1 layout orientation (see `convertOfferToV2`):\n * - horizontal (v1 `list`/default, vertical-stacked products): a 3-column grid card \u2014\n * image | title/price/reviews/variants | actions \u2014 matching the compact V1 row.\n * - vertical (v1 `grid`/`line`, side-by-side products): a flat top-to-bottom stack\n * (image \u2192 title \u2192 price \u2192 \u2026 \u2192 button), the narrow column card.\n *\n * Quantity is a full-width row beneath the card in the horizontal layout; in the vertical\n * layout it sits inline in the stack. NOT carried: the savings-amount badge (no live v1\n * control) and variant text styling (no CAB field).\n */\nexport const buildOfferCard = (settings: V1OfferSettings, horizontal: boolean): Record<string, unknown>[] => {\n const image = buildImage(settings);\n const title = buildTitle(settings);\n const variantTitle = buildVariantTitle(settings);\n const price = buildPrice(settings);\n const description = buildDescription(settings);\n const reviews = buildReviews(settings);\n const variants = buildVariants(settings);\n const quantity = buildQuantity(settings);\n const subscription = buildSubscriptionButton(settings);\n const addButton = buildAddButton(settings);\n\n if (!horizontal) {\n return [\n image,\n title,\n ...variantTitle,\n price,\n ...description,\n ...reviews,\n ...variants,\n ...quantity,\n ...subscription,\n addButton,\n ];\n }\n\n const info = rowsLayout([title, ...variantTitle, price, ...description, ...reviews, ...variants]);\n const actions = [...subscription, addButton];\n const actionsCell = actions.length === 1 ? actions[0] : rowsLayout(actions);\n\n const card = {\n direction: 'grid',\n grid: { columns: ['15%', 'fill', 'auto'], rows: ['auto'] },\n sections: [image, info, actionsCell],\n sectionType: 'layout',\n };\n\n return [card, ...quantity];\n};\n", "import { OFFER_LABELS } from '~/schema/widgets/checkout-and-beyond/offerLabels';\nimport { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { convertContentBlockTextToV2 } from '~/transforms/contentBlockV1/convertContentBlockTextToV2';\nimport { stripContentBlockHtml } from '~/transforms/contentBlockV1/stripContentBlockHtml';\nimport { buildOfferCard } from '~/transforms/offerV1/offerCard';\nimport {\n SHOPIFY_CHECKOUT_EXTENSION,\n type V1OfferBreakpointLayout,\n type V1OfferConvertInput,\n type V1OfferSettings,\n} from '~/transforms/offerV1/types';\n\nconst LOCATION_TO_EDITOR_MODE = {\n checkout: 'checkoutExtension',\n 'order-status': 'orderStatusPage',\n 'thank-you': 'thankYouPage',\n} as const;\n\n/**\n * v1 per-breakpoint `layout.style` \u2192 CAB product-list `direction`. This is the product-TO-product\n * orientation and the card orientation flips with it (see `convertOfferToV2`):\n * - `grid`/`line` \u2192 products sit side-by-side (`grid`/`columns`); each card is a vertical stack.\n * - `list`/`none`/absent \u2192 products stack vertically (`rows`); each card is a horizontal row.\n * The v1 carousel toggle writes exactly these two: VERTICAL \u2192 `list`, HORIZONTAL \u2192 `grid`.\n */\nconst STYLE_TO_DIRECTION = {\n grid: 'grid',\n line: 'columns',\n list: 'rows',\n none: 'rows',\n} as const;\n\nconst directionForStyle = (style: V1OfferBreakpointLayout['style']) => (style ? STYLE_TO_DIRECTION[style] : 'rows');\n\n/**\n * The product-to-product layout \u2014 it belongs on the CONTAINER that holds the offers (the carousel\n * wrapper), NOT on the offers section. The renderer repeats the offers layout per product into its\n * parent's stack/grid, so a `grid` direction with N `'fill'` columns lays the products out N-across;\n * `list`/`none` stay a vertical stack.\n *\n * `'fill'` (equal share) \u2014 NOT `'auto'` (sizes to content), which yields unequal columns and so\n * unequal `objectFit: contain` image heights across products.\n */\nconst buildProductListLayout = (direction: string, columns: number) =>\n direction === 'grid'\n ? { direction, grid: { columns: Array.from({ length: Math.max(columns, 1) }, () => 'fill'), rows: ['auto'] } }\n : { direction };\n\nconst hasHeaderText = (language: V1OfferSettings['language']): boolean =>\n !!(language?.title || language?.superTitle || language?.description);\n\n/**\n * v1 `discountedFrom` \u2192 CAB `discountSources`. v1's \"Discounted From\" / \"Compare Price With\" select\n * stores `price` / `compare_at_price` directly; the legacy `original_price` (written in Shopify-Functions\n * mode) is the regular price, i.e. `price`. Unknown values are omitted (the CAB enum would reject them).\n */\nconst DISCOUNTED_FROM: Record<string, 'compare_at_price' | 'price'> = {\n compare_at_price: 'compare_at_price',\n original_price: 'price',\n price: 'price',\n};\n\n/**\n * The active widget-level discount as the `CABDiscount` carried on the DATA-SOURCE section \u2014 the field\n * the extension's price forecast actually reads (`dataSource.discount` \u2192 `priceVariant`); a discount\n * emitted anywhere else never reaches the card price. Undefined when there's no active discount;\n * `showSavingAmount` is a card-display concern handled in `buildOfferCard`.\n */\nconst dataSourceDiscount = (discount: V1OfferSettings['discount']): Record<string, unknown> | undefined => {\n if (!discount?.type || discount.type === 'none') return undefined;\n\n const discountedFrom = discount.discountedFrom ? DISCOUNTED_FROM[discount.discountedFrom] : undefined;\n\n return {\n amount: discount.amount ?? 0,\n ...(discount.discountedBy && { discountedBy: discount.discountedBy }),\n ...(discountedFrom && { discountedFrom }),\n type: discount.type,\n };\n};\n\n/**\n * The same discount as the config-only `discount` section just above the undo banner \u2014 the editor-facing\n * home of the FULL v1 shape (`message`/`quantity` have no `CABDiscount` counterpart). Both projections\n * come from the one v1 input in the same pass, so they cannot drift apart.\n */\nconst buildDiscountSection = (discount: V1OfferSettings['discount']): Record<string, unknown>[] => {\n const base = dataSourceDiscount(discount);\n\n if (!base) return [];\n\n return [\n {\n ...base,\n ...(discount?.message && { message: discount.message }),\n ...(discount?.quantity != null && { quantity: discount.quantity }),\n sectionType: 'discount',\n },\n ];\n};\n\n/**\n * The banner's success message content: a defined v1 message overrides `en`, absent falls back to the\n * localized defaults (P4 language policy). A string message is sanitized (a raw-HTML label would fail\n * `CABTextSection.content` and 500 the widget); an RTE doc passes through as authored. A string that\n * sanitizes to empty falls back to the defaults, same as absent.\n */\nconst bannerMessageContent = (message: NonNullable<V1OfferSettings['language']>['successBannerMessageRte']) => {\n const sanitized = typeof message === 'string' ? stripContentBlockHtml(message) : message;\n\n return sanitized ? { ...OFFER_LABELS.addedToCartMessage, en: sanitized } : OFFER_LABELS.addedToCartMessage;\n};\n\n/**\n * Legacy integrations values are nominally boolean but prod data carries \"yes\"/\"no\" strings\n * (React special-cased exactly this for reviewsio: only 'true'/'yes' count as enabled) and numeric\n * 1/0 (legacy PHP serialization). Coerce every value so neither a string nor a number can throw at\n * the schema's `z.boolean()` and kill the widget: only 'true'/'yes' and 1 count as enabled.\n */\nconst coerceIntegrations = (integrations: Record<string, boolean | number | string>): Record<string, boolean> =>\n Object.fromEntries(\n Object.entries(integrations).map(([key, value]) => {\n if (typeof value === 'string') return [key, ['true', 'yes'].includes(value.toLowerCase())];\n\n if (typeof value === 'number') return [key, value === 1];\n\n return [key, value];\n })\n );\n\n/** The opt-in undo banner: a success `banner` of the message + a plain undo button. */\nconst buildBanner = (language: V1OfferSettings['language']): Record<string, unknown>[] =>\n language?.successBannerEnabled\n ? [\n {\n /**\n * The banner-level tag is the extraction/routing key on BOTH renderers (React CAB's\n * `isBannerType` + marker check; the Preact extension's `isUndoBanner`) \u2014 without it\n * the banner renders per card as an always-visible plain success banner and the\n * cart-scoped undo rail never runs. The schema's default offers tree carries it too.\n */\n buttonField: 'undoAddToOrder',\n color: 'success',\n dismissible: true,\n sections: [\n {\n content: bannerMessageContent(language.successBannerMessageRte),\n sectionType: 'text',\n },\n {\n action: 'undoAddToOrder',\n buttonStyle: 'plain',\n /**\n * Tagged `undoAddToOrder`, never `buttonLabel` \u2014 the renderers (React CAB and\n * the Preact extension) and the schema's default offers tree resolve that slot.\n */\n sections: [\n { buttonField: 'undoAddToOrder', content: OFFER_LABELS.undo, sectionType: 'text' },\n ],\n sectionType: 'button',\n },\n ],\n sectionType: 'banner',\n },\n ]\n : [];\n\n/**\n * Translates a v1 Offer (Checkout Offers / product recommendations) widget into\n * a `CABRootSection`: an optional header (title/superTitle/description, reusing\n * the content-block text converter) over a `carousel` wrapper that ALWAYS contains\n * the `offers` section (the carousel is the required structural parent; it only\n * paginates when the v1 layout has carousel on). The offers section's `dataSource`\n * child carries the engine fetch config; its remaining children are the\n * per-offer card (see `buildOfferCard`).\n *\n * v1 `layout` is per-breakpoint; CAB has none, so the converter collapses to\n * the largest provided breakpoint. A widget-level discount lands on the data\n * source's `discount` field (what the extension prices cards from) plus a\n * config-only `discount` section, and an opt-in undo `banner` is appended after\n * the data source (discount above, banner pinned last) when each is configured.\n */\nexport const convertOfferToV2 = ({ id, name, settings }: V1OfferConvertInput): CABRootSection => {\n const layout = settings.layout?.large ?? settings.layout?.medium ?? settings.layout?.small;\n const columns = layout?.columns ?? 1;\n const direction = directionForStyle(layout?.style);\n const listLayout = buildProductListLayout(direction, columns);\n\n // The card orientation is the inverse of the product-list orientation: vertically-stacked\n // products (`rows`) carry a compact horizontal card (image | info | add); side-by-side products\n // (`grid`/`columns`) carry a narrow vertical card (image \u2192 info \u2192 add).\n const horizontalCard = direction === 'rows';\n\n const discount = dataSourceDiscount(settings.discount);\n\n const dataSource = {\n ...(settings.endpoint && { dataSourcePath: settings.endpoint }),\n ...(discount && { discount }),\n ...(settings.integrations && { integrations: coerceIntegrations(settings.integrations) }),\n ...(settings.limit !== undefined && { limit: settings.limit }),\n matchVariant: !!settings.productOptions?.matchVariant,\n matchVariantOutOfStock: !!settings.productOptions?.matchVariantOutOfStock,\n ...(settings.productType && { productType: settings.productType }),\n sectionType: 'dataSource',\n ...(settings.subscriptionIsDefault && { subscriptionIsDefault: true }),\n ...(settings.treatAsGwp && { treatAsGwp: true }),\n };\n\n // The visible card sections come first so their indices stay contiguous from\n // the top (the admin UI prepends newly-added visible sections). The trailing\n // config-only sections are never rendered per-card: data source (engine fetch\n // config), then the optional discount, then the undo banner pinned to the very\n // bottom. `offers` keeps the default `rows` direction; the card's own\n // orientation is baked into the sections `buildOfferCard` returns.\n const offers = {\n sections: [\n ...buildOfferCard(settings, horizontalCard),\n dataSource,\n ...buildDiscountSection(settings.discount),\n ...buildBanner(settings.language),\n ],\n sectionType: 'offers',\n };\n\n // Offers ALWAYS live inside a `carousel` section \u2014 it's the structural wrapper the CAB offers\n // architecture requires, regardless of whether the widget actually paginates (the name is\n // historical). It only shows pagination when there are more products than `itemsAtOnce`, so a\n // non-carousel v1 widget sets `itemsAtOnce` to the full limit and shows everything at once. The\n // product-list layout (direction/grid from the v1 style + columns) rides on this wrapper.\n const display = {\n autoAdvanceInterval: 0,\n // `itemsAtOnce` feeds the carousel schema's `.min(1)`; a legacy `columns`/`limit` of 0 would\n // otherwise throw at parse, so floor it at 1 (the carousel still shows a product per page).\n itemsAtOnce: Math.max(layout?.carousel ? columns : (settings.limit ?? columns), 1),\n ...listLayout,\n sections: [offers],\n sectionType: 'carousel',\n };\n\n return CABRootSection.parse({\n direction: 'rows',\n editorMode: LOCATION_TO_EDITOR_MODE[settings.location ?? 'checkout'],\n // The widget name is required by the admin save schema; carry the legacy widget's name through.\n ...(name && { name }),\n previewMode: settings.previewMode,\n sections: [\n ...(hasHeaderText(settings.language)\n ? [{ content: { en: convertContentBlockTextToV2(settings.language) }, sectionType: 'text' }]\n : []),\n display,\n ],\n tracking: {\n enableAttribution: settings.tracking?.enableAttribution ?? true,\n enableSource: settings.tracking?.enableSource ?? true,\n enableWidget: settings.tracking?.enableWidget ?? true,\n },\n type: SHOPIFY_CHECKOUT_EXTENSION,\n version: 2,\n widgetId: id,\n });\n};\n", "import { type z } from 'zod';\n\nimport { convertNumericObjects } from '~/transforms/convertNumericObjects';\nimport { deepCamelCase } from '~/transforms/deepCamelCase';\n\n/**\n * Runs the shielded-CDN response through the canonical pipeline:\n *\n * raw \u2192 deepCamelCase \u2192 convertNumericObjects \u2192 transform? \u2192 schema.parse\n *\n * `schema.parse` hydrates `.default(...)` values and surfaces any drift as a\n * ZodError. The optional `transform` step is for normalization that must run\n * before* validation \u2014 e.g. converting HTML-laden text content into Tiptap\n * documents (since the canonical CAB schema rejects HTML strings outright).\n *\n * @param schema - The canonical Zod schema to validate against.\n * @param raw - Untrusted upstream JSON.\n * @param transform - Optional pre-parse transform (defaults to identity).\n *\n * @returns The parsed-and-default-hydrated `z.infer<S>`.\n */\nexport const parseShielded = <S extends z.ZodType>(\n schema: S,\n raw: unknown,\n transform: (input: unknown) => unknown = (input) => input\n): z.infer<S> => schema.parse(transform(convertNumericObjects(deepCamelCase(raw))));\n", "export const UI_EXTENSION_PROGRESS_BAR = 'ui_extension_progress_bar' as const;\n\n/**\n * Per-currency free-shipping thresholds as production actually writes them: each amount is a FLAT sibling\n * key (CENTS, ISO code any casing) alongside `enabled`, while `currencies` is the admin's array of enabled\n * code strings \u2014 NOT a code\u2192amount map. The onsite reader indexes it flat (`presentment[code]`), same as the\n * smart-cart tier shape.\n */\nexport type V1PresentmentCurrencies = {\n [code: string]: number | string | string[] | boolean | undefined;\n currencies?: string[];\n enabled?: boolean;\n};\n\nexport type V1ProgressBarSettings = {\n barSettings: {\n barType: 'shipping' | 'smart-cart';\n configLabelsAndText?: {\n /** v1 field name carries this typo. Supports `{{remaining_amount}}`. */\n amoundRemaining?: string;\n amountReached?: string;\n };\n countryCodes?: string[];\n freeShippingOptions?: {\n freeShippingOnAll?: boolean;\n freeShippingOnSubscriptions?: boolean;\n presentmentCurrencies?: V1PresentmentCurrencies;\n };\n limitCountries?: boolean;\n /** Shop-currency DOLLARS (e.g. 75 for $75). */\n unlockPrice?: number;\n };\n location?: 'checkout' | 'order-status' | 'thank-you';\n previewMode?: boolean;\n type: typeof UI_EXTENSION_PROGRESS_BAR;\n version: 1;\n};\n\nexport type V1ProgressBarConvertInput = {\n id: number;\n /** The shop theme's `buttonBackground` (bar fill), resolved by the caller; stays absent when unresolved. */\n progressColor?: string;\n settings: V1ProgressBarSettings;\n};\n\nexport const isProgressBarV1 = (data: unknown): data is V1ProgressBarSettings => {\n if (!data || typeof data !== 'object') return false;\n\n const obj = data as Record<string, unknown>;\n\n return (\n obj.version === 1 &&\n obj.type === UI_EXTENSION_PROGRESS_BAR &&\n !!obj.barSettings &&\n typeof obj.barSettings === 'object'\n );\n};\n\n/**\n * Only `barType: 'shipping'` carries its full config in the widget settings.\n * Smart-cart bars reference settings that live in the smart-cart config (a\n * separate fetch in the old runtime) \u2014 they pass through unconverted until a\n * server-side source for that config exists.\n */\nexport const isConvertibleProgressBarV1 = (data: unknown): data is V1ProgressBarSettings =>\n isProgressBarV1(data) && data.barSettings.barType === 'shipping';\n", "import { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { normalizeTextContent } from '~/transforms/normalizeTextContent';\nimport { normalizeTokens } from '~/transforms/normalizeTokens';\nimport {\n UI_EXTENSION_PROGRESS_BAR,\n type V1PresentmentCurrencies,\n type V1ProgressBarConvertInput,\n} from '~/transforms/progressBarV1/types';\n\nconst LOCATION_TO_EDITOR_MODE = {\n checkout: 'checkoutExtension',\n 'order-status': 'orderStatusPage',\n 'thank-you': 'thankYouPage',\n} as const;\n\nconst DEFAULT_REMAINING = 'Spend {{remainingAmount}} more to unlock free shipping!';\nconst DEFAULT_REACHED = \"Congratulations! You've unlocked free shipping!\";\n\n/**\n * Lowercased per-currency thresholds (cents) harvested from the FLAT presentment keys as production writes\n * them (`{ enabled, currencies: ['cad'], cad: 9900 }`) \u2014 `currencies` is the admin's enabled-code ARRAY, not\n * a code\u2192amount map, so amounts sit as flat siblings. Drops `enabled`, `currencies`, and malformed values.\n * Mirrors the onsite reader (`presentment[code]`) and the smart-cart tier converter.\n */\nconst toThresholds = (presentment?: V1PresentmentCurrencies): Record<string, number> => {\n if (!presentment?.enabled) return {};\n\n const thresholds: Record<string, number> = {};\n\n for (const [code, cents] of Object.entries(presentment)) {\n if (code === 'enabled' || code === 'currencies') continue;\n\n const value = Math.round(Number(cents));\n\n if (Number.isFinite(value) && value >= 0) thresholds[code.toLowerCase()] = value;\n }\n\n return thresholds;\n};\n\ntype TextSectionInput = Record<string, unknown>;\n\n/**\n * The progress-bar widget layout blueprint (decided 2026-06-12): a `rows`\n * layout with the progress bar in the first row, a `columns` layout of the\n * tiers' labels in the second row (omitted when no tier has a label), and any\n * other labels as further rows. The v1 SHIPPING bar has a single unlabeled\n * tier, so it emits just the bar row \u2014 the multi-tier smart-cart conversion\n * reuses this builder when its settings source exists.\n */\nexport const buildProgressBarLayout = (\n progressBar: Record<string, unknown>,\n tierLabels: TextSectionInput[],\n extraRows: TextSectionInput[] = []\n) => ({\n direction: 'rows',\n sections: [\n progressBar,\n ...(tierLabels.length > 0 ? [{ direction: 'columns', sections: tierLabels, sectionType: 'layout' }] : []),\n ...extraRows,\n ],\n sectionType: 'layout',\n});\n\n/**\n * `freeShippingOnAll` maps to a zero threshold (always reached). `freeShippingOnSubscriptions` rides on the\n * section so the client treats the bar as reached when the cart holds a subscription item (a live-cart\n * condition the server can't precompute).\n */\nexport const convertProgressBarToV2 = ({ id, progressColor, settings }: V1ProgressBarConvertInput): CABRootSection => {\n const { barSettings } = settings;\n const labels = barSettings.configLabelsAndText;\n const alwaysReached = barSettings.freeShippingOptions?.freeShippingOnAll === true;\n\n const progressBar = {\n /**\n * `limit_countries` enabled with an EMPTY list hid the bar everywhere in React (country \u2208 []\n * is never true), but the schema reads an empty countryCodes as UNRESTRICTED \u2014 that\n * misconfiguration would flip the bar visible. 'XX' (ISO 3166 user-assigned, never a real\n * buyer country) preserves the hide-everywhere reading without a schema change.\n */\n countryCodes: barSettings.limitCountries\n ? barSettings.countryCodes?.length\n ? barSettings.countryCodes\n : ['XX']\n : [],\n freeShippingOnSubscription: barSettings.freeShippingOptions?.freeShippingOnSubscriptions === true,\n ...(progressColor && { progressColor }),\n sections: [\n {\n buttonField: 'progressRemaining',\n content: { en: normalizeTokens(labels?.amoundRemaining || DEFAULT_REMAINING, ['remainingAmount']) },\n sectionType: 'text',\n },\n {\n buttonField: 'progressReached',\n content: { en: labels?.amountReached || DEFAULT_REACHED },\n sectionType: 'text',\n },\n ],\n sectionType: 'progressBar',\n tiers: [\n {\n threshold: alwaysReached ? 0 : Math.round((Number(barSettings.unlockPrice) || 0) * 100),\n thresholds: alwaysReached ? {} : toThresholds(barSettings.freeShippingOptions?.presentmentCurrencies),\n tierType: 'shipping',\n },\n ],\n };\n\n /** Merchant copy can carry HTML \u2014 the canonical pipeline converts it to Tiptap BEFORE the parse. */\n return CABRootSection.parse(\n normalizeTextContent({\n ...buildProgressBarLayout(progressBar, []),\n editorMode: LOCATION_TO_EDITOR_MODE[settings.location ?? 'checkout'],\n previewMode: settings.previewMode,\n type: UI_EXTENSION_PROGRESS_BAR,\n version: 2,\n widgetId: id,\n })\n );\n};\n", "import { type SmartCartBar, type SmartCartTier } from '~/schema/smartCart';\nimport { CABProgressTier } from '~/schema/widgets/checkout-and-beyond/progressBar';\nimport { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { normalizeTextContent } from '~/transforms/normalizeTextContent';\nimport { normalizeTokens } from '~/transforms/normalizeTokens';\nimport { UI_EXTENSION_PROGRESS_BAR, type V1ProgressBarSettings } from '~/transforms/progressBarV1/types';\n\nconst LOCATION_TO_EDITOR_MODE = {\n checkout: 'checkoutExtension',\n 'order-status': 'orderStatusPage',\n 'thank-you': 'thankYouPage',\n} as const;\n\nconst DEFAULT_REMAINING = 'Spend {{remainingAmount}} more to unlock your reward!';\nconst DEFAULT_REACHED = \"Congratulations! You've unlocked your reward!\";\n\n/** All four onsite tier types render at checkout (discount/decorative migrated per the P12 re-scope). */\nconst IN_SCOPE_TIER_TYPES = new Set(['decorative', 'discount', 'product', 'shipping']);\n\nconst inScope = (tier: SmartCartTier): boolean => IN_SCOPE_TIER_TYPES.has(tier.type ?? '');\n\ntype TierType = 'decorative' | 'discount' | 'product' | 'shipping';\n\n/** The tier's `CABProgressTier` type \u2014 its config `type` when one of the four, else `product`. */\nconst tierTypeOf = (tier: SmartCartTier): TierType =>\n tier.type === 'shipping' || tier.type === 'discount' || tier.type === 'decorative' ? tier.type : 'product';\n\n/** The tier's threshold in its own unit: a raw item count for `item_quantity` tiers, shop-currency cents otherwise. */\nconst thresholdOf = (tier: SmartCartTier): number =>\n tier.unlockConditionType === 'item_quantity'\n ? Math.round(tier.minimum ?? 0)\n : Math.round((tier.minimum ?? 0) * 100);\n\n/**\n * Smart-cart tiers key per-currency thresholds as FLAT siblings on `presentmentCurrencies`\n * (`{ enabled, usd: 5000, \u2026 }`) \u2014 the same flat shape the shipping bar's `toThresholds` reads (that one\n * also carries a `currencies` code array). Returns lowercased ISO \u2192 cents, dropping `enabled` and malformed values.\n */\nconst tierThresholds = (tier: SmartCartTier): Record<string, number> => {\n const presentment = tier.presentmentCurrencies;\n\n if (!presentment?.enabled) return {};\n\n const thresholds: Record<string, number> = {};\n\n for (const [code, cents] of Object.entries(presentment)) {\n if (code === 'enabled') continue;\n\n const value = Math.round(Number(cents));\n\n if (Number.isFinite(value) && value >= 0) thresholds[code.toLowerCase()] = value;\n }\n\n return thresholds;\n};\n\n/**\n * The onsite `getTierLabel` step-row label (blank \u2192 no label under the icon): the merchant custom label\n * (always used for `decorative`), else the type default \u2014 'Free Shipping', the discount amount\n * (`{n}% Discount`, or `{{discountAmount}} Off` whose fixed amount the client resolves FX-aware per tier),\n * or the gift product title / 'Free Product'. Plain text \u2014 the compact step label is not rich copy.\n */\nconst tierLabel = (tier: SmartCartTier): string => {\n const type = tierTypeOf(tier);\n\n if ((tier.customTierLabel || type === 'decorative') && tier.customTierLabelText) return tier.customTierLabelText;\n\n if (type === 'decorative') return tier.customTierLabelText ?? '';\n\n if (type === 'shipping') return 'Free Shipping';\n\n if (type === 'discount')\n return tier.discountType === 'fixedAmount'\n ? '{{discountAmount}} Off'\n : `${tier.discountAmountFromTotal ?? 0}% Discount`;\n\n return tier.products?.[0]?.title ?? tier.allProducts?.[0]?.title ?? 'Free Product';\n};\n\n/**\n * The order-discount reward on a `discount` tier, carried so the client resolves `{{discountAmount}}`:\n * `fixedAmount` in shop-currency CENTS (FX-scaled client-side like the threshold), else the raw percent.\n */\nconst discountOf = (tier: SmartCartTier) => {\n if (tier.type !== 'discount') return undefined;\n\n const amount = tier.discountAmountFromTotal ?? 0;\n\n return tier.discountType === 'fixedAmount'\n ? { amount: Math.round(amount * 100), type: 'fixedAmount' as const }\n : { amount, type: 'percentage' as const };\n};\n\n/** The gift reward for a product tier (the first configured product), or undefined for shipping / unset. */\nconst giftOf = (tier: SmartCartTier) => {\n if (tier.type !== 'product') return undefined;\n\n const product = tier.products?.[0] ?? tier.allProducts?.[0];\n\n if (!product) return undefined;\n\n const productId = product.productId ?? product.id;\n\n if (productId === undefined) return undefined;\n\n return {\n productId,\n title: product.title,\n // One junk (non-positive) variant id must not fail the whole tier's schema \u2014 drop only the bad ids.\n variantIds: (product.variantIds ?? []).filter((id) => Number.isInteger(id) && id > 0),\n };\n};\n\n/**\n * A tier \u2192 its `CABProgressTier` metadata on the bar (threshold/gift/tierType/unit \u2014 NOT visual\n * content). Units resolve PER TIER (onsite `getTierMinimum`): an `item_quantity` tier's minimum is a\n * raw item count checked BEFORE any money handling \u2014 no \u00D7100, no presentment overrides (rounded only\n * because the schema pins counts to integers; onsite compares the raw value, so an integer count is\n * identical and junk fractional data degrades to the nearest count instead of a parse failure).\n */\nconst toTierMeta = (tier: SmartCartTier) => {\n const discount = discountOf(tier);\n const gift = giftOf(tier);\n const isItemCount = tier.unlockConditionType === 'item_quantity';\n const label = tierLabel(tier);\n const type = tierTypeOf(tier);\n\n return {\n ...(discount && { discount }),\n ...(gift && { gift }),\n ...(label && { label: { en: label } }),\n threshold: thresholdOf(tier),\n thresholds: !isItemCount && type === 'shipping' ? tierThresholds(tier) : {},\n ...(tier.id && { tierId: tier.id }),\n tierType: type,\n ...(isItemCount && { unit: 'item' }),\n };\n};\n\n/**\n * The renderable tiers of a bar: in scope (one of the four types) AND whose built `CABProgressTier` meta\n * passes the strict schema. A tier whose meta would fail (negative threshold, non-positive gift id, \u2026) is\n * dropped here rather than thrown by the final `CABRootSection.parse` \u2014 keeping the widget fail-safe against\n * numerically-valid-but-out-of-domain values that the loose `SmartCartTier` schema lets through.\n */\nconst renderableTiers = (bar: SmartCartBar): SmartCartTier[] =>\n (bar.tiers ?? []).filter((tier) => inScope(tier) && CABProgressTier.safeParse(toTierMeta(tier)).success);\n\nconst PRODUCT_TOKENS = ['productTitle', 'remainingAmount'];\nconst DISCOUNT_TOKENS = ['discountAmount', 'remainingAmount'];\nconst DECORATIVE_TOKENS = ['remainingAmount'];\n\ntype TierCopy = {\n reached?: boolean;\n reachedText?: string;\n remaining?: boolean;\n remainingText?: string;\n tokens: string[];\n};\n\n/** onsite's per-tier feedback copy for a non-shipping tier (shipping uses the bar-level free-shipping pair). */\nconst tierCopy = (tier: SmartCartTier): TierCopy => {\n switch (tierTypeOf(tier)) {\n case 'discount':\n return {\n reached: tier.discountAmountReachedLabel,\n reachedText: tier.discountAmountReachedLabelText,\n remaining: tier.discountAmountRemainingLabel,\n remainingText: tier.discountAmountRemainingLabelText,\n tokens: DISCOUNT_TOKENS,\n };\n case 'decorative':\n return {\n reached: tier.decorativeAmountReachedLabel,\n reachedText: tier.decorativeAmountReachedLabelText,\n remaining: tier.decorativeAmountRemainingLabel,\n remainingText: tier.decorativeAmountRemainingLabelText,\n tokens: DECORATIVE_TOKENS,\n };\n default:\n return {\n reached: tier.productAmountReachedLabel,\n reachedText: tier.productAmountReachedLabelText,\n remaining: tier.productAmountRemainingLabel,\n remainingText: tier.productAmountRemainingLabelText,\n tokens: PRODUCT_TOKENS,\n };\n }\n};\n\n/**\n * Per-tier feedback `text` sections (onsite `getTierFeedbackText`/`getTierCompletedText`): one for the\n * remaining prompt, one for the reached prompt, each tagged with the tier's id so the renderer shows it\n * only while that tier is the active one \u2014 falling back to the bar-level pair when a tier's copy is\n * blank/disabled (F-05). O-B3 is NOT replicated: the remaining prompt uses the remaining field, never the\n * reached one. Shipping tiers (and tiers with no id) emit nothing; the bar-level pair speaks for them.\n */\nconst toTierFeedback = (tier: SmartCartTier) => {\n if (tierTypeOf(tier) === 'shipping' || !tier.id) return [];\n\n const copy = tierCopy(tier);\n const meta = { threshold: thresholdOf(tier), tierId: tier.id, tierType: tierTypeOf(tier) };\n const sections: Record<string, unknown>[] = [];\n\n if (copy.remaining && copy.remainingText)\n sections.push({\n buttonField: 'progressRemaining',\n content: { en: normalizeTokens(copy.remainingText, copy.tokens) },\n sectionType: 'text',\n tier: meta,\n });\n\n if (copy.reached && copy.reachedText)\n sections.push({\n buttonField: 'progressReached',\n content: { en: normalizeTokens(copy.reachedText, copy.tokens) },\n sectionType: 'text',\n tier: meta,\n });\n\n return sections;\n};\n\n/**\n * A bar + its in-scope tiers \u2192 a self-contained `progressBar` container (a `rows` layout): the tier display\n * (if any) and the reached/remaining copy as children, the milestones on `tiers`. The renderer adds the bar\n * fill + active message; the country/FX gate covers the whole thing since it's one section. The caller\n * (`dedupeBars`) decides `countryCodes`/`excludeCountryCodes` so the rendered set matches React `getbar`.\n */\nconst toProgressBarSection = (\n bar: SmartCartBar,\n tiers: SmartCartTier[],\n countryCodes: string[],\n excludeCountryCodes: string[],\n progressColor?: string\n) => ({\n countryCodes,\n direction: 'rows',\n excludeCountryCodes,\n /** Discount tiers force the pre-discount subtotal so the tier's own reward can't un-reach it (F-08). */\n excludeDiscountInSubtotal:\n (bar.excludeDiscountInSubtotal ?? false) || tiers.some((tier) => tier.type === 'discount'),\n // Bar-level ids (not covered by the per-tier safeParse): drop non-positive ones so one junk id can't\n // fail `excludedVariantIds`' strict `.int().positive()` schema and 500 the whole widget.\n excludedVariantIds: (bar.excludedProducts ?? [])\n .flatMap((product) => product.variantIds ?? [])\n .filter((id) => Number.isInteger(id) && id > 0),\n freeShippingOnSubscription: bar.freeShippingOnSubscription ?? false,\n /** Absent \u21D2 omit so the section schema's `.default({ en: 'FREE GIFTS' })` is the single source of the fallback. */\n ...(bar.language?.giftAreaTitle && { giftAreaTitle: { en: bar.language.giftAreaTitle } }),\n ...(progressColor && { progressColor }),\n sections: [\n ...tiers.flatMap(toTierFeedback),\n {\n buttonField: 'progressRemaining',\n // Token-normalized here; any HTML in the copy is coerced to Tiptap by the text schema on parse.\n // `productTitle` resolves client-side to the active tier's gift (`{{product_title}}` parity).\n content: {\n en: normalizeTokens(bar.language?.freeShippingRemaining || DEFAULT_REMAINING, [\n 'productTitle',\n 'remainingAmount',\n ]),\n },\n sectionType: 'text',\n },\n {\n buttonField: 'progressReached',\n // `remainingAmount` normalized too (F24) \u2014 onsite reached copy can carry `{{remaining_amount}}`.\n content: {\n en: normalizeTokens(bar.language?.freeShippingReached || DEFAULT_REACHED, [\n 'productTitle',\n 'remainingAmount',\n ]),\n },\n sectionType: 'text',\n },\n ],\n sectionType: 'progressBar',\n tiers: tiers.map(toTierMeta),\n});\n\ntype BarEntry = { bar: SmartCartBar; tiers: SmartCartTier[] };\ntype RenderedBar = { countryCodes: string[]; entry: BarEntry; excludeCountryCodes: string[] };\n\n/** A bar's country codes, uppercased + de-duplicated (empty when unset). */\nconst barCountries = (bar: SmartCartBar): string[] => [\n ...new Set((bar.countryCodes ?? []).map((code) => code.trim().toUpperCase()).filter(Boolean)),\n];\n\n/**\n * Decide each bar's country gate to mirror React `getbar`, which renders exactly ONE bar per country: a geo\n * bar owns only the countries no EARLIER geo bar already claimed \u2014 and drops when it has none left (including\n * a geo bar that lists no countries, which `getbar` never matches); only the FIRST default (non-geo) bar\n * renders, gated to hide wherever any geo bar applies. Returns the bars that render, in order, with gates.\n *\n * A geo bar CLAIMS (shadows) its countries even when it has no renderable tiers \u2014 so an unrenderable geo bar\n * still hides the default (and any later geo bar) there, matching `getbar` one-bar-per-country precedence \u2014\n * but such a shadowing-only bar is not itself pushed (it renders nothing). Likewise an empty default never\n * consumes the default slot: the first default WITH tiers wins.\n */\nconst dedupeBars = (entries: BarEntry[]): RenderedBar[] => {\n const geoCountries = [\n ...new Set(entries.filter((entry) => entry.bar.geolocationEnabled).flatMap((entry) => barCountries(entry.bar))),\n ];\n const claimed = new Set<string>();\n const rendered: RenderedBar[] = [];\n let defaultUsed = false;\n\n for (const entry of entries) {\n if (entry.bar.geolocationEnabled) {\n const own = barCountries(entry.bar).filter((code) => !claimed.has(code));\n\n if (own.length === 0) continue;\n\n own.forEach((code) => claimed.add(code));\n\n if (entry.tiers.length > 0) rendered.push({ countryCodes: own, entry, excludeCountryCodes: [] });\n } else if (!defaultUsed && entry.tiers.length > 0) {\n defaultUsed = true;\n rendered.push({ countryCodes: [], entry, excludeCountryCodes: geoCountries });\n }\n }\n\n return rendered;\n};\n\n/**\n * Converts a smart-cart progress-bar widget into a CAB tree: a `rows` layout holding one self-contained\n * `progressBar` container per configured bar (tiers come from the shop's smart-cart config \u2014 see\n * `extractSmartCartBars`). Each container holds its tier display (composable `columns \u2192 rows \u2192 text/image`)\n * + copy as children, with milestones on `tiers` (server-precomputed per tier: cents \u2014 base +\n * per-presentment-currency for shipping tiers \u2014 or a raw item count for `item_quantity` tiers) so the\n * client only compares each tier against its own unit's progress, mirroring the shipping bar. DISPLAY\n * ONLY \u2014 gift add/remove is a later stage. Tiers whose meta fails the strict schema are dropped (never\n * thrown); a bar left with no renderable tier renders nothing \u2014 but a geo bar still shadows its countries\n * (so the default can't leak into them) even when it renders nothing.\n */\nexport const convertSmartCartProgressBarToV2 = (input: {\n bars: SmartCartBar[];\n id: number;\n /** The shop theme's `buttonBackground` (bar fill), resolved by the caller; schema-defaulted when absent. */\n progressColor?: string;\n settings: V1ProgressBarSettings;\n}): CABRootSection => {\n // NOT pre-filtered by renderable tiers: `dedupeBars` must see every geo bar so an unrenderable one\n // still claims (shadows) its countries; it only pushes bars that actually have tiers to render.\n const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar) }));\n\n const sections = dedupeBars(entries).map(({ countryCodes, entry, excludeCountryCodes }) =>\n toProgressBarSection(entry.bar, entry.tiers, countryCodes, excludeCountryCodes, input.progressColor)\n );\n\n /** Merchant copy/labels can carry HTML \u2014 the canonical pipeline converts it to Tiptap BEFORE the parse. */\n return CABRootSection.parse(\n normalizeTextContent({\n direction: 'rows',\n editorMode: LOCATION_TO_EDITOR_MODE[input.settings.location ?? 'checkout'],\n previewMode: input.settings.previewMode,\n sections,\n sectionType: 'layout',\n type: UI_EXTENSION_PROGRESS_BAR,\n version: 2,\n widgetId: input.id,\n })\n );\n};\n", "import { type SmartCartBar, type SmartCartConfig } from '~/schema/smartCart';\n\n/** Component `type` value that carries the checkout smart-cart progress-bar tiers. */\nexport const SMART_CART_TIERED_PROGRESS_BAR = 'tiered_progress_bar' as const;\n\n/**\n * Pulls the progress-bar bars out of a shop's smart-cart config: the first\n * `tiered_progress_bar` component's `settings.bars`. Returns `[]` when smart cart is\n * absent / disabled / has no such component \u2014 the caller then renders nothing, matching\n * the legacy runtime (which only shows a smart-cart bar when one is configured).\n *\n * One bar per geo segment is returned as-is; country selection happens downstream via\n * each bar's `countryCodes` gate (parity with the shipping bar \u2014 no buyer country is\n * known at conversion time).\n */\nexport const extractSmartCartBars = (smartCart: SmartCartConfig | null | undefined): SmartCartBar[] => {\n const component = smartCart?.components?.find((entry) => entry.type === SMART_CART_TIERED_PROGRESS_BAR);\n\n return component?.settings?.bars ?? [];\n};\n"],
|
|
5
|
-
"mappings": ";AAAA,SAAS,MAAMA,gBAAc;AAC7B,SAAS,KAAAC,WAAS;;;ACDX,IAAM,aAAa,CAA8B,WACpD,OAAO,OAAO,OAAO,YAAY,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAExD,IAAM,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W,UAAU,QAAQ,CAAC;AACzC;",
|
|
4
|
+
"sourcesContent": ["import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { buttonFields, ObjectFit, objectFits, SectionType } from './common';\nimport { DYNAMIC_TOKEN_REGEX } from './regex';\nimport { CABRule } from './rule';\nimport { CABBorder, type SectionDetails } from './shared';\nimport { checkForHTML, NO_HTML } from './utils';\n\nexport const CABImageSection = z.object({\n altText: z.string().refine(checkForHTML, NO_HTML).default(''),\n aspectRatio: z.literal(1).nullable().default(null),\n border: z.lazy(() => CABBorder),\n buttonField: z.enum(buttonFields).optional(),\n category: z.enum(['gallery', 'icons', 'payment-methods', 'secure-checkout']).nullable().default(null),\n name: z.string().optional(),\n naturalHeight: z.number().default(0),\n naturalWidth: z.number().default(0),\n /**\n * `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and\n * `cover` would crop non-square art (payment badges lost their edges \u2014 15993); `contain` letterboxes.\n */\n objectFit: z.enum(objectFits).default(ObjectFit.contain),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.image).default(SectionType.image),\n source: z.union([z.url(), z.literal(''), z.string().regex(DYNAMIC_TOKEN_REGEX)]).default(''),\n width: z.number().default(100),\n});\n\nexport type CABImageSection = z.infer<typeof CABImageSection>;\n\nexport type CABImageSectionProps = CABImageSection & SectionDetails;\n", "export const freezeEnum = <T extends readonly string[]>(values: T) =>\n Object.freeze(Object.fromEntries(values.map((v) => [v, v]))) as { readonly [K in T[number]]: K };\n\nexport const bannerColors = ['info', 'success', 'warning', 'critical'] as const;\nexport const BannerColor = freezeEnum(bannerColors);\nexport type BannerColor = (typeof bannerColors)[number];\n\nexport const borderRadii = ['none', 'small', 'base', 'large', 'fullyRounded'] as const;\nexport const BorderRadius = freezeEnum(borderRadii);\nexport type BorderRadius = (typeof borderRadii)[number];\n\nexport const borderStyles = ['none', 'base', 'dotted', 'dashed'] as const;\nexport const BorderStyle = freezeEnum(borderStyles);\nexport type BorderStyle = (typeof borderStyles)[number];\n\nexport const borderWidths = ['base', 'medium', 'thick'] as const;\nexport const BorderWidth = freezeEnum(borderWidths);\nexport type BorderWidth = (typeof borderWidths)[number];\n\nexport const buttonActions = [\n 'acceptOffer',\n 'addToOrder',\n 'declineAllOffers',\n 'declineOffer',\n 'displayContentInModal',\n 'displayContentInPopover',\n 'goToNextPage',\n 'goToPrevPage',\n 'goToURL',\n 'removeFromOrder',\n 'selectVariant',\n 'showPagination',\n 'switchToSubscription',\n 'undoAddToOrder',\n] as const;\n\nexport const ButtonAction = freezeEnum(buttonActions);\nexport type ButtonAction = (typeof buttonActions)[number];\n\nexport const buttonFields = [\n 'activePage',\n 'addedToCart',\n 'addingToCart',\n 'addToCart',\n 'buttonLabel',\n 'declineAllOffers',\n 'declineOffer',\n 'destinationUrl',\n 'inactivePage',\n 'overlayContent',\n 'payNow',\n 'progressReached',\n 'progressRemaining',\n 'redirectToCheckout',\n 'removeFromOrder',\n 'showVariant',\n 'showVariants',\n 'soldOut',\n 'subscriptionOption',\n 'switchToOneTimePurchase',\n 'switchToSubscriptionNoDiscount',\n 'switchToSubscriptionWithDiscount',\n 'undoAddToOrder',\n] as const;\n\nexport const ButtonField = freezeEnum(buttonFields);\nexport type ButtonField = (typeof buttonFields)[number];\n\nexport const buttonStyles = ['primary', 'secondary', 'plain', 'custom'] as const;\nexport const ButtonStyle = freezeEnum(buttonStyles);\nexport type ButtonStyle = (typeof buttonStyles)[number];\n\nexport const directions = ['columns', 'rows', 'grid'] as const;\nexport const Direction = freezeEnum(directions);\nexport type Direction = (typeof directions)[number];\n\nexport const discountSources = ['price', 'compare_at_price'] as const;\nexport const DiscountSource = freezeEnum(discountSources);\nexport type DiscountSource = (typeof discountSources)[number];\n\nexport const discountTypes = ['none', 'percentage', 'fixed', 'fixed_amount'] as const;\nexport const DiscountType = freezeEnum(discountTypes);\nexport type DiscountType = (typeof discountTypes)[number];\n\nexport const editorModes = [\n 'checkoutExtension',\n 'postPurchaseOffer',\n 'thankYouPage',\n 'orderStatusPage',\n 'ordersIndexPage',\n 'customerProfilePage',\n] as const;\n\nexport const EditorMode = freezeEnum(editorModes);\nexport type EditorMode = (typeof editorModes)[number];\n\nexport const horizontalAlignments = ['start', 'center', 'end'] as const;\nexport const HorizontalAlignment = freezeEnum(horizontalAlignments);\nexport type HorizontalAlignment = (typeof horizontalAlignments)[number];\n\nexport const languageKeys = [\n 'ar',\n 'cs',\n 'da',\n 'de',\n 'en',\n 'es',\n 'fi',\n 'fr',\n 'ga',\n 'he',\n 'hi',\n 'id',\n 'it',\n 'ja',\n 'ko',\n 'nl',\n 'no',\n 'pl',\n 'pt',\n 'ru',\n 'sv',\n 'th',\n 'tr',\n 'uk',\n 'vi',\n 'zh',\n] as const;\n\nexport const LanguageKey = freezeEnum(languageKeys);\nexport type LanguageKey = (typeof languageKeys)[number];\n\nexport const objectFits = ['cover', 'contain'] as const;\nexport const ObjectFit = freezeEnum(objectFits);\nexport type ObjectFit = (typeof objectFits)[number];\n\nexport const popoverPositions = ['inlineStart', 'inlineEnd', 'blockStart', 'blockEnd'] as const;\nexport const PopoverPosition = freezeEnum(popoverPositions);\nexport type PopoverPosition = (typeof popoverPositions)[number];\n\nexport const popoverPositionMap = {\n bottom: 'blockEnd',\n left: 'inlineStart',\n right: 'inlineEnd',\n top: 'blockStart',\n} as const;\n\nexport const productTypes = ['one-time', 'subscription', 'both'] as const;\nexport const ProductType = freezeEnum(productTypes);\nexport type ProductType = (typeof productTypes)[number];\n\nexport const progressTierTypes = ['decorative', 'discount', 'product', 'shipping'] as const;\nexport const ProgressTierType = freezeEnum(progressTierTypes);\nexport type ProgressTierType = (typeof progressTierTypes)[number];\n\nexport const progressTierUnits = ['currency', 'item'] as const;\nexport const ProgressTierUnit = freezeEnum(progressTierUnits);\nexport type ProgressTierUnit = (typeof progressTierUnits)[number];\n\nexport const quantityInputs = ['select', 'number'] as const;\nexport const QuantityInput = freezeEnum(quantityInputs);\nexport type QuantityInput = (typeof quantityInputs)[number];\n\nexport const reviewsSizes = ['small', 'default', 'large'] as const;\nexport const ReviewsSize = freezeEnum(reviewsSizes);\nexport type ReviewsSize = (typeof reviewsSizes)[number];\n\nexport const sectionTypes = [\n 'banner',\n 'button',\n 'carousel',\n 'cartLine',\n 'dataSource',\n 'discount',\n 'image',\n 'layout',\n 'monetize',\n 'offers',\n 'product',\n 'products',\n 'progressBar',\n 'quantity',\n 'reviews',\n 'text',\n 'variants',\n] as const;\n\nexport const SectionType = freezeEnum(sectionTypes);\nexport type SectionType = (typeof sectionTypes)[number];\n\nexport const spacings = ['none', 'extraTight', 'tight', 'base', 'loose', 'extraLoose'] as const;\nexport const Spacing = freezeEnum(spacings);\nexport type Spacing = (typeof spacings)[number];\n\nexport const textAlignments = ['start', 'center', 'end'] as const;\nexport const TextAlignment = freezeEnum(textAlignments);\nexport type TextAlignment = (typeof textAlignments)[number];\n\nexport const textColorNames = ['base', 'subdued', 'accent', 'decorative', 'success', 'warning', 'critical'] as const;\nexport const TextColorName = freezeEnum(textColorNames);\nexport type TextColorName = (typeof textColorNames)[number];\n\nexport const textSizeNames = ['extraSmall', 'small', 'base', 'medium', 'large', 'extraLarge'] as const;\nexport const TextSizeName = freezeEnum(textSizeNames);\nexport type TextSizeName = (typeof textSizeNames)[number];\n\nexport const variantModes = ['multiple', 'single'] as const;\nexport const VariantMode = freezeEnum(variantModes);\nexport type VariantMode = (typeof variantModes)[number];\n\nexport const variantSelectors = ['menu', 'radio', 'button'] as const;\nexport const VariantSelector = freezeEnum(variantSelectors);\nexport type VariantSelector = (typeof variantSelectors)[number];\n\nexport const verticalAlignments = ['top', 'middle', 'bottom'] as const;\nexport const VerticalAlignment = freezeEnum(verticalAlignments);\nexport type VerticalAlignment = (typeof verticalAlignments)[number];\n", "/** Matches a valid array index string (e.g., \"0\", \"1\", \"42\"). */\nexport const ARRAY_INDEX_STRING = /^(0|[1-9]\\d*)$/;\n\n/** Matches a dynamic token. */\nexport const DYNAMIC_TOKEN_REGEX = /^\\{\\{\\s*[A-Za-z]+\\s*\\}\\}$/;\n\n/** Matches a valid hex color code. */\nexport const HEX_COLOR_REGEX = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;\n\n/**\n * Matches a root-relative, same-origin path (single leading slash, e.g. Shopify's\n * `/policies/privacy-policy`). A protocol-relative `//host` is excluded \u2014 it points off-origin.\n */\nexport const ROOT_RELATIVE_PATH_REGEX = /^\\/(?!\\/)/;\n\n/**\n * Matches an HTML-shaped tag: `<` (or `</`) immediately followed by a tag-name letter. This mirrors\n * both the browser `DOMParser` branch of `isHTML` and `stripContentBlockHtml`'s tag regex, so the\n * server-side check agrees with the client and with whatever the sanitizer removes. It deliberately\n * leaves bare comparison brackets alone (`5 < 10 and 10 > 5`) \u2014 those are text, not markup, and the\n * looser `/<\\/?[^>]+>/` it replaced wrongly rejected them and 500'd otherwise-valid content.\n *\n * Keeps the `g` flag because downstream consumers strip ALL tags with `.replace(HTML_TAGS_REGEX, '')`\n * (rebuy-shopify-extensions, admin-nextjs); without it `.replace` would drop only the first tag. The\n * one in-package consumer, `isHTML`, must therefore NOT use `.test()` on it \u2014 a global regex carries a\n * sticky `lastIndex` that makes repeated `.test()` calls flaky. `isHTML` uses `.search()` instead,\n * which ignores and never mutates `lastIndex`.\n */\nexport const HTML_TAGS_REGEX = /<\\/?[a-zA-Z][^>]*>/g;\n", "import { z } from 'zod';\n\nexport const ruleTypes = [\n 'cart',\n 'cart_count',\n 'cart_item_count',\n 'cart_line_count',\n 'cart_subtotal',\n 'collection',\n 'customer',\n 'customer_order_count',\n 'customer_tag',\n 'customer_total_spent',\n 'date',\n 'product',\n 'product_tag',\n 'product_title',\n 'product_type',\n 'product_vendor',\n] as const;\n\nconst ruleType = z.enum(ruleTypes);\n\nexport const RuleType = ruleType.enum;\nexport type RuleType = z.infer<typeof ruleType>;\n\nexport const ruleOperators = [\n 'after',\n 'anything',\n 'before',\n 'contains',\n 'contains_any',\n 'does_not_contain',\n 'does_not_contain_any',\n 'equals',\n 'does_not_equal',\n 'greater_than',\n 'less_than',\n] as const;\n\nconst ruleOperator = z.enum(ruleOperators);\n\nexport const RuleOperator = ruleOperator.enum;\nexport type RuleOperator = z.infer<typeof ruleOperator>;\n\nexport const RuleCondition = z.object({\n operator: z.enum(ruleOperators).default(RuleOperator.anything),\n products: z.union([z.array(z.unknown()), z.strictObject({}).transform(() => [])]).default(() => []),\n type: z.enum(ruleTypes).default(RuleType.cart_subtotal),\n value: z.coerce.string().default(''),\n});\n\nexport type RuleCondition = z.infer<typeof RuleCondition>;\n\nexport const RuleLogicBlock = z.object({\n rules: z.array(RuleCondition).default(() => []),\n});\n\nexport type RuleLogicBlock = z.infer<typeof RuleLogicBlock>;\n\nexport const CABRule = z.object({\n dataSourceId: z.number().nullable().default(null),\n enabled: z.boolean().default(false),\n ruleset: z\n .union([\n z.array(\n z.object({\n exitIfMatched: z.boolean().default(true),\n logic: z.array(RuleLogicBlock).default(() => []),\n output: z\n .array(\n z.object({\n key: z.string().default('should_show'),\n type: z.literal('data_json').default('data_json'),\n value: z.string().default('true'),\n })\n )\n .default(() => [{ key: 'should_show', type: 'data_json' as const, value: 'true' }]),\n })\n ),\n z.strictObject({}).transform(() => []),\n ])\n .default(() => []),\n});\n\nexport type CABRule = z.infer<typeof CABRule>;\n", "import { type FieldArrayPath } from 'react-hook-form';\nimport { z, type ZodType } from 'zod';\n\nimport { CABBannerSection } from './banner';\nimport { CABButtonSection } from './button';\nimport { CABCarouselSection } from './carousel';\nimport { CABCartLineSection } from './cartLine';\nimport { borderRadii, BorderRadius, BorderStyle, borderStyles, BorderWidth, borderWidths } from './common';\nimport { CABDataSourceSection } from './dataSource';\nimport { CABDiscountSection } from './discount';\nimport { CABImageSection } from './image';\nimport { CABLayoutSection } from './layout';\nimport { CABMonetizeSection } from './monetize';\nimport { CABOffersSection } from './offers';\nimport { CABProductSection } from './product';\nimport { CABProductsSection } from './products';\nimport { CABProgressBarSection } from './progressBar';\nimport { CABQuantitySection } from './quantity';\nimport { CABReviewsSection } from './reviews';\nimport { type CABRootSection } from './root';\nimport { CABTextSection } from './text';\nimport { CABVariantsSection } from './variants';\n\nexport const CABBorder = z\n .object({\n radius: z.enum(borderRadii).default(BorderRadius.base),\n style: z.enum(borderStyles).default(BorderStyle.none),\n width: z.enum(borderWidths).default(BorderWidth.base),\n })\n .default({\n radius: BorderRadius.base,\n style: BorderStyle.none,\n width: BorderWidth.base,\n });\n\nexport type CABBorder = z.infer<typeof CABBorder>;\n\nexport const CABSection: ZodType<CABSection> = z.lazy(() =>\n z.discriminatedUnion('sectionType', [\n CABBannerSection,\n CABButtonSection,\n CABCarouselSection,\n CABCartLineSection,\n CABDataSourceSection,\n CABDiscountSection,\n CABImageSection,\n CABLayoutSection,\n CABMonetizeSection,\n CABOffersSection,\n CABProductSection,\n CABProductsSection,\n CABProgressBarSection,\n CABQuantitySection,\n CABReviewsSection,\n CABTextSection,\n CABVariantsSection,\n ])\n);\n\nexport type CABSection =\n | CABBannerSection\n | CABButtonSection\n | CABCarouselSection\n | CABCartLineSection\n | CABDataSourceSection\n | CABDiscountSection\n | CABImageSection\n | CABLayoutSection\n | CABMonetizeSection\n | CABOffersSection\n | CABProductSection\n | CABProductsSection\n | CABProgressBarSection\n | CABQuantitySection\n | CABReviewsSection\n | CABTextSection\n | CABVariantsSection;\n\nexport type SectionId = CABSection['sectionId'];\n\n/* @ts-expect-error: TS2589: Type instantiation _is_ excessively deep and infinite. */\nexport type SectionArrayPath = FieldArrayPath<CABRootSection>;\n\nexport type SectionPrefixPath = `${SectionArrayPath}.${number}` | null;\n\nexport type SectionDetails = {\n /**\n * The full React Hook Form dot-notation path to the section object itself,\n * for use with `register` or `control`, e.g. `sections.0.sections.1`.\n *\n * Returns `null` for the root section.\n */\n fieldArrayPath: SectionArrayPath | null;\n /**\n * The index of the found section within its parent `sections` array.\n *\n * Returns `null` for the root section.\n */\n index: number | null;\n /**\n * The parent `sections` object.\n *\n * Returns `null` for the root section.\n */\n parent: CABSection[] | null;\n /**\n * The parent `sectionId`.\n *\n * Returns `undefined` for the root section.\n */\n parentId: SectionId | undefined;\n /**\n * The full React Hook Form dot-notation path to the section object itself,\n * for use with `register` or `control`, e.g. `sections.0.sections.1`.\n *\n * Returns `null` for the root section.\n */\n prefixPath: SectionPrefixPath | null;\n};\n\nexport type CABSectionProps = CABSection & SectionDetails;\n", "import { z } from 'zod';\n\nimport { bannerColors, buttonFields, SectionType, type BannerColor } from './common';\nimport { CABLayoutSection } from './layout';\nimport { type SectionDetails } from './shared';\n\nexport const CABBannerSection = z.lazy(() =>\n CABLayoutSection.omit({ sectionType: true }).extend({\n buttonField: z.enum(buttonFields).optional(),\n color: z.enum(bannerColors).default('info'),\n dismissible: z.boolean().default(true),\n sectionType: z.literal(SectionType.banner).default(SectionType.banner),\n })\n);\n\nexport type CABBannerSection = Omit<CABLayoutSection, 'sectionType'> & {\n color: BannerColor;\n dismissible: boolean;\n sectionType: 'banner';\n};\n\nexport type CABBannerSectionProps = CABBannerSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport {\n buttonFields,\n Direction,\n directions,\n HorizontalAlignment,\n horizontalAlignments,\n SectionType,\n Spacing,\n spacings,\n VerticalAlignment,\n verticalAlignments,\n type ButtonField,\n} from './common';\nimport { CABRule } from './rule';\nimport { CABBorder, CABSection, type SectionDetails } from './shared';\n\nexport const GridItem = z.union([z.literal('auto'), z.literal('fill'), z.string().regex(/^\\d+%$/), z.number()]);\nexport type GridItem = z.infer<typeof GridItem>;\n\nexport const CABLayoutSection = z.object({\n alignment: z\n .object({\n horizontal: z.enum(horizontalAlignments).default(HorizontalAlignment.start),\n vertical: z.enum(verticalAlignments).default(VerticalAlignment.top),\n })\n .default({\n horizontal: HorizontalAlignment.start,\n vertical: VerticalAlignment.top,\n }),\n border: z.lazy(() => CABBorder),\n buttonField: z.enum(buttonFields).optional(),\n direction: z.enum(directions).default(Direction.rows),\n grid: z\n .object({\n columns: z.union([z.array(GridItem), z.undefined()]).default(() => ['auto']),\n rows: z.union([z.array(GridItem), z.undefined()]).default(() => ['auto']),\n })\n .default({ columns: ['auto'], rows: ['auto'] })\n .optional(),\n name: z.string().optional(),\n padding: z.enum(spacings).default(Spacing.none),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sections: z.union([z.array(z.lazy(() => CABSection)), z.strictObject({}).transform(() => [])]).default(() => []),\n sectionType: z.literal(SectionType.layout).default(SectionType.layout),\n spacing: z.enum(spacings).default(Spacing.base),\n /** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */\n viewUrl: z.string().optional(),\n width: z.number().default(100),\n});\n\nexport type CABLayoutSection = {\n alignment: {\n horizontal: HorizontalAlignment;\n vertical: VerticalAlignment;\n };\n border: CABBorder;\n buttonField?: ButtonField;\n direction: Direction;\n grid?: {\n columns: GridItem[];\n rows: GridItem[];\n };\n name?: string;\n padding: Spacing;\n rule?: CABRule;\n sectionId: string;\n sections: CABSection[];\n sectionType: 'layout';\n spacing: Spacing;\n viewUrl?: string;\n width: number;\n};\n\nexport type CABLayoutSectionProps = CABLayoutSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z, type ZodType } from 'zod';\n\nimport {\n buttonActions,\n ButtonStyle,\n buttonStyles,\n PopoverPosition,\n popoverPositions,\n SectionType,\n TextAlignment,\n textAlignments,\n} from './common';\nimport { CABImageSection } from './image';\nimport { CABLayoutSection } from './layout';\nimport { HEX_COLOR_REGEX } from './regex';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\nimport { CABTextSection } from './text';\n\nexport type CABButtonContent = CABImageSection | CABLayoutSection | CABTextSection;\n\nexport const CABButtonContent: ZodType<CABButtonContent> = z.lazy(() =>\n z.discriminatedUnion('sectionType', [CABImageSection, CABLayoutSection, CABTextSection])\n);\n\nexport const CABButtonSection = z.object({\n action: z.union([z.literal(''), z.enum(buttonActions)]).default(''),\n buttonStyle: z.enum(buttonStyles).default(ButtonStyle.primary),\n custom: z\n .object({\n color: z.string().regex(HEX_COLOR_REGEX).default('#005bd3'),\n height: z.number().default(52),\n width: z.number().default(300),\n })\n .default({\n color: '#005bd3',\n height: 52,\n width: 300,\n }),\n disableDowngrade: z.boolean().default(false),\n name: z.string().optional(),\n optionId: z.number().optional(),\n popover: z\n .object({\n alignment: z.enum(textAlignments).default(TextAlignment.center),\n position: z.enum(popoverPositions).default(PopoverPosition.blockStart),\n })\n .optional()\n .default(() => ({\n alignment: TextAlignment.center,\n position: PopoverPosition.blockStart,\n })),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sections: z.union([z.array(CABButtonContent), z.strictObject({}).transform(() => [])]).default(() => []),\n sectionType: z.literal(SectionType.button).default(SectionType.button),\n /** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */\n trackingUrl: z.string().optional(),\n});\n\nexport type CABButtonSection = z.infer<typeof CABButtonSection>;\n\nexport type CABButtonSectionProps = CABButtonSection & SectionDetails;\n", "import { forEach, isString } from 'es-toolkit/compat';\nimport { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport {\n ButtonField,\n buttonFields,\n progressTierTypes,\n ProgressTierType,\n SectionType,\n Spacing,\n spacings,\n TextAlignment,\n textAlignments,\n TextColorName,\n textColorNames,\n TextSizeName,\n textSizeNames,\n} from './common';\nimport { DYNAMIC_TOKEN_REGEX, ROOT_RELATIVE_PATH_REGEX } from './regex';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\nimport { checkForHTML, NO_HTML } from './utils';\n\nconst enumOrOmit = <T extends readonly [string, ...string[]]>(...vals: T) =>\n z\n .string()\n .transform((val) => (vals.includes(val as T[number]) ? (val as T[number]) : undefined))\n .optional();\n\nexport const TiptapText = z.object({\n marks: z\n .union([\n z.array(\n z.discriminatedUnion('type', [\n z.object({ type: z.literal('bold') }),\n z.object({ type: z.literal('italic') }),\n z.object({\n attrs: z.object({\n class: z.string().nullable(),\n href: z.union([\n z.url(),\n z.literal('#'),\n z.string().regex(DYNAMIC_TOKEN_REGEX),\n z.string().regex(ROOT_RELATIVE_PATH_REGEX),\n ]),\n rel: z.string().default('noopener noreferrer nofollow'),\n target: z.string().default('_blank'),\n }),\n type: z.literal('link'),\n }),\n z.object({ type: z.literal('strike') }),\n z.object({\n attrs: z.object({\n color: enumOrOmit(...textColorNames).default(TextColorName.base),\n fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base),\n }),\n type: z.literal('textStyle'),\n }),\n ])\n ),\n z.strictObject({}).transform(() => []),\n ])\n .optional(),\n text: z.string().default(''),\n type: z.literal('text').default('text'),\n});\n\nexport type TiptapText = z.infer<typeof TiptapText>;\n\nexport const TiptapParagraph = z.object({\n attrs: z\n .object({\n textAlign: enumOrOmit(...textAlignments),\n })\n .default({ textAlign: TextAlignment.start }),\n content: z.union([z.array(TiptapText), z.strictObject({}).transform(() => [])]).default(() => []),\n type: z.literal('paragraph').default('paragraph'),\n});\n\nexport type TiptapParagraph = z.infer<typeof TiptapParagraph>;\n\nexport const TiptapDocument = z.object({\n attrs: z\n .object({\n blockSpacing: enumOrOmit(...spacings),\n })\n .default({ blockSpacing: Spacing.base }),\n content: z\n .union([z.array(TiptapParagraph), z.strictObject({}).transform(() => [])])\n .default(() => [TiptapParagraph.parse({})]),\n type: z.literal('doc').default('doc'),\n});\n\nexport type TiptapDocument = z.infer<typeof TiptapDocument>;\n\n/**\n * A text section's tier reference. On the smart-cart per-tier feedback copy it carries the `tierId`, so\n * the renderer shows this section only while its tier is the active (current/last-reached) one \u2014 the\n * full tier (gift/threshold) lives on progressBar.\n */\nexport const CABTextTier = z.object({\n threshold: z.number().int().nonnegative(),\n thresholds: z.record(z.string(), z.number().int().nonnegative()).default(() => ({})),\n tierId: z.string().optional(),\n tierType: z.enum(progressTierTypes).default(ProgressTierType.shipping),\n});\n\nexport type CABTextTier = z.infer<typeof CABTextTier>;\n\nexport const CABTextSection = z\n .object({\n buttonField: z.enum(buttonFields).optional(),\n content: z\n .record(z.string(), z.union([z.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional())\n .default({ en: TiptapDocument.parse({}) })\n .optional(),\n name: z.string().optional(),\n optionId: z.number().optional(),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.text).default(SectionType.text),\n tier: CABTextTier.optional(),\n })\n .superRefine(({ buttonField, content }, ctx) => {\n if (buttonField === ButtonField.destinationUrl && content) {\n forEach(content, (value, lang) => {\n if (value && isString(value)) {\n if (DYNAMIC_TOKEN_REGEX.test(value)) return;\n\n try {\n new URL(value);\n } catch {\n ctx.addIssue({\n code: 'custom',\n message: 'Invalid URL',\n path: ['content', lang],\n });\n }\n }\n });\n }\n });\n\nexport type CABTextSection = z.infer<typeof CABTextSection>;\n\nexport type CABTextSectionProps = CABTextSection & SectionDetails;\n", "import { isPlainObject, mapValues } from 'es-toolkit';\nimport { every, get, isArray, isString, map, size, toPairs } from 'es-toolkit/compat';\n\nimport { type CABBannerSection } from './banner';\nimport { type CABButtonSection } from './button';\nimport { type CABCarouselSection } from './carousel';\nimport { type CABCartLineSection } from './cartLine';\nimport { ButtonField, SectionType } from './common';\nimport { type CABDataSourceSection } from './dataSource';\nimport { type CABDiscountSection } from './discount';\nimport { type CABImageSection } from './image';\nimport { type CABLayoutSection } from './layout';\nimport { type CABMonetizeSection } from './monetize';\nimport { type CABOffersSection } from './offers';\nimport { type CABProductSection } from './product';\nimport { type CABProductsSection } from './products';\nimport { type CABProgressBarSection } from './progressBar';\nimport { type CABQuantitySection } from './quantity';\nimport { ARRAY_INDEX_STRING, HTML_TAGS_REGEX } from './regex';\nimport { type CABReviewsSection } from './reviews';\nimport { type CABTextSection, type TiptapDocument } from './text';\nimport { type CABVariantsSection } from './variants';\n\nexport const isHTML = (html: string | undefined = ''): boolean => {\n if (typeof window !== 'undefined') {\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, 'text/html');\n\n const hasHTML = (nodeList: NodeList) => Array.from(nodeList).some((node) => node.nodeType === 1);\n\n return hasHTML(doc.body.childNodes) || hasHTML(doc.head.childNodes);\n }\n\n // `.search()` (not `.test()`) because HTML_TAGS_REGEX is global for downstream `.replace` callers;\n // `.search()` ignores and never advances `lastIndex`, so repeated calls stay deterministic.\n return html.search(HTML_TAGS_REGEX) !== -1;\n};\n\nexport const hasHTMLInDoc = (doc: TiptapDocument): boolean =>\n doc.content.some(({ content = [] }) => content.some(({ text }) => isHTML(text)));\n\nexport const checkForHTML = (input: string | TiptapDocument): boolean =>\n !((isString(input) && isHTML(input)) || (isPlainObject(input) && hasHTMLInDoc(input as TiptapDocument)));\n\nexport const NO_HTML = { message: 'HTML is not supported' };\n\nexport const isBannerType = (section: unknown): section is CABBannerSection =>\n get(section, 'sectionType') === SectionType.banner;\n\nexport const isButtonType = (section: unknown): section is CABButtonSection =>\n get(section, 'sectionType') === SectionType.button;\n\nexport const isCarouselType = (section: unknown): section is CABCarouselSection =>\n get(section, 'sectionType') === SectionType.carousel;\n\nexport const isCartLineType = (section: unknown): section is CABCartLineSection =>\n get(section, 'sectionType') === SectionType.cartLine;\n\nexport const isDataSourceType = (section: unknown): section is CABDataSourceSection =>\n get(section, 'sectionType') === SectionType.dataSource;\n\nexport const isDiscountType = (section: unknown): section is CABDiscountSection =>\n get(section, 'sectionType') === SectionType.discount;\n\nexport const isImageType = (section: unknown): section is CABImageSection =>\n get(section, 'sectionType') === SectionType.image;\n\nexport const isLayoutType = (section: unknown): section is CABLayoutSection =>\n get(section, 'sectionType') === SectionType.layout;\n\nexport const isMonetizeType = (section: unknown): section is CABMonetizeSection =>\n get(section, 'sectionType') === SectionType.monetize;\n\nexport const isOffersType = (section: unknown): section is CABOffersSection =>\n get(section, 'sectionType') === SectionType.offers;\n\nexport const isOverlayType = (section: unknown): section is CABLayoutSection =>\n isLayoutType(section) && get(section, 'buttonField') === ButtonField.overlayContent;\n\nexport const isProductType = (section: unknown): section is CABProductSection =>\n get(section, 'sectionType') === SectionType.product;\n\nexport const isProductsType = (section: unknown): section is CABProductsSection =>\n get(section, 'sectionType') === SectionType.products;\n\nexport const isProgressBarType = (section: unknown): section is CABProgressBarSection =>\n get(section, 'sectionType') === SectionType.progressBar;\n\nexport const isQuantityType = (section: unknown): section is CABQuantitySection =>\n get(section, 'sectionType') === SectionType.quantity;\n\nexport const isReviewsType = (section: unknown): section is CABReviewsSection =>\n get(section, 'sectionType') === SectionType.reviews;\n\nexport const isTextType = (section: unknown): section is CABTextSection =>\n get(section, 'sectionType') === SectionType.text;\n\nexport const isVariantsType = (section: unknown): section is CABVariantsSection =>\n get(section, 'sectionType') === SectionType.variants;\n\nconst hasOnlyNumericKeys = (input: Record<string, unknown>) =>\n !!size(input) && every(input, (_, key) => ARRAY_INDEX_STRING.test(key) && Number.isSafeInteger(Number(key)));\n\nconst numericObjectToArray = (input: Record<string, unknown>) =>\n toPairs(input)\n .sort(([a], [b]) => Number(a) - Number(b))\n .map(([_, value]) => value);\n\nexport const convertNumericObjects = (input: unknown): unknown => {\n if (isArray(input)) return map(input, convertNumericObjects);\n\n if (isPlainObject(input)) {\n const obj = input as Record<string, unknown>;\n\n return hasOnlyNumericKeys(obj)\n ? map(numericObjectToArray(obj), convertNumericObjects)\n : mapValues(obj, convertNumericObjects);\n }\n\n return input;\n};\n", "import { z } from 'zod';\n\nimport { SectionType } from './common';\nimport { CABLayoutSection } from './layout';\nimport { CABOffersSection } from './offers';\nimport { CABSection, type SectionDetails } from './shared';\n\nexport const CABCarouselSection = z.lazy(() =>\n CABLayoutSection.omit({ sections: true, sectionType: true }).extend({\n autoAdvanceInterval: z.number().default(0),\n itemsAtOnce: z.number().min(1).default(1),\n sections: z\n .union([z.array(z.lazy(() => CABSection)), z.strictObject({}).transform(() => [])])\n .default(() => [CABOffersSection.parse({})]),\n sectionType: z.literal(SectionType.carousel).default(SectionType.carousel),\n })\n);\n\nexport type CABCarouselSection = Omit<CABLayoutSection, 'sectionType'> & {\n autoAdvanceInterval: number;\n itemsAtOnce: number;\n sectionType: 'carousel';\n};\n\nexport type CABCarouselSectionProps = CABCarouselSection & SectionDetails;\n", "import { z } from 'zod';\n\nimport { CABBannerSection } from './banner';\nimport { CABButtonSection } from './button';\nimport { ButtonStyle, SectionType } from './common';\nimport { CABDataSourceSection } from './dataSource';\nimport { CABLayoutSection } from './layout';\nimport { CABProductsSection } from './products';\nimport { CABSection, type SectionDetails } from './shared';\nimport { CABTextSection } from './text';\n\nexport const CABOffersSection = z.lazy(() =>\n CABLayoutSection.omit({ sections: true, sectionType: true }).extend({\n sections: z.union([z.array(z.lazy(() => CABSection)), z.strictObject({}).transform(() => [])]).default(() => [\n CABBannerSection.parse({\n buttonField: 'undoAddToOrder',\n color: 'success',\n dismissible: true,\n name: 'Success Banner',\n sections: [\n CABTextSection.parse({ content: { en: '{{quantity}} {{productTitle}} added to cart.' } }),\n CABButtonSection.parse({ action: 'undoAddToOrder', buttonStyle: ButtonStyle.plain }),\n ],\n }),\n CABDataSourceSection.parse({}),\n CABProductsSection.parse({}),\n ]),\n sectionType: z.literal(SectionType.offers).default(SectionType.offers),\n })\n);\n\nexport type CABOffersSection = Omit<CABLayoutSection, 'sectionType'> & {\n sectionType: 'offers';\n};\n\nexport type CABOffersSectionProps = CABOffersSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { discountSources, discountTypes, productTypes, SectionType } from './common';\nimport { DEFAULT_ENDPOINTS } from './constants';\nimport { type SectionDetails } from './shared';\n\nexport const CABDiscount = z.object({\n amount: z.union([z.number(), z.string()]).catch(0),\n discountedBy: z.string().optional(),\n discountedFrom: z.enum(discountSources).optional().catch(undefined),\n type: z.enum(discountTypes).catch('none'),\n});\n\nexport type CABDiscount = z.infer<typeof CABDiscount>;\n\nexport const CABIntegrations = z.object({\n judgeme: z.boolean().default(false),\n junip: z.boolean().default(false),\n klaviyo: z.boolean().default(false),\n loox: z.boolean().default(false),\n okendo: z.boolean().default(false),\n opinew: z.boolean().default(false),\n reviewsio: z.boolean().default(false),\n stamped: z.boolean().default(false),\n yotpo: z.boolean().default(false),\n});\n\nexport type CABIntegrations = z.infer<typeof CABIntegrations>;\n\nexport const CABDataSourceSection = z.object({\n dataSourceId: z.number().nullable().default(null),\n dataSourcePath: z.string().default(DEFAULT_ENDPOINTS[0].value),\n discount: CABDiscount.optional(),\n integrations: CABIntegrations.optional(),\n limit: z.number().default(1),\n matchVariant: z.boolean().default(false),\n matchVariantOutOfStock: z.boolean().default(false),\n name: z.string().default(DEFAULT_ENDPOINTS[0].label),\n productType: z.enum(productTypes).optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.dataSource).default(SectionType.dataSource),\n /** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */\n subscriptionIsDefault: z.boolean().default(false),\n treatAsGwp: z.boolean().default(false),\n});\n\nexport type CABDataSourceSection = z.infer<typeof CABDataSourceSection>;\n\nexport type CABDataSourceSectionProps = CABDataSourceSection & SectionDetails;\n", "import { uniqBy } from 'es-toolkit';\n\nimport { EditorMode, freezeEnum } from './common';\nimport { type TargetArea } from './root';\n\nexport const DEFAULT_ENDPOINTS = [\n { label: 'Recommended (AI)', value: '/products/recommended' },\n { label: 'Top Sellers', value: '/products/top_sellers' },\n { label: 'Buy It Again', value: '/products/purchased' },\n { label: 'Recently Viewed', value: '/products/viewed' },\n { label: 'Products Search', value: '/products/search' },\n { label: 'Collection Products', value: '/products/collections' },\n { label: 'Similar Products (AI)', value: '/products/similar_products' },\n] as const;\n\nexport const STATIC_ENDPOINTS = [\n { label: 'Recommended (AI)', value: '/products/recommended' },\n { label: 'Top Sellers', value: '/products/top_sellers' },\n { label: 'Trending Products', value: '/products/trending_products' },\n { label: 'Buy It Again', value: '/products/purchased' },\n { label: 'Collection Products', value: '/products/collections' },\n { label: 'Recently Viewed', value: '/products/viewed' },\n { label: 'Static Products', value: '/products/static' },\n { label: 'Products Search', value: '/products/search' },\n { label: 'Similar Products (AI)', value: '/products/similar_products' },\n] as const;\n\nexport const COMBINED_ENDPOINTS = uniqBy([...DEFAULT_ENDPOINTS, ...STATIC_ENDPOINTS], (item) => item.value);\n\nexport const targetAreas = {\n [EditorMode.checkoutExtension]: [\n { icon: 'splitscreen_top', label: 'Header Area', width: '984px' },\n { icon: 'splitscreen_left', label: 'Main Column', width: '503px' },\n { icon: 'splitscreen_right', label: 'Summary Column', width: '404px' },\n ] satisfies TargetArea[],\n [EditorMode.postPurchaseOffer]: null,\n [EditorMode.thankYouPage]: [\n { icon: 'splitscreen_top', label: 'Header Area', width: '984px' },\n { icon: 'splitscreen_left', label: 'Main Column', width: '503px' },\n { icon: 'splitscreen_right', label: 'Summary Column', width: '404px' },\n ] satisfies TargetArea[],\n [EditorMode.orderStatusPage]: [\n // { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },\n { icon: 'splitscreen_top', label: 'Header Area', width: '1124px' },\n { fill: true, icon: 'view_column_2', label: 'Main Area', width: '646px' },\n { icon: 'splitscreen_bottom', label: 'Footer Area', width: '1124px' },\n ] satisfies TargetArea[],\n [EditorMode.ordersIndexPage]: [\n // { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },\n { icon: 'splitscreen_top', label: 'Main Area', width: '1124px' },\n ] satisfies TargetArea[],\n [EditorMode.customerProfilePage]: [\n // { fill: true, flip: 'vertical', icon: 'bottom_navigation', label: 'Announcement Bar' },\n { icon: 'splitscreen_top', label: 'Main Area', width: '1124px' },\n ] satisfies TargetArea[],\n} as const;\n\nexport const widgetTypes = [\n 'bundle_builder',\n 'cart',\n 'cart_subscription',\n 'dynamic_bundle',\n 'gift_with_purchase',\n 'pre_purchase',\n 'product',\n 'product_addon',\n 'product_upsell',\n 'recharge_checkout',\n 'recharge_customer_portal',\n 'recharge_post_purchase',\n 'shopify_checkout',\n 'shopify_checkout_extension',\n 'shopify_post_purchase',\n 'shopify_post_purchase_extension',\n 'switch_to_subscription',\n 'ui_extension_ad',\n 'ui_extension_button',\n 'ui_extension_content_block',\n 'ui_extension_line_item_editor',\n 'ui_extension_progress_bar',\n] as const;\n\nexport const WidgetType = freezeEnum(widgetTypes);\nexport type WidgetType = (typeof widgetTypes)[number];\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { SectionType } from './common';\nimport { CABProductSection } from './product';\nimport { type SectionDetails } from './shared';\n\nexport const CABProductsSection = z.object({\n name: z.string().optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sections: z\n .union([z.array(z.lazy(() => CABProductSection)), z.strictObject({}).transform(() => [])])\n .default(() => []),\n sectionType: z.literal(SectionType.products).default(SectionType.products),\n});\n\nexport type CABProductsSection = z.infer<typeof CABProductsSection>;\n\nexport type CABProductsSectionProps = CABProductsSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z, type ZodType } from 'zod';\n\nimport { CABButtonSection } from './button';\nimport { SectionType, VariantMode, variantModes, VariantSelector, variantSelectors } from './common';\nimport { type SectionDetails } from './shared';\nimport { CABTextSection } from './text';\n\nexport type CABVariantContent = CABButtonSection | CABTextSection;\n\nexport const CABVariantContent: ZodType<CABVariantContent> = z.lazy(() =>\n z.discriminatedUnion('sectionType', [CABButtonSection, CABTextSection])\n);\n\nexport const CABProductSection = z.object({\n name: z.string().optional(),\n productId: z.number().nullable().default(null),\n sectionId: z.uuid().default(() => uuidv7()),\n sections: z.union([z.array(CABVariantContent), z.strictObject({}).transform(() => [])]).default(() => []),\n sectionType: z.literal(SectionType.product).default(SectionType.product),\n selectors: z.record(z.string(), z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),\n variantMode: z.enum(variantModes).default(VariantMode.multiple),\n});\n\nexport type CABProductSection = z.infer<typeof CABProductSection>;\n\nexport type CABProductSectionProps = CABProductSection & SectionDetails;\n", "import { z } from 'zod';\n\nimport { CABButtonSection } from './button';\nimport { ButtonAction, SectionType } from './common';\nimport { CABLayoutSection } from './layout';\nimport { CABSection, type SectionDetails } from './shared';\n\nexport const CABCartLineSection = z.lazy(() =>\n CABLayoutSection.omit({ sections: true, sectionType: true }).extend({\n sections: z\n .union([z.array(z.lazy(() => CABSection)), z.strictObject({}).transform(() => [])])\n .default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),\n sectionType: z.literal(SectionType.cartLine).default(SectionType.cartLine),\n })\n);\n\nexport type CABCartLineSection = Omit<CABLayoutSection, 'sectionType'> & {\n sectionType: 'cartLine';\n};\n\nexport type CABCartLineSectionProps = CABCartLineSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { discountSources, discountTypes, SectionType } from './common';\nimport { type SectionDetails } from './shared';\n\n/**\n * The widget discount, modeled as its own offers child section (toggled on/off in the editor and\n * rendered nowhere \u2014 it's config-only). Discounting is Shopify Functions-only (Scripts is sunset), so a\n * configured discount always applies via Functions and the amount is in Functions (minor-unit) form for\n * fixed types. `discountedFrom` is the compare-from source; `message` is the Functions discount title.\n */\nexport const CABDiscountSection = z.object({\n amount: z.union([z.number(), z.string()]).catch(0),\n discountedBy: z.string().optional(),\n discountedFrom: z.enum(discountSources).optional().catch(undefined),\n message: z.string().optional(),\n name: z.string().optional(),\n quantity: z.number().default(1),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.discount).default(SectionType.discount),\n type: z.enum(discountTypes).catch('none'),\n});\n\nexport type CABDiscountSection = z.infer<typeof CABDiscountSection>;\n\nexport type CABDiscountSectionProps = CABDiscountSection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { SectionType } from './common';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\n\nexport const CABMonetizeSection = z.object({\n name: z.string().optional(),\n /** Privacy Policy footer href (the widget's `privacy_policy_url` setting); the client relays it to `/cab/monetize`. */\n privacyPolicyUrl: z.string().optional(),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.monetize).default(SectionType.monetize),\n});\n\nexport type CABMonetizeSection = z.infer<typeof CABMonetizeSection>;\n\nexport type CABMonetizeSectionProps = CABMonetizeSection & SectionDetails;\n", "import { z } from 'zod';\n\nimport { ProgressTierType, progressTierTypes, ProgressTierUnit, progressTierUnits, SectionType } from './common';\nimport { GIFT_LABELS } from './giftLabels';\nimport { CABLayoutSection } from './layout';\nimport { type SectionDetails } from './shared';\n\nexport const CABProgressTier = z.object({\n /**\n * Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at\n * cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.\n * `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});\n * `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.\n */\n discount: z.object({ amount: z.number().nonnegative(), type: z.enum(['fixedAmount', 'percentage']) }).optional(),\n /**\n * Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches\n * `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart\n * when the tier is reached (attribution `_tier` = {@link CABProgressTier.tierId}). Absent on shipping\n * tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the\n * tree is complete.\n */\n gift: z\n .object({\n productId: z.number().int().positive(),\n title: z.string().optional(),\n variantIds: z.array(z.number().int().positive()).default(() => []),\n })\n .optional(),\n /**\n * The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the\n * type default ('Free Shipping' / product title / '{n}% Discount'). Localized content; blank \u21D2 no\n * label under the tier's icon. Plain text \u2014 the step row is a compact icon+label, not rich copy.\n */\n label: z.record(z.string(), z.string()).optional(),\n /**\n * The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents \u2014 the canonical\n * fallback: when the buyer's presentment currency has no entry in `thresholds`, the client\n * multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` \u2192 `7500`).\n * `item`: a raw item count \u2014 no cents, no FX, no `thresholds` overrides.\n */\n threshold: z.number().int().nonnegative(),\n /**\n * Per-presentment-currency goal overrides \u2014 lowercased ISO currency code \u2192 cents (e.g. `{ cad: 9900 }`).\n * When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting\n * `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a\n * converted base. Defaults to `{}` \u2014 no overrides means always fall back to `threshold`.\n */\n thresholds: z.record(z.string(), z.number().int().nonnegative()).default(() => ({})),\n /**\n * Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can\n * match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the\n * shipping bar (single unlabeled tier, no gift).\n */\n tierId: z.string().optional(),\n tierType: z.enum(progressTierTypes).default(ProgressTierType.shipping),\n /**\n * What this tier's progress is measured in \u2014 PER TIER (onsite's `unlock_condition_type` model, NOT\n * the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the\n * adjusted subtotal; `item` compares the raw quantity sum of non-excluded lines (the SAME exclusion\n * set as the money path). A mixed-unit bar stays coherent tier by tier: reach, fill share, and\n * `{{remainingAmount}}` (count-formatted + item/items-pluralized for `item` tiers) each resolve in\n * their own tier's unit \u2014 cross-tier arithmetic never mixes counts with cents.\n */\n unit: z.enum(progressTierUnits).default(ProgressTierUnit.currency),\n});\n\nexport type CABProgressTier = z.infer<typeof CABProgressTier>;\n\n/**\n * A self-contained progress-bar container. Extends `layout` (alignment/border/spacing/`sections`/\u2026), so it\n * holds ALL its pieces as composable children \u2014 the tier display (a `columns \u2192 rows \u2192 text/image` layout)\n * and the reached/remaining message `text`s \u2014 while the renderer adds the bar fill from `tiers` and shows\n * the active message. Everything is encapsulated under this one named section (and one country/FX gate).\n */\nexport const CABProgressBarSection = z.lazy(() =>\n CABLayoutSection.omit({ sectionType: true }).extend({\n /** Empty = shown everywhere; otherwise uppercase ISO country codes. */\n countryCodes: z.array(z.string().transform((code) => code.trim().toUpperCase())).default(() => []),\n /**\n * Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is\n * hidden there \u2014 replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.\n */\n excludeCountryCodes: z.array(z.string().transform((code) => code.trim().toUpperCase())).default(() => []),\n /**\n * Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and\n * forced on for bars with a discount tier so its own reward can't un-reach the tier). The client\n * adds the cart's discount allocations back to the live subtotal.\n */\n excludeDiscountInSubtotal: z.boolean().default(false),\n /** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */\n excludedVariantIds: z.array(z.number().int().positive()).default(() => []),\n /**\n * When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React\n * `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.\n */\n freeShippingOnSubscription: z.boolean().default(false),\n /** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */\n giftAreaTitle: z.record(z.string(), z.string()).default(() => ({ en: 'FREE GIFTS' })),\n /** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */\n giftLabels: z\n .object({\n addGift: z.record(z.string(), z.string()).default(() => ({ ...GIFT_LABELS.addGift })),\n remove: z.record(z.string(), z.string()).default(() => ({ ...GIFT_LABELS.remove })),\n selectOptions: z.record(z.string(), z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),\n yourGift: z.record(z.string(), z.string()).default(() => ({ ...GIFT_LABELS.yourGift })),\n })\n .default(() => ({\n addGift: { ...GIFT_LABELS.addGift },\n remove: { ...GIFT_LABELS.remove },\n selectOptions: { ...GIFT_LABELS.selectOptions },\n yourGift: { ...GIFT_LABELS.yourGift },\n })),\n /** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */\n name: z.string().default('Order progress'),\n /**\n * Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server\n * fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still\n * absent after that \u21D2 the theme fetch failed and the client renders its platform-default bar \u2014\n * optional, not defaulted, so \"merchant chose no color\" stays distinguishable from any real value.\n */\n progressColor: z.string().optional(),\n sectionType: z.literal(SectionType.progressBar).default(SectionType.progressBar),\n /**\n * The bar's milestones, in any order \u2014 the renderer sorts by resolved threshold. Drives the fill\n * (even slot per tier) and, for smart-cart product tiers, the gift add/remove. The visual tier\n * display lives in `sections` (composable), NOT here.\n */\n tiers: z.union([z.array(CABProgressTier), z.strictObject({}).transform(() => [])]).default(() => []),\n })\n);\n\nexport type CABProgressBarSection = Omit<CABLayoutSection, 'name' | 'sectionType'> & {\n countryCodes: string[];\n excludeCountryCodes: string[];\n excludeDiscountInSubtotal: boolean;\n excludedVariantIds: number[];\n freeShippingOnSubscription: boolean;\n giftAreaTitle: Record<string, string>;\n giftLabels: Record<'addGift' | 'remove' | 'selectOptions' | 'yourGift', Record<string, string>>;\n name: string;\n progressColor?: string;\n sectionType: 'progressBar';\n tiers: CABProgressTier[];\n};\n\nexport type CABProgressBarSectionProps = CABProgressBarSection & SectionDetails;\n", "/**\n * Default localized labels for the smart-cart gift controls, keyed by slot then locale (same 26 locales\n * as `SWITCH_LABELS`). Schema-default content, never a client dictionary (Peter, 2026-07-06: visible\n * customer strings must be localized). `yourGift` is the generic heading \u2014 a tier's configured gift\n * `title` beats it when present.\n */\nexport const GIFT_LABELS = {\n addGift: {\n ar: '\u0623\u0636\u0641 \u0627\u0644\u0647\u062F\u064A\u0629',\n cs: 'P\u0159idat d\u00E1rek',\n da: 'Tilf\u00F8j gave',\n de: 'Geschenk hinzuf\u00FCgen',\n en: 'Add gift',\n es: 'A\u00F1adir regalo',\n fi: 'Lis\u00E4\u00E4 lahja',\n fr: 'Ajouter le cadeau',\n ga: 'Cuir bronntanas leis',\n he: '\u05D4\u05D5\u05E1\u05E3 \u05DE\u05EA\u05E0\u05D4',\n hi: '\u0909\u092A\u0939\u093E\u0930 \u091C\u094B\u0921\u093C\u0947\u0902',\n id: 'Tambahkan hadiah',\n it: 'Aggiungi regalo',\n ja: '\u30AE\u30D5\u30C8\u3092\u8FFD\u52A0',\n ko: '\uC0AC\uC740\uD488 \uCD94\uAC00',\n nl: 'Cadeau toevoegen',\n no: 'Legg til gave',\n pl: 'Dodaj prezent',\n pt: 'Adicionar presente',\n ru: '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u043F\u043E\u0434\u0430\u0440\u043E\u043A',\n sv: 'L\u00E4gg till g\u00E5va',\n th: '\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E02\u0E2D\u0E07\u0E02\u0E27\u0E31\u0E0D',\n tr: 'Hediye ekle',\n uk: '\u0414\u043E\u0434\u0430\u0442\u0438 \u043F\u043E\u0434\u0430\u0440\u0443\u043D\u043E\u043A',\n vi: 'Th\u00EAm qu\u00E0 t\u1EB7ng',\n zh: '\u6DFB\u52A0\u8D60\u54C1',\n },\n remove: {\n ar: '\u0625\u0632\u0627\u0644\u0629',\n cs: 'Odebrat',\n da: 'Fjern',\n de: 'Entfernen',\n en: 'Remove',\n es: 'Eliminar',\n fi: 'Poista',\n fr: 'Retirer',\n ga: 'Bain',\n he: '\u05D4\u05E1\u05E8',\n hi: '\u0939\u091F\u093E\u090F\u0901',\n id: 'Hapus',\n it: 'Rimuovi',\n ja: '\u524A\u9664',\n ko: '\uC81C\uAC70',\n nl: 'Verwijderen',\n no: 'Fjern',\n pl: 'Usu\u0144',\n pt: 'Remover',\n ru: '\u0423\u0434\u0430\u043B\u0438\u0442\u044C',\n sv: 'Ta bort',\n th: '\u0E19\u0E33\u0E2D\u0E2D\u0E01',\n tr: 'Kald\u0131r',\n uk: '\u0412\u0438\u0434\u0430\u043B\u0438\u0442\u0438',\n vi: 'X\u00F3a',\n zh: '\u79FB\u9664',\n },\n selectOptions: {\n ar: '\u0627\u062E\u062A\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A',\n cs: 'Vyberte mo\u017Enosti',\n da: 'V\u00E6lg muligheder',\n de: 'Optionen w\u00E4hlen',\n en: 'Select Options',\n es: 'Seleccionar opciones',\n fi: 'Valitse vaihtoehdot',\n fr: 'Choisir les options',\n ga: 'Roghnaigh roghanna',\n he: '\u05D1\u05D7\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA',\n hi: '\u0935\u093F\u0915\u0932\u094D\u092A \u091A\u0941\u0928\u0947\u0902',\n id: 'Pilih opsi',\n it: 'Seleziona le opzioni',\n ja: '\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u9078\u629E',\n ko: '\uC635\uC158 \uC120\uD0DD',\n nl: 'Opties kiezen',\n no: 'Velg alternativer',\n pl: 'Wybierz opcje',\n pt: 'Selecionar op\u00E7\u00F5es',\n ru: '\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B',\n sv: 'V\u00E4lj alternativ',\n th: '\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E15\u0E31\u0E27\u0E40\u0E25\u0E37\u0E2D\u0E01',\n tr: 'Se\u00E7enekleri se\u00E7',\n uk: '\u0412\u0438\u0431\u0440\u0430\u0442\u0438 \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u0438',\n vi: 'Ch\u1ECDn t\u00F9y ch\u1ECDn',\n zh: '\u9009\u62E9\u9009\u9879',\n },\n yourGift: {\n ar: '\u0647\u062F\u064A\u062A\u0643',\n cs: 'V\u00E1\u0161 d\u00E1rek',\n da: 'Din gave',\n de: 'Ihr Geschenk',\n en: 'Your gift',\n es: 'Tu regalo',\n fi: 'Lahjasi',\n fr: 'Votre cadeau',\n ga: 'Do bhronntanas',\n he: '\u05D4\u05DE\u05EA\u05E0\u05D4 \u05E9\u05DC\u05DA',\n hi: '\u0906\u092A\u0915\u093E \u0909\u092A\u0939\u093E\u0930',\n id: 'Hadiah Anda',\n it: 'Il tuo regalo',\n ja: '\u3042\u306A\u305F\u306E\u30AE\u30D5\u30C8',\n ko: '\uACE0\uAC1D\uB2D8\uC758 \uC0AC\uC740\uD488',\n nl: 'Uw cadeau',\n no: 'Din gave',\n pl: 'Tw\u00F3j prezent',\n pt: 'Seu presente',\n ru: '\u0412\u0430\u0448 \u043F\u043E\u0434\u0430\u0440\u043E\u043A',\n sv: 'Din g\u00E5va',\n th: '\u0E02\u0E2D\u0E07\u0E02\u0E27\u0E31\u0E0D\u0E02\u0E2D\u0E07\u0E04\u0E38\u0E13',\n tr: 'Hediyeniz',\n uk: '\u0412\u0430\u0448 \u043F\u043E\u0434\u0430\u0440\u0443\u043D\u043E\u043A',\n vi: 'Qu\u00E0 c\u1EE7a b\u1EA1n',\n zh: '\u60A8\u7684\u8D60\u54C1',\n },\n} satisfies Record<string, Record<string, string>>;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { QuantityInput, quantityInputs, SectionType } from './common';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\n\nexport const CABQuantitySection = z.object({\n errorMessages: z\n .record(\n z.string(),\n z.object({\n /** `{{step}}` is interpolated at render \u2014 the off-increment message React never gave a merchant key. */\n increment: z.string().optional(),\n max: z.string().optional(),\n min: z.string().optional(),\n neg: z.string().optional(),\n })\n )\n .default({\n en: {\n increment: 'Quantity must be in increments of {{step}}',\n max: 'Maximum quantity allowed is {{max}}',\n min: 'Minimum quantity required is {{min}}',\n neg: 'Quantity cannot be negative',\n },\n }),\n inputType: z.enum(quantityInputs).default(QuantityInput.select),\n max: z.number().min(1).max(100).default(10),\n min: z.number().min(1).default(1),\n /** The a11y label for the quantity control; the merchant names it in the editor, else this default. */\n name: z.string().default('Quantity'),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.quantity).default(SectionType.quantity),\n});\n\nexport type CABQuantitySection = z.infer<typeof CABQuantitySection>;\n\nexport type CABQuantitySectionProps = CABQuantitySection & SectionDetails;\n", "import { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { ReviewsSize, reviewsSizes, SectionType } from './common';\nimport { REVIEW_LABELS } from './reviewLabels';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\n\nexport const CABReviewsSection = z.object({\n color: z.string().default('#fadb14'),\n /**\n * Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the\n * form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter\n * or merchant work.\n */\n countLabels: z\n .object({\n one: z.record(z.string(), z.string()).default(() => ({ ...REVIEW_LABELS.one })),\n other: z.record(z.string(), z.string()).default(() => ({ ...REVIEW_LABELS.other })),\n })\n .default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),\n name: z.string().optional(),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.reviews).default(SectionType.reviews),\n size: z.enum(reviewsSizes).default(ReviewsSize.default),\n});\n\nexport type CABReviewsSection = z.infer<typeof CABReviewsSection>;\n\nexport type CABReviewsSectionProps = CABReviewsSection & SectionDetails;\n", "/**\n * Default localized review-count templates for the reviews section, keyed by CLDR-ish plural form then\n * locale (same 26 locales as `SWITCH_LABELS`). The client picks `one` vs `other` via `Intl.PluralRules`\n * and interpolates `{{reviewCount}}` \u2014 the two-form simplification maps every non-`one` category\n * (few/many/other) to `other`. Schema-default content, never a client dictionary (Peter, 2026-07-06:\n * visible customer strings must be localized).\n */\nexport const REVIEW_LABELS = {\n one: {\n ar: '({{reviewCount}} \u062A\u0642\u064A\u064A\u0645)',\n cs: '({{reviewCount}} recenze)',\n da: '({{reviewCount}} anmeldelse)',\n de: '({{reviewCount}} Bewertung)',\n en: '({{reviewCount}} review)',\n es: '({{reviewCount}} rese\u00F1a)',\n fi: '({{reviewCount}} arvostelu)',\n fr: '({{reviewCount}} avis)',\n ga: '({{reviewCount}} l\u00E9irmheas)',\n he: '({{reviewCount}} \u05D1\u05D9\u05E7\u05D5\u05E8\u05EA)',\n hi: '({{reviewCount}} \u0938\u092E\u0940\u0915\u094D\u0937\u093E)',\n id: '({{reviewCount}} ulasan)',\n it: '({{reviewCount}} recensione)',\n ja: '({{reviewCount}}\u4EF6\u306E\u30EC\u30D3\u30E5\u30FC)',\n ko: '({{reviewCount}}\uAC1C \uB9AC\uBDF0)',\n nl: '({{reviewCount}} beoordeling)',\n no: '({{reviewCount}} anmeldelse)',\n pl: '({{reviewCount}} opinia)',\n pt: '({{reviewCount}} avalia\u00E7\u00E3o)',\n ru: '({{reviewCount}} \u043E\u0442\u0437\u044B\u0432)',\n sv: '({{reviewCount}} recension)',\n th: '({{reviewCount}} \u0E23\u0E35\u0E27\u0E34\u0E27)',\n tr: '({{reviewCount}} de\u011Ferlendirme)',\n uk: '({{reviewCount}} \u0432\u0456\u0434\u0433\u0443\u043A)',\n vi: '({{reviewCount}} \u0111\u00E1nh gi\u00E1)',\n zh: '({{reviewCount}} \u6761\u8BC4\u4EF7)',\n },\n other: {\n ar: '({{reviewCount}} \u062A\u0642\u064A\u064A\u0645\u0627\u062A)',\n cs: '({{reviewCount}} recenz\u00ED)',\n da: '({{reviewCount}} anmeldelser)',\n de: '({{reviewCount}} Bewertungen)',\n en: '({{reviewCount}} reviews)',\n es: '({{reviewCount}} rese\u00F1as)',\n fi: '({{reviewCount}} arvostelua)',\n fr: '({{reviewCount}} avis)',\n ga: '({{reviewCount}} l\u00E9irmheasanna)',\n he: '({{reviewCount}} \u05D1\u05D9\u05E7\u05D5\u05E8\u05D5\u05EA)',\n hi: '({{reviewCount}} \u0938\u092E\u0940\u0915\u094D\u0937\u093E\u090F\u0901)',\n id: '({{reviewCount}} ulasan)',\n it: '({{reviewCount}} recensioni)',\n ja: '({{reviewCount}}\u4EF6\u306E\u30EC\u30D3\u30E5\u30FC)',\n ko: '({{reviewCount}}\uAC1C \uB9AC\uBDF0)',\n nl: '({{reviewCount}} beoordelingen)',\n no: '({{reviewCount}} anmeldelser)',\n pl: '({{reviewCount}} opinii)',\n pt: '({{reviewCount}} avalia\u00E7\u00F5es)',\n ru: '({{reviewCount}} \u043E\u0442\u0437\u044B\u0432\u043E\u0432)',\n sv: '({{reviewCount}} recensioner)',\n th: '({{reviewCount}} \u0E23\u0E35\u0E27\u0E34\u0E27)',\n tr: '({{reviewCount}} de\u011Ferlendirme)',\n uk: '({{reviewCount}} \u0432\u0456\u0434\u0433\u0443\u043A\u0456\u0432)',\n vi: '({{reviewCount}} \u0111\u00E1nh gi\u00E1)',\n zh: '({{reviewCount}} \u6761\u8BC4\u4EF7)',\n },\n} satisfies Record<'one' | 'other', Record<string, string>>;\n", "import { slice } from 'es-toolkit/compat';\nimport { v7 as uuidv7 } from 'uuid';\nimport { z } from 'zod';\n\nimport { SectionType, VariantMode, variantModes, VariantSelector, variantSelectors } from './common';\nimport { CABRule } from './rule';\nimport { type SectionDetails } from './shared';\n\nexport const CABVariantsSection = z.object({\n hideOutOfStockVariants: z.boolean().default(false),\n name: z.string().optional(),\n rule: CABRule.optional(),\n sectionId: z.uuid().default(() => uuidv7()),\n sectionType: z.literal(SectionType.variants).default(SectionType.variants),\n selector: z.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),\n variantMode: z.enum(variantModes).default(VariantMode.multiple),\n});\n\nexport type CABVariantsSection = z.infer<typeof CABVariantsSection>;\n\nexport type CABVariantsSectionProps = CABVariantsSection & SectionDetails;\n", "const HTML_COMMENT_RE = /<!--[\\s\\S]*?-->/g;\nconst STRIPPED_ELEMENT_RE = /<(script|style|iframe|object|embed|noscript|template)\\b[^>]*>[\\s\\S]*?(?:<\\/\\1\\s*>|$)/gi;\nconst HTML_TAG_RE = /<\\/?[a-zA-Z][^>]*>/g;\n\nexport const stripContentBlockHtml = (text: string): string =>\n text.replace(HTML_COMMENT_RE, '').replace(STRIPPED_ELEMENT_RE, '').replace(HTML_TAG_RE, '');\n", "import { TiptapParagraph, type TiptapText } from '~/schema/widgets/checkout-and-beyond/text';\nimport { stripContentBlockHtml } from '~/transforms/contentBlockV1/stripContentBlockHtml';\n\ntype ConvertTextToTiptapArgs = {\n color: string;\n fontSize: string;\n marks?: NonNullable<TiptapText['marks']>;\n text: string;\n textAlign: 'start' | 'center' | 'end';\n};\n\nexport const convertTextToTiptapParagraph = ({\n color,\n fontSize,\n marks = [],\n text,\n textAlign,\n}: ConvertTextToTiptapArgs): TiptapParagraph => {\n const sanitizedText = stripContentBlockHtml(text);\n\n return TiptapParagraph.parse({\n attrs: { textAlign },\n content: sanitizedText\n ? [\n {\n marks: [{ attrs: { color, fontSize }, type: 'textStyle' }, ...marks],\n text: sanitizedText,\n type: 'text',\n },\n ]\n : [],\n type: 'paragraph',\n });\n};\n", "/**\n * Minimal v1 content-block input types. The legacy `/widgets/settings` endpoint\n * returns the widget's settings object directly (no envelope), so the converter\n * input is just `{ id, settings }` \u2014 `name` / `owner` aren't in the upstream\n * response and would be set to schema defaults in the produced `CABRootSection`.\n */\n\nexport const SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK = 'ui_extension_content_block' as const;\n\n/** Pixel threshold above which an aside-placed image is forced to top placement. */\nexport const CONTENT_BLOCK_MAX_IMAGE_WIDTH = 560;\n\nexport type V1ImagePlacement = 'top' | 'right' | 'bottom' | 'left';\n\nexport type V1ImageBlock = {\n altText?: string | null;\n category?: string;\n description?: string | null;\n filename?: string;\n id: string;\n imagePlacement: V1ImagePlacement;\n imageSize: number;\n imageUrl: string;\n index?: number;\n textAlignment?: 'left' | 'center' | 'right';\n textSize?: string;\n};\n\nexport type V1Language = {\n description?: string;\n superTitle?: string;\n title?: string;\n};\n\nexport type V1Settings = {\n blockSpacing?: string;\n imageBlocks?: V1ImageBlock[];\n imageLayout?: 'row' | 'column';\n language?: V1Language;\n location?: 'checkout' | 'order-status' | 'thank-you';\n previewMode?: boolean;\n type: typeof SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK;\n version: 1;\n};\n\nexport type V1ConvertInput = {\n id: number;\n settings: V1Settings;\n};\n\nexport const isContentBlockV1 = (data: unknown): data is V1Settings => {\n if (!data || typeof data !== 'object') return false;\n\n const obj = data as Record<string, unknown>;\n\n return obj.version === 1 && obj.type === SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK;\n};\n", "import { CABImageSection } from '~/schema/widgets/checkout-and-beyond/image';\nimport { CABLayoutSection } from '~/schema/widgets/checkout-and-beyond/layout';\nimport { CABTextSection } from '~/schema/widgets/checkout-and-beyond/text';\nimport { convertTextToTiptapParagraph } from '~/transforms/contentBlockV1/convertTextToTiptapParagraph';\nimport { stripContentBlockHtml } from '~/transforms/contentBlockV1/stripContentBlockHtml';\nimport {\n CONTENT_BLOCK_MAX_IMAGE_WIDTH,\n type V1ImageBlock,\n type V1ImagePlacement,\n} from '~/transforms/contentBlockV1/types';\n\nconst V1_TO_CAB_ALIGN = { center: 'center', left: 'start', right: 'end' } as const;\n\n/**\n * When an aside-placed image hits the max width, the legacy renderer forces\n * placement to `top` so the description doesn't get squeezed into a zero-width\n * column. Replicate here so the v2 layout matches what the legacy React widget\n * actually displayed.\n */\nconst resolveEffectivePlacement = (placement: V1ImagePlacement, imageSize: number): V1ImagePlacement => {\n const isAside = placement === 'left' || placement === 'right';\n\n return imageSize >= CONTENT_BLOCK_MAX_IMAGE_WIDTH && isAside ? 'top' : placement;\n};\n\n/**\n * The divisor is the same constant the legacy renderer clamps at (560), so an\n * `imageSize = 560` block renders at 100% \u2014 matching the legacy behavior\n * where 560 was the full layout width.\n */\nconst widthPercentForImageSize = (imageSize: number): number =>\n Math.min(Math.round((imageSize / CONTENT_BLOCK_MAX_IMAGE_WIDTH) * 100), 100);\n\nexport const convertContentBlockImageToV2 = (block: V1ImageBlock): CABImageSection | CABLayoutSection => {\n const { altText, category, description, id, imagePlacement, imageSize, imageUrl, textAlignment, textSize } = block;\n const placement = resolveEffectivePlacement(imagePlacement, imageSize);\n\n const imageSection = CABImageSection.parse({\n altText: stripContentBlockHtml(altText ?? ''),\n category,\n sectionId: id,\n sectionType: 'image',\n source: imageUrl,\n width: widthPercentForImageSize(imageSize),\n });\n\n if (!description) return imageSection;\n\n const textSection = CABTextSection.parse({\n content: {\n en: {\n attrs: { blockSpacing: 'base' },\n content: [\n convertTextToTiptapParagraph({\n color: 'base',\n fontSize: textSize ?? 'base',\n text: description,\n textAlign: textAlignment ? V1_TO_CAB_ALIGN[textAlignment] : 'start',\n }),\n ],\n type: 'doc',\n },\n },\n sectionType: 'text',\n });\n\n return CABLayoutSection.parse({\n alignment: { horizontal: 'center', vertical: 'middle' },\n direction: placement === 'left' || placement === 'right' ? 'columns' : 'rows',\n sections:\n placement === 'left' || placement === 'top' ? [imageSection, textSection] : [textSection, imageSection],\n sectionType: 'layout',\n spacing: 'tight',\n });\n};\n", "import { TiptapDocument } from '~/schema/widgets/checkout-and-beyond/text';\nimport { convertTextToTiptapParagraph } from '~/transforms/contentBlockV1/convertTextToTiptapParagraph';\nimport { type V1Language } from '~/transforms/contentBlockV1/types';\n\nexport const convertContentBlockTextToV2 = (language: V1Language | undefined): TiptapDocument => {\n const description = language?.description;\n const superTitle = language?.superTitle;\n const title = language?.title;\n\n return TiptapDocument.parse({\n attrs: { blockSpacing: 'tight' },\n content: [\n superTitle\n ? convertTextToTiptapParagraph({\n color: 'base',\n fontSize: 'extraLarge',\n marks: [{ type: 'bold' }],\n text: superTitle,\n textAlign: 'center',\n })\n : null,\n title\n ? convertTextToTiptapParagraph({\n color: 'base',\n fontSize: 'medium',\n marks: [{ type: 'bold' }],\n text: title,\n textAlign: 'center',\n })\n : null,\n description\n ? convertTextToTiptapParagraph({\n color: 'base',\n fontSize: 'base',\n text: description,\n textAlign: 'center',\n })\n : null,\n ].filter((p): p is NonNullable<typeof p> => p !== null),\n type: 'doc',\n });\n};\n", "import { z } from 'zod';\n\nimport { EditorMode, editorModes } from './common';\nimport { targetAreas, WidgetType, widgetTypes } from './constants';\nimport { CABLayoutSection } from './layout';\nimport { UI_LABELS } from './uiLabels';\n\n/**\n * A per-slot `Record<locale, string>` defaulted from {@link UI_LABELS}: a missing slot gets the fallback,\n * and a present-but-empty slot (`{}`) is guarded back to the fallback too \u2014 otherwise the per-slot default\n * (which only fires for `undefined`) is bypassed and the client renders a blank aria label.\n */\nconst localized = (fallback: Record<string, string>) =>\n z\n .record(z.string(), z.string())\n .default(() => ({ ...fallback }))\n .transform((labels) => (Object.keys(labels).length > 0 ? labels : { ...fallback }));\n\n/**\n * Localized UI-chrome labels for the tree, defaulted from {@link UI_LABELS} at parse so every widget\n * carries them without converter or merchant work. Per-slot `Record<locale, string>`; the client indexes\n * the buyer language with `selectLanguage`. Lives on the root (not per section) because these strings \u2014\n * spinner/carousel/select-label/variant-state chrome \u2014 are shared across the whole tree.\n */\nexport const CABUILabels = z\n .object({\n currentPage: localized(UI_LABELS.currentPage),\n loadingOptions: localized(UI_LABELS.loadingOptions),\n nextPage: localized(UI_LABELS.nextPage),\n offerDialog: localized(UI_LABELS.offerDialog),\n page: localized(UI_LABELS.page),\n previousPage: localized(UI_LABELS.previousPage),\n selected: localized(UI_LABELS.selected),\n subscriptionOptions: localized(UI_LABELS.subscriptionOptions),\n updating: localized(UI_LABELS.updating),\n })\n .default(() => ({\n currentPage: { ...UI_LABELS.currentPage },\n loadingOptions: { ...UI_LABELS.loadingOptions },\n nextPage: { ...UI_LABELS.nextPage },\n offerDialog: { ...UI_LABELS.offerDialog },\n page: { ...UI_LABELS.page },\n previousPage: { ...UI_LABELS.previousPage },\n selected: { ...UI_LABELS.selected },\n subscriptionOptions: { ...UI_LABELS.subscriptionOptions },\n updating: { ...UI_LABELS.updating },\n }));\n\nexport type CABUILabels = Record<keyof typeof UI_LABELS, Record<string, string>>;\n\nconst TargetArea = z\n .object({\n fill: z.boolean().optional(),\n flip: z.enum(['both', 'horizontal', 'vertical']).optional(),\n icon: z.string(),\n label: z.string(),\n width: z.string(),\n })\n .default(targetAreas[EditorMode.checkoutExtension][1]);\n\nexport type TargetArea = {\n fill?: boolean;\n flip?: 'horizontal' | 'vertical' | 'both';\n icon: string;\n label: string;\n width: string;\n};\n\nexport const CABTracking = z\n .object({\n enableAttribution: z.boolean().default(true),\n enableSource: z.boolean().default(true),\n enableWidget: z.boolean().default(true),\n })\n .default({ enableAttribution: true, enableSource: true, enableWidget: true });\n\nexport type CABTracking = z.infer<typeof CABTracking>;\n\n/**\n * The A/B experiment this tree was selected for, attached server-side when the placeholder widget is an\n * experiment target (else absent). The client renders the chosen variant's tree as usual and emits the\n * `ab-test-viewed` / `ABN.TEST` analytics from these fields \u2014 replicating React's `useAnalyticsEvent`.\n */\nexport const CABExperiment = z.object({\n elementId: z.number(),\n experimentId: z.number(),\n experimentType: z.string(),\n selectedId: z.number(),\n});\n\nexport type CABExperiment = z.infer<typeof CABExperiment>;\n\nexport const CABRootSection = CABLayoutSection.extend({\n editorMode: z.enum(editorModes).default(EditorMode.checkoutExtension),\n experiment: CABExperiment.optional(),\n previewMode: z.boolean().default(false),\n storeId: z.number().nullable().default(null),\n targetArea: TargetArea.nullable(),\n tracking: CABTracking,\n type: z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),\n uiLabels: CABUILabels,\n version: z.literal(2).default(2),\n widgetId: z.number().nullable().default(null),\n});\n\nexport type CABRootSection = CABLayoutSection & {\n editorMode: EditorMode;\n experiment?: CABExperiment;\n previewMode: boolean;\n storeId: number | null;\n targetArea: TargetArea | null;\n tracking: CABTracking;\n type: WidgetType;\n uiLabels: CABUILabels;\n version: number;\n widgetId: number | null;\n};\n", "/**\n * Default UI-chrome labels \u2014 the buyer-visible and screen-reader strings that have no per-section\n * merchant slot: the subscription-frequency select's group label, spinner busy text, carousel control\n * names + current-page semantics, the variant selected-state suffix, and the Monetize offer dialog\n * name. Keyed by slot then locale, shipped in the payload so the client never bundles a dictionary\n * (Peter, 2026-07-06: visible customer strings must be localized). English defaults only \u2014 unlike the\n * merchant-authored `SWITCH_LABELS`/`GIFT_LABELS`, these mirror strings legacy hardcoded in English, so\n * the fix is making them payload-sourced (localizable, zero bundle) rather than inventing 25 unreviewed\n * translations; a merchant or a later localization pass can populate other locales. `{{page}}` in the\n * pagination slots is interpolated per control at render.\n */\nexport const UI_LABELS = {\n currentPage: { en: 'Page {{page}}, current' },\n loadingOptions: { en: 'Loading subscription options' },\n nextPage: { en: 'Next' },\n offerDialog: { en: 'Offer' },\n page: { en: 'Page {{page}}' },\n previousPage: { en: 'Previous' },\n selected: { en: 'selected' },\n subscriptionOptions: { en: 'Subscription Options' },\n updating: { en: 'Updating' },\n} satisfies Record<string, Record<string, string>>;\n", "import { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { convertContentBlockImageToV2 } from '~/transforms/contentBlockV1/convertContentBlockImageToV2';\nimport { convertContentBlockTextToV2 } from '~/transforms/contentBlockV1/convertContentBlockTextToV2';\nimport {\n SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK,\n type V1ConvertInput,\n type V1Language,\n} from '~/transforms/contentBlockV1/types';\n\nconst LOCATION_TO_EDITOR_MODE = {\n checkout: 'checkoutExtension',\n 'order-status': 'orderStatusPage',\n 'thank-you': 'thankYouPage',\n} as const;\n\nconst hasText = (language: V1Language | undefined): boolean =>\n !!language && !!(language.description || language.superTitle || language.title);\n\n/** Translates a v1 content-block widget into a fully-formed `CABRootSection`. */\nexport const convertContentBlockToV2 = ({ id, settings }: V1ConvertInput): CABRootSection => {\n const imageBlocks = settings.imageBlocks ?? [];\n\n return CABRootSection.parse({\n alignment: { horizontal: 'center', vertical: 'top' },\n direction: 'rows',\n editorMode: LOCATION_TO_EDITOR_MODE[settings.location ?? 'checkout'],\n previewMode: settings.previewMode,\n sections: [\n hasText(settings.language)\n ? {\n content: { en: convertContentBlockTextToV2(settings.language) },\n sectionType: 'text',\n }\n : null,\n imageBlocks.length > 0\n ? {\n // Legacy centers every image block (`InlineLayout inlineAlignment=\"center\"`).\n alignment: { horizontal: 'center', vertical: 'middle' },\n // Legacy: `image_layout === 'row' ? BlockStack : InlineStack` \u2014 an UNSET layout is\n // horizontal (columns), so only an explicit 'row' may stack vertically.\n direction: settings.imageLayout === 'row' ? 'rows' : 'columns',\n sections: imageBlocks.map(convertContentBlockImageToV2),\n sectionType: 'layout',\n spacing: settings.blockSpacing ?? 'extraTight',\n }\n : null,\n ].filter((section): section is NonNullable<typeof section> => section !== null),\n sectionType: 'layout',\n type: SHOPIFY_CHECKOUT_EXTENSION_CONTENT_BLOCK,\n version: 2,\n widgetId: id,\n });\n};\n", "const ARRAY_INDEX_STRING = /^(?:0|[1-9]\\d*)$/;\n\nconst isPlainObject = (input: unknown): input is Record<string, unknown> => {\n if (input === null || typeof input !== 'object') return false;\n\n const proto = Object.getPrototypeOf(input) as object | null;\n\n return proto === Object.prototype || proto === null;\n};\n\nconst hasOnlyNumericKeys = (input: Record<string, unknown>): boolean => {\n const keys = Object.keys(input);\n\n if (keys.length === 0) return false;\n\n if (!keys.every((key) => ARRAY_INDEX_STRING.test(key) && Number.isSafeInteger(Number(key)))) return false;\n\n // Require the indices to form a complete `0..n-1` sequence \u2014 `{ \"10\": \"a\", \"20\": \"b\" }`\n // would otherwise silently collapse into `[\"a\", \"b\"]` and lose its original positions.\n const sorted = keys.map(Number).sort((a, b) => a - b);\n\n return sorted.every((n, i) => n === i);\n};\n\nconst numericObjectToArray = (input: Record<string, unknown>): unknown[] =>\n Object.entries(input)\n .sort(([a], [b]) => Number(a) - Number(b))\n .map(([, value]) => value);\n\n/**\n * Recursively converts objects whose keys are a complete `0..n-1` sequence\n * (PHP-serialized \"sparse\" arrays) into real arrays. Everything else passes\n * through unchanged.\n */\nexport const convertNumericObjects = (input: unknown): unknown => {\n if (Array.isArray(input)) return input.map(convertNumericObjects);\n\n if (isPlainObject(input)) {\n if (hasOnlyNumericKeys(input)) return numericObjectToArray(input).map(convertNumericObjects);\n\n const out: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(input)) out[key] = convertNumericObjects(value);\n\n return out;\n }\n\n return input;\n};\n", "const isPlainObject = (input: unknown): input is Record<string, unknown> => {\n if (input === null || typeof input !== 'object') return false;\n\n const proto = Object.getPrototypeOf(input) as object | null;\n\n return proto === Object.prototype || proto === null;\n};\n\nconst camelCase = (key: string): string =>\n key.replace(/[-_\\s]+(.)?/g, (_, char: string | undefined) => (char ? char.toUpperCase() : ''));\n\nexport type ToCamelCase<S extends string> = S extends `${infer Head}_${infer Tail}` | `${infer Head}-${infer Tail}`\n ? `${Head}${Capitalize<ToCamelCase<Tail>>}`\n : S;\n\nexport type DeepCamelCase<T> = T extends (infer U)[]\n ? DeepCamelCase<U>[]\n : T extends object\n ? { [K in keyof T as ToCamelCase<K & string>]: DeepCamelCase<T[K]> }\n : T;\n\n/**\n * Recursively converts object keys to camelCase. Snake_case and kebab-case\n * are both handled; numeric array indices and primitives pass through\n * unchanged.\n *\n * Language keys used by the CAB schema (`text.content[<lang>]`, etc.) are\n * authored as plain lowercase tags (`en`, `de`, `fr`) by us \u2014 they have no\n * `_` or `-` to convert and survive camelCase as-is.\n */\nexport const deepCamelCase = <T>(input: T): DeepCamelCase<T> => {\n if (Array.isArray(input)) return input.map((item) => deepCamelCase(item)) as DeepCamelCase<T>;\n\n if (isPlainObject(input)) {\n const out: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(input)) {\n out[camelCase(key)] = deepCamelCase(value);\n }\n\n return out as DeepCamelCase<T>;\n }\n\n return input as DeepCamelCase<T>;\n};\n", "import { type TextColorName, type TextSizeName } from '~/schema/widgets/checkout-and-beyond/common';\nimport { type Mark } from '~/transforms/htmlToTiptap/types';\n\nexport const buildDefaultTextStyleMark = (\n style: { color?: TextColorName; fontSize?: TextSizeName } | undefined\n): Mark | null => {\n if (!style || (style.color === undefined && style.fontSize === undefined)) return null;\n\n return {\n attrs: {\n color: style.color ?? 'base',\n fontSize: style.fontSize ?? 'base',\n },\n type: 'textStyle',\n };\n};\n", "import { type StackEntry } from '~/transforms/htmlToTiptap/types';\n\nexport const closeTag = (stack: StackEntry[], name: string): void => {\n for (let index = stack.length - 1; index >= 0; index--) {\n if (stack[index].tag === name) {\n stack.length = index;\n break;\n }\n }\n};\n", "export const TAG_RE = /<(\\/)?([a-zA-Z][a-zA-Z0-9]*)((?:\\s+[^>]*?)?)\\s*(\\/)?>/g;\n\n/**\n * Tags that introduce a paragraph break on both open and close. Container tags\n * like `ul`/`ol`/`dl` are intentionally NOT here \u2014 their child `li`/`dt`/`dd`\n * elements already break, and including the containers would double-flush.\n */\nexport const BLOCK_TAGS = new Set([\n 'article',\n 'aside',\n 'blockquote',\n 'dd',\n 'div',\n 'dt',\n 'figcaption',\n 'figure',\n 'footer',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n 'header',\n 'hr',\n 'li',\n 'main',\n 'nav',\n 'p',\n 'pre',\n 'section',\n]);\n", "import { TiptapParagraph, type TiptapText } from '~/schema/widgets/checkout-and-beyond/text';\n\nexport const makeParagraph = (content: TiptapText[]): TiptapParagraph => TiptapParagraph.parse({ content });\n", "import { makeParagraph } from '~/transforms/htmlToTiptap/makeParagraph';\nimport { type State } from '~/transforms/htmlToTiptap/types';\n\nexport const flushParagraph = (state: State): void => {\n state.paragraphs.push(makeParagraph(state.currentRuns));\n state.currentRuns = [];\n};\n", "import { type StackEntry } from '~/transforms/htmlToTiptap/types';\n\nexport const isSkipping = (stack: StackEntry[] = []): boolean => stack.some(({ skip }) => skip);\n", "import { type Spacing } from '~/schema/widgets/checkout-and-beyond/common';\nimport { TiptapDocument, type TiptapParagraph } from '~/schema/widgets/checkout-and-beyond/text';\n\nexport const makeDoc = (content: TiptapParagraph[], blockSpacing: Spacing): TiptapDocument =>\n TiptapDocument.parse({ attrs: { blockSpacing }, content });\n", "const DYNAMIC_TOKEN_REGEX = /^\\{\\{\\s*[A-Za-z]+\\s*\\}\\}$/;\n\n/**\n * Protocols we'll preserve on `<a href>` when converting HTML to Tiptap. Any URL\n * whose `URL.protocol` falls outside this set (e.g. `javascript:`, `data:`,\n * `file:`, `vbscript:`) is dropped from the link mark \u2014 the text content is\n * kept but the click target is not. Renderers downstream still get to do their\n * own validation, but the package shouldn't be the one preserving an XSS\n * payload through the conversion.\n */\nconst ALLOWED_PROTOCOLS = new Set(['http:', 'https:', 'mailto:', 'tel:']);\n\n/**\n * Decides whether an `<a href>` value should survive HTML \u2192 Tiptap conversion\n * as a link mark. Allows `#`, dynamic `{{token}}` placeholders, root-relative\n * same-origin paths (e.g. Shopify's `/policies/privacy-policy`), and a fixed\n * allowlist of URL schemes; everything else (including `javascript:`, `data:`,\n * protocol-relative `//host` paths, other relative paths, and malformed URLs)\n * drops the link mark while keeping the surrounding text.\n *\n * @param href - Raw `href` attribute from the source HTML.\n *\n * @returns `true` if the URL should be preserved as a link mark.\n */\nexport const isValidHref = (href: string): boolean => {\n if (!href) return false;\n\n if (href === '#') return true;\n\n if (DYNAMIC_TOKEN_REGEX.test(href)) return true;\n\n /** Root-relative same-origin path (single leading slash); `//host` is protocol-relative, not same-origin. */\n if (href.startsWith('/') && !href.startsWith('//')) return true;\n\n try {\n const url = new URL(href);\n\n return ALLOWED_PROTOCOLS.has(url.protocol);\n } catch {\n return false;\n }\n};\n", "import { isValidHref } from '~/transforms/htmlToTiptap/isValidHref';\nimport { type Mark } from '~/transforms/htmlToTiptap/types';\n\n/**\n * The schema defaults for an `<a>` mark when the source HTML omits them. Match\n * `TiptapText` in `~/schema/widgets/checkout-and-beyond/text` so the sanitizer\n * resolves the same effective values the downstream parse would have used.\n */\nconst DEFAULT_TARGET = '_blank';\nconst DEFAULT_REL = 'noopener noreferrer nofollow';\n\n/**\n * Forces `noopener noreferrer` on every `_blank` link to defend against\n * reverse-tabnabbing (window.opener attacks). When the source omits `rel`\n * entirely, fall back to the schema default (`noopener noreferrer nofollow`).\n * When source `rel` is non-empty, preserve the existing tokens, drop `opener`,\n * and ensure the safe pair is present.\n *\n * Non-`_blank` targets pass through unchanged \u2014 they can't be tabnabbed.\n */\nconst ensureSafeRel = (rel: string, target: string): string => {\n if (target !== '_blank') return rel;\n\n const sourceTokens = (rel ?? '').split(/\\s+/).filter(Boolean);\n\n if (sourceTokens.length === 0) return DEFAULT_REL;\n\n const tokens = new Set(sourceTokens.filter((token) => token.toLowerCase() !== 'opener'));\n\n tokens.add('noopener');\n tokens.add('noreferrer');\n\n return Array.from(tokens).join(' ');\n};\n\nexport const buildLinkMark = (attrs: Record<string, string> = {}): Mark | null => {\n const { href } = attrs;\n\n if (!href || !isValidHref(href)) return null;\n\n // Resolve target BEFORE sanitizing rel so the safety guard sees the same\n // value the downstream schema parse will use.\n const target = attrs.target ?? DEFAULT_TARGET;\n\n return {\n attrs: {\n class: null,\n href,\n rel: ensureSafeRel(attrs.rel, target),\n target,\n },\n type: 'link',\n };\n};\n", "const NAMED_ENTITIES: Record<string, string> = {\n amp: '&',\n apos: \"'\",\n copy: '\u00A9',\n gt: '>',\n hellip: '\u2026',\n ldquo: '\u201C',\n lsquo: '\u2018',\n lt: '<',\n mdash: '\u2014',\n nbsp: ' ',\n ndash: '\u2013',\n quot: '\"',\n rdquo: '\u201D',\n reg: '\u00AE',\n rsquo: '\u2019',\n trade: '\u2122',\n} as const;\n\nexport const decodeEntities = (input: string = ''): string =>\n input.replace(/&(#x[\\da-f]+|#\\d+|[a-z][a-z\\d]*);/gi, (match, code: string) => {\n if (code[0] !== '#') return NAMED_ENTITIES[code.toLowerCase()] ?? match;\n\n const isHex = /^#x/i.test(code);\n const cp = parseInt(code.slice(isHex ? 2 : 1), isHex ? 16 : 10);\n\n return Number.isInteger(cp) && cp >= 0 && cp <= 0x10ffff ? String.fromCodePoint(cp) : match;\n });\n", "import { decodeEntities } from '~/transforms/htmlToTiptap/decodeEntities';\n\nconst ATTRIB_RE = /([a-zA-Z_:][\\w:.-]*)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'|([^\\s\"'`=<>]+)))?/g;\n\nexport const parseAttribs = (attrString: string): Record<string, string> => {\n const result: Record<string, string> = {};\n let match: RegExpExecArray | null;\n\n ATTRIB_RE.lastIndex = 0;\n\n while ((match = ATTRIB_RE.exec(attrString)) !== null) {\n result[match[1].toLowerCase()] = decodeEntities(match[2] ?? match[3] ?? match[4] ?? '');\n }\n\n return result;\n};\n", "import { type TextSizeName } from '~/schema/widgets/checkout-and-beyond/common';\nimport { buildLinkMark } from '~/transforms/htmlToTiptap/buildLinkMark';\nimport { parseAttribs } from '~/transforms/htmlToTiptap/parseAttribs';\nimport { type Mark, type StackEntry } from '~/transforms/htmlToTiptap/types';\n\nconst INLINE_MARK_TAGS: Record<string, 'bold' | 'italic' | 'strike'> = {\n b: 'bold',\n del: 'strike',\n em: 'italic',\n i: 'italic',\n s: 'strike',\n strike: 'strike',\n strong: 'bold',\n};\n\nconst HEADING_FONT_SIZE: Record<string, TextSizeName> = {\n h1: 'extraLarge',\n h2: 'large',\n h3: 'medium',\n h4: 'base',\n h5: 'small',\n h6: 'small',\n};\n\nconst STRIPPED_TAGS = ['embed', 'iframe', 'noscript', 'object', 'script', 'style', 'template'];\n\nconst marksForTag = (name: string, attrs: string): Mark[] => {\n if (INLINE_MARK_TAGS[name]) return [{ type: INLINE_MARK_TAGS[name] }];\n\n if (HEADING_FONT_SIZE[name]) {\n return [{ type: 'bold' }, { attrs: { color: 'base', fontSize: HEADING_FONT_SIZE[name] }, type: 'textStyle' }];\n }\n\n if (name === 'a') {\n const link = buildLinkMark(parseAttribs(attrs));\n\n return link ? [link] : [];\n }\n\n return [];\n};\n\nexport const openTag = (stack: StackEntry[], name: string, attrs: string): void => {\n stack.push({\n marks: marksForTag(name, attrs),\n skip: STRIPPED_TAGS.includes(name),\n tag: name,\n });\n};\n", "import { TiptapText } from '~/schema/widgets/checkout-and-beyond/text';\n\nimport { decodeEntities } from '~/transforms/htmlToTiptap/decodeEntities';\nimport { flushParagraph } from '~/transforms/htmlToTiptap/flushParagraph';\nimport { isSkipping } from '~/transforms/htmlToTiptap/isSkipping';\nimport { type Mark, type State } from '~/transforms/htmlToTiptap/types';\n\nexport const pushText = (state: State, rawText: string): void => {\n if (!rawText || isSkipping(state.stack)) return;\n\n decodeEntities(rawText)\n .split('\\n')\n .forEach((segment, index) => {\n if (index > 0) flushParagraph(state);\n\n if (!segment) return;\n\n const marks: Mark[] = state.stack.flatMap((entry) => entry.marks);\n\n if (state.defaultTextStyleMark && !marks.some((mark) => mark.type === 'textStyle')) {\n marks.push(state.defaultTextStyleMark);\n }\n\n state.currentRuns.push(TiptapText.parse(marks.length > 0 ? { marks, text: segment } : { text: segment }));\n });\n};\n", "const HTML_COMMENT_RE = /<!--[\\s\\S]*?-->/g;\n\nexport const stripHtmlComments = (html: string = ''): string => html.replace(HTML_COMMENT_RE, '');\n", "import { type Spacing, type TextColorName, type TextSizeName } from '~/schema/widgets/checkout-and-beyond/common';\nimport { type TiptapDocument } from '~/schema/widgets/checkout-and-beyond/text';\nimport { buildDefaultTextStyleMark } from '~/transforms/htmlToTiptap/buildDefaultTextStyleMark';\nimport { closeTag } from '~/transforms/htmlToTiptap/closeTag';\nimport { BLOCK_TAGS, TAG_RE } from '~/transforms/htmlToTiptap/constants';\nimport { flushParagraph } from '~/transforms/htmlToTiptap/flushParagraph';\nimport { isSkipping } from '~/transforms/htmlToTiptap/isSkipping';\nimport { makeDoc } from '~/transforms/htmlToTiptap/makeDoc';\nimport { makeParagraph } from '~/transforms/htmlToTiptap/makeParagraph';\nimport { openTag } from '~/transforms/htmlToTiptap/openTag';\nimport { pushText } from '~/transforms/htmlToTiptap/pushText';\nimport { stripHtmlComments } from '~/transforms/htmlToTiptap/stripHtmlComments';\nimport { type State } from '~/transforms/htmlToTiptap/types';\n\nexport type HtmlToTiptapOptions = {\n blockSpacing?: Spacing;\n defaultTextStyle?: { color?: TextColorName; fontSize?: TextSizeName };\n};\n\nconst maybeFlushParagraph = (state: State): void => {\n if (state.currentRuns.length > 0) flushParagraph(state);\n};\n\nexport const htmlToTiptap = (html: string, options: HtmlToTiptapOptions = {}): TiptapDocument => {\n const state: State = {\n currentRuns: [],\n defaultTextStyleMark: buildDefaultTextStyleMark(options.defaultTextStyle),\n listStack: [],\n paragraphs: [],\n stack: [],\n };\n const blockSpacing = options.blockSpacing ?? 'base';\n\n if (typeof html !== 'string' || !html) return makeDoc([makeParagraph([])], blockSpacing);\n\n const htmlWithoutComments = stripHtmlComments(html);\n let lastIndex = 0;\n let match: RegExpExecArray | null;\n\n TAG_RE.lastIndex = 0;\n\n while ((match = TAG_RE.exec(htmlWithoutComments)) !== null) {\n const [full, slash, rawName, attrs, selfClose] = match;\n\n if (match.index > lastIndex) pushText(state, htmlWithoutComments.slice(lastIndex, match.index));\n\n lastIndex = match.index + full.length;\n\n const name = rawName.toLowerCase();\n\n if (slash) {\n closeTag(state.stack, name);\n\n if (name === 'ul' || name === 'ol') state.listStack.pop();\n\n if (BLOCK_TAGS.has(name) && !isSkipping(state.stack)) maybeFlushParagraph(state);\n } else if (name === 'br') {\n if (!isSkipping(state.stack)) flushParagraph(state);\n } else if (name === 'hr') {\n if (!isSkipping(state.stack)) {\n maybeFlushParagraph(state);\n pushText(state, '\u2014\u2014\u2014');\n flushParagraph(state);\n }\n } else if (!selfClose) {\n if (BLOCK_TAGS.has(name) && !isSkipping(state.stack)) maybeFlushParagraph(state);\n\n if (name === 'ul' || name === 'ol') state.listStack.push({ counter: 0, ordered: name === 'ol' });\n\n openTag(state.stack, name, attrs);\n\n if (name === 'li' && state.listStack.length > 0) {\n const top = state.listStack[state.listStack.length - 1]!;\n\n if (top.ordered) top.counter += 1;\n\n pushText(state, top.ordered ? `${top.counter}. ` : '\u2022 ');\n }\n }\n }\n\n if (lastIndex < htmlWithoutComments.length) pushText(state, htmlWithoutComments.slice(lastIndex));\n\n maybeFlushParagraph(state);\n\n if (state.paragraphs.length === 0) flushParagraph(state);\n\n return makeDoc(state.paragraphs, blockSpacing);\n};\n", "/**\n * True when the input has `version === 2` \u2014 the marker for a current-generation\n * Checkout-and-Beyond root section. The transformer for CAB (`CABRootSection.parse`)\n * should ONLY run on values that pass this check; v1 widget shapes either get\n * converted (e.g. via `convertContentBlockToV2`) or pass through unchanged.\n *\n * @param input - The post-camelCase, post-numeric-fix upstream payload.\n *\n * @returns `true` if `input.version === 2`, otherwise `false`.\n */\nexport const isCABRootSection = (input: unknown): boolean => {\n if (!input || typeof input !== 'object') return false;\n\n return (input as { version?: unknown }).version === 2;\n};\n", "/**\n * Default localized labels for the switch-to-subscription button content, keyed by `buttonField` then locale.\n * The single source of truth shared by the admin editor and the read-time `convertLineItemEditorToV2` transform\n * so a widget renders identically whether migrated in admin or converted on the fly. `{{subscriptionDiscount}}`\n * is substituted per-plan at render \u2014 CAB tokens are camelCase by default; a legacy snake_case token in a v1\n * merchant override still resolves (the client camelCases unknown token keys against its camelCase variables).\n * `subscriptionOption` is the frequency-select option template (legacy\n * `SwitchToSubscriptionLanguageDefaults.subscription_option_label`); the client resolves `{{interval}}`\n * through `Intl.NumberFormat` unit style, so the noun arrives in the buyer's language, pluralized per count\n * from the runtime's CLDR data (English CLDR nouns are lowercase \u2014 an accepted divergence from legacy).\n */\nexport const SWITCH_LABELS = {\n subscriptionOption: {\n ar: '\u064A\u062A\u0645 \u0627\u0644\u062A\u0648\u0635\u064A\u0644 \u0643\u0644 {{frequency}} {{interval}}',\n cs: 'Doru\u010Den\u00ED ka\u017Ed\u00FDch {{frequency}} {{interval}}',\n da: 'Leveres hver {{frequency}} {{interval}}',\n de: 'Lieferung alle {{frequency}} {{interval}}',\n en: 'Delivers every {{frequency}} {{interval}}',\n es: 'Entrega cada {{frequency}} {{interval}}',\n fi: 'Toimitus {{frequency}} {{interval}} v\u00E4lein',\n fr: 'Livraison tous les {{frequency}} {{interval}}',\n ga: 'Seachadtar gach {{frequency}} {{interval}}',\n he: '\u05DE\u05E9\u05DC\u05D5\u05D7 \u05DB\u05DC {{frequency}} {{interval}}',\n hi: '\u0939\u0930 {{frequency}} {{interval}} \u092E\u0947\u0902 \u0921\u093F\u0932\u0940\u0935\u0930\u0940',\n id: 'Dikirim setiap {{frequency}} {{interval}}',\n it: 'Consegna ogni {{frequency}} {{interval}}',\n ja: '{{frequency}} {{interval}}\u3054\u3068\u306B\u304A\u5C4A\u3051',\n ko: '{{frequency}} {{interval}}\uB9C8\uB2E4 \uBC30\uC1A1',\n nl: 'Wordt elke {{frequency}} {{interval}} geleverd',\n no: 'Leveres hver {{frequency}} {{interval}}',\n pl: 'Dostawa co {{frequency}} {{interval}}',\n pt: 'Entrega a cada {{frequency}} {{interval}}',\n ru: '\u0414\u043E\u0441\u0442\u0430\u0432\u043A\u0430 \u043A\u0430\u0436\u0434\u044B\u0435 {{frequency}} {{interval}}',\n sv: 'Levereras var {{frequency}} {{interval}}',\n th: '\u0E08\u0E31\u0E14\u0E2A\u0E48\u0E07\u0E17\u0E38\u0E01 {{frequency}} {{interval}}',\n tr: 'Her {{frequency}} {{interval}} aral\u0131\u011F\u0131nda teslimat',\n uk: '\u0414\u043E\u0441\u0442\u0430\u0432\u043A\u0430 \u043A\u043E\u0436\u043D\u0456 {{frequency}} {{interval}}',\n vi: 'Giao h\u00E0ng m\u1ED7i {{frequency}} {{interval}}',\n zh: '\u6BCF {{frequency}} {{interval}} \u914D\u9001\u4E00\u6B21',\n },\n switchToOneTimePurchase: {\n ar: '\u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0625\u0644\u0649 \u0634\u0631\u0627\u0621 \u0644\u0645\u0631\u0629 \u0648\u0627\u062D\u062F\u0629',\n cs: 'P\u0159epnout na jednor\u00E1zov\u00FD n\u00E1kup',\n da: 'Skift til engangsk\u00F8b',\n de: 'Zu einmaligem Kauf wechseln',\n en: 'Switch to One-time Purchase',\n es: 'Cambiar a compra \u00FAnica',\n fi: 'Vaihda kertaluonteiseen ostoon',\n fr: 'Passer \u00E0 un achat unique',\n ga: 'Athraigh go ceannach aonuaire',\n he: '\u05E2\u05D1\u05D5\u05E8 \u05DC\u05E8\u05DB\u05D9\u05E9\u05D4 \u05D7\u05D3-\u05E4\u05E2\u05DE\u05D9\u05EA',\n hi: '\u090F\u0915 \u092C\u093E\u0930 \u0915\u0940 \u0916\u0930\u0940\u0926 \u092A\u0930 \u0938\u094D\u0935\u093F\u091A \u0915\u0930\u0947\u0902',\n id: 'Beralih ke pembelian satu kali',\n it: 'Passa all\u2019acquisto una tantum',\n ja: '1\u56DE\u9650\u308A\u306E\u8CFC\u5165\u306B\u5207\u308A\u66FF\u3048\u308B',\n ko: '\uC77C\uD68C\uC131 \uAD6C\uB9E4\uB85C \uC804\uD658',\n nl: 'Overschakelen naar eenmalige aankoop',\n no: 'Bytt til engangskj\u00F8p',\n pl: 'Prze\u0142\u0105cz na jednorazowy zakup',\n pt: 'Mudar para compra \u00FAnica',\n ru: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u0440\u0430\u0437\u043E\u0432\u0443\u044E \u043F\u043E\u043A\u0443\u043F\u043A\u0443',\n sv: 'Byt till eng\u00E5ngsk\u00F6p',\n th: '\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E40\u0E1B\u0E47\u0E19\u0E01\u0E32\u0E23\u0E0B\u0E37\u0E49\u0E2D\u0E04\u0E23\u0E31\u0E49\u0E07\u0E40\u0E14\u0E35\u0E22\u0E27',\n tr: 'Tek seferlik sat\u0131n almaya ge\u00E7',\n uk: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u0438\u0441\u044F \u043D\u0430 \u043E\u0434\u043D\u043E\u0440\u0430\u0437\u043E\u0432\u0443 \u043F\u043E\u043A\u0443\u043F\u043A\u0443',\n vi: 'Chuy\u1EC3n sang mua m\u1ED9t l\u1EA7n',\n zh: '\u5207\u6362\u4E3A\u4E00\u6B21\u6027\u8D2D\u4E70',\n },\n switchToSubscriptionNoDiscount: {\n ar: '\u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0625\u0644\u0649 \u0627\u0634\u062A\u0631\u0627\u0643',\n cs: 'P\u0159epnout na p\u0159edplatn\u00E9',\n da: 'Skift til abonnement',\n de: 'Zu einem Abonnement wechseln',\n en: 'Switch to Subscription',\n es: 'Cambiar a suscripci\u00F3n',\n fi: 'Vaihda tilaukseen',\n fr: 'Passer \u00E0 un abonnement',\n ga: 'Athraigh go s\u00EDnti\u00FAs',\n he: '\u05E2\u05D1\u05D5\u05E8 \u05DC\u05DE\u05E0\u05D5\u05D9',\n hi: '\u0938\u0926\u0938\u094D\u092F\u0924\u093E \u092A\u0930 \u0938\u094D\u0935\u093F\u091A \u0915\u0930\u0947\u0902',\n id: 'Beralih ke langganan',\n it: 'Passa all\u2019abbonamento',\n ja: '\u5B9A\u671F\u8CFC\u5165\u306B\u5207\u308A\u66FF\u3048\u308B',\n ko: '\uAD6C\uB3C5\uC73C\uB85C \uC804\uD658',\n nl: 'Overschakelen naar abonnement',\n no: 'Bytt til abonnement',\n pl: 'Prze\u0142\u0105cz na subskrypcj\u0119',\n pt: 'Mudar para assinatura',\n ru: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0443',\n sv: 'Byt till prenumeration',\n th: '\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E40\u0E1B\u0E47\u0E19\u0E01\u0E32\u0E23\u0E2A\u0E21\u0E31\u0E04\u0E23\u0E2A\u0E21\u0E32\u0E0A\u0E34\u0E01',\n tr: 'Aboneli\u011Fe ge\u00E7',\n uk: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u0438\u0441\u044F \u043D\u0430 \u043F\u0456\u0434\u043F\u0438\u0441\u043A\u0443',\n vi: 'Chuy\u1EC3n sang \u0111\u0103ng k\u00FD',\n zh: '\u5207\u6362\u4E3A\u8BA2\u9605',\n },\n switchToSubscriptionWithDiscount: {\n ar: '\u0627\u0644\u062A\u0628\u062F\u064A\u0644 \u0625\u0644\u0649 \u0627\u0634\u062A\u0631\u0627\u0643 \u0648\u062A\u0648\u0641\u064A\u0631 {{subscriptionDiscount}}%',\n cs: 'P\u0159epnout na p\u0159edplatn\u00E9 a u\u0161et\u0159it {{subscriptionDiscount}} %',\n da: 'Skift til abonnement og spar {{subscriptionDiscount}}%',\n de: 'Zu einem Abonnement wechseln und {{subscriptionDiscount}} % sparen',\n en: 'Switch to Subscription & Save {{subscriptionDiscount}}%',\n es: 'Cambiar a suscripci\u00F3n y ahorrar {{subscriptionDiscount}}%',\n fi: 'Vaihda tilaukseen ja s\u00E4\u00E4st\u00E4 {{subscriptionDiscount}} %',\n fr: 'Passer \u00E0 un abonnement et \u00E9conomiser {{subscriptionDiscount}} %',\n ga: 'Athraigh go s\u00EDnti\u00FAs agus s\u00E1bh\u00E1il {{subscriptionDiscount}}%',\n he: '\u05E2\u05D1\u05D5\u05E8 \u05DC\u05DE\u05E0\u05D5\u05D9 \u05D5\u05D7\u05E1\u05D5\u05DA {{subscriptionDiscount}}%',\n hi: '\u0938\u0926\u0938\u094D\u092F\u0924\u093E \u092A\u0930 \u0938\u094D\u0935\u093F\u091A \u0915\u0930\u0947\u0902 \u0914\u0930 {{subscriptionDiscount}}% \u092C\u091A\u093E\u090F\u0902',\n id: 'Beralih ke langganan dan hemat {{subscriptionDiscount}}%',\n it: 'Passa all\u2019abbonamento e risparmia {{subscriptionDiscount}}%',\n ja: '\u5B9A\u671F\u8CFC\u5165\u306B\u5207\u308A\u66FF\u3048\u3066{{subscriptionDiscount}}%\u304A\u5F97',\n ko: '\uAD6C\uB3C5\uC73C\uB85C \uC804\uD658\uD558\uACE0 {{subscriptionDiscount}}% \uC808\uC57D',\n nl: 'Overschakelen naar abonnement en {{subscriptionDiscount}}% besparen',\n no: 'Bytt til abonnement og spar {{subscriptionDiscount}}%',\n pl: 'Prze\u0142\u0105cz na subskrypcj\u0119 i oszcz\u0119d\u017A {{subscriptionDiscount}}%',\n pt: 'Mudar para assinatura e economizar {{subscriptionDiscount}}%',\n ru: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u043F\u043E\u0434\u043F\u0438\u0441\u043A\u0443 \u0438 \u0441\u044D\u043A\u043E\u043D\u043E\u043C\u0438\u0442\u044C {{subscriptionDiscount}}%',\n sv: 'Byt till prenumeration och spara {{subscriptionDiscount}}%',\n th: '\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E40\u0E1B\u0E47\u0E19\u0E01\u0E32\u0E23\u0E2A\u0E21\u0E31\u0E04\u0E23\u0E2A\u0E21\u0E32\u0E0A\u0E34\u0E01\u0E41\u0E25\u0E30\u0E1B\u0E23\u0E30\u0E2B\u0E22\u0E31\u0E14 {{subscriptionDiscount}}%',\n tr: 'Aboneli\u011Fe ge\u00E7 ve {{subscriptionDiscount}}% tasarruf et',\n uk: '\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u0438\u0441\u044F \u043D\u0430 \u043F\u0456\u0434\u043F\u0438\u0441\u043A\u0443 \u0442\u0430 \u0437\u0430\u043E\u0449\u0430\u0434\u0438\u0442\u0438 {{subscriptionDiscount}}%',\n vi: 'Chuy\u1EC3n sang \u0111\u0103ng k\u00FD v\u00E0 ti\u1EBFt ki\u1EC7m {{subscriptionDiscount}}%',\n zh: '\u5207\u6362\u4E3A\u8BA2\u9605\u5E76\u8282\u7701 {{subscriptionDiscount}}%',\n },\n} as const satisfies Record<string, Record<string, string>>;\n", "import { stripContentBlockHtml } from '~/transforms/contentBlockV1/stripContentBlockHtml';\n\n/**\n * The v1 label-override policy shared by the offer-card and line-item-editor converters: a defined v1\n * label ALWAYS passes through verbatim as the `en` entry over the localized defaults \u2014 existing widget\n * language is never rewritten (product owner, 2026-07-02); blank/whitespace falls back to the full\n * default locale set (legacy `getLabelWithFallback` parity). HTML the merchant typed into a label is\n * stripped first \u2014 `CABTextSection.content` rejects tag-shaped strings at parse, so a raw `<b>`-style\n * label would otherwise 500 the whole widget.\n */\nexport const localizedContent = (defaults: Record<string, string>, override: string | undefined) => {\n const trimmed = stripContentBlockHtml(override ?? '').trim();\n\n return trimmed ? { ...defaults, en: trimmed } : defaults;\n};\n", "import { WidgetType } from '~/schema/widgets/checkout-and-beyond/constants';\nimport { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { SWITCH_LABELS } from '~/schema/widgets/checkout-and-beyond/switchLabels';\nimport { type LineItemEditorSwitchLanguageV1 } from '~/schema/widgets/lineItemEditor';\nimport { type V1LineItemEditorConvertInput } from '~/transforms/lineItemEditorV1/types';\nimport { localizedContent } from '~/transforms/localizedContent';\n\n/** The v1 `switchToSubscription.language` key that overrides each `buttonField`'s English label. */\nconst OVERRIDE_KEY = {\n subscriptionOption: 'subscriptionOptionLabel',\n switchToOneTimePurchase: 'downgradeToOneTimeLabel',\n switchToSubscriptionNoDiscount: 'upgradeToSubscriptionWithoutDiscountLabel',\n switchToSubscriptionWithDiscount: 'upgradeToSubscriptionLabel',\n} as const satisfies Record<keyof typeof SWITCH_LABELS, keyof LineItemEditorSwitchLanguageV1>;\n\n/**\n * Translate a v1 line-item-editor widget into a `CABRootSection`: a `cartLine` section holding a\n * switch-to-subscription button, whose `buttonField`-tagged text labels use the shared localized\n * `SWITCH_LABELS` defaults with the v1 `switchToSubscription.language` value overriding `en` (same output the\n * admin editor produces, so runtime-converted and admin-migrated widgets render identically). The button is\n * omitted when the widget's switch is disabled.\n */\nconst BUTTON_KINDS = ['plain', 'primary', 'secondary'] as const;\n\nexport const convertLineItemEditorToV2 = ({ id, settings }: V1LineItemEditorConvertInput): CABRootSection => {\n const { switchToSubscription, switchToSubscriptionEnabled, tracking } = settings;\n const kind = settings.button?.kind;\n const buttonStyle = BUTTON_KINDS.includes(kind as (typeof BUTTON_KINDS)[number]) ? kind : 'plain';\n\n const labelSections = (Object.keys(SWITCH_LABELS) as (keyof typeof SWITCH_LABELS)[]).map((buttonField) => ({\n buttonField,\n content: localizedContent(\n SWITCH_LABELS[buttonField],\n switchToSubscription?.language?.[OVERRIDE_KEY[buttonField]]\n ),\n sectionType: 'text',\n }));\n\n return CABRootSection.parse({\n previewMode: settings.previewMode,\n sections: [\n {\n sections: switchToSubscriptionEnabled\n ? [\n {\n action: 'switchToSubscription',\n buttonStyle,\n disableDowngrade: switchToSubscription?.disableDowngrade ?? false,\n sections: labelSections,\n sectionType: 'button',\n },\n ]\n : [],\n sectionType: 'cartLine',\n },\n ],\n sectionType: 'layout',\n tracking: {\n enableAttribution: tracking?.enableAttribution ?? true,\n enableSource: tracking?.enableSource ?? true,\n enableWidget: tracking?.enableWidget ?? true,\n },\n type: WidgetType.ui_extension_line_item_editor,\n version: 2,\n widgetId: id,\n });\n};\n", "import { WidgetType } from '~/schema/widgets/checkout-and-beyond/constants';\nimport { type LineItemEditorV1 } from '~/schema/widgets/lineItemEditor';\n\n/**\n * The legacy `/widgets/settings` endpoint returns the widget's settings object directly (no envelope), so\n * the converter input is just `{ id, settings }` \u2014 the settings shape lives in the schema\n * (`LineItemEditorV1`) and is derived here, never re-declared.\n */\nexport type V1LineItemEditorConvertInput = {\n id: number;\n settings: LineItemEditorV1;\n};\n\n/** Identifies a v1 line-item-editor payload by version + type (mirrors `isContentBlockV1`). */\nexport const isLineItemEditorV1 = (data: unknown): data is LineItemEditorV1 => {\n if (!data || typeof data !== 'object') return false;\n\n const obj = data as Record<string, unknown>;\n\n return obj.version === 1 && obj.type === WidgetType.ui_extension_line_item_editor;\n};\n", "const DEFAULT_KNOWN_TOKENS = ['firstName', 'lastName', 'email'] as const;\n\nconst escapeForRegex = (literal: string): string => literal.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n/**\n * Rewrites legacy personalization tokens into the CAB-canonical `{{tokenName}}`\n * form expected by the client's `replaceVariables`. Specifically:\n *\n * - `{firstName}` (single brace) \u2192 `{{firstName}}`\n * - `{FirstName}` / `{FIRSTNAME}` (case variants) \u2192 `{{firstName}}`\n * - `{ firstName }` (internal whitespace) \u2192 `{{firstName}}`\n * - `{{firstName}}` (already canonical) \u2192 unchanged\n *\n * Pass `knownTokens` to control which names are normalized; anything not in the\n * list (e.g., an unrelated `{{foo}}` token) passes through untouched.\n */\nexport const normalizeTokens = (text: string, knownTokens: readonly string[] = DEFAULT_KNOWN_TOKENS): string => {\n if (typeof text !== 'string') return text;\n\n return knownTokens.reduce((acc, token) => {\n /**\n * Tokens standardize on camelCase; `_?` before each capital also matches the legacy snake_case\n * spelling ({remaining_amount} \u2192 {{remainingAmount}}).\n */\n const snakeTolerant = escapeForRegex(token).replace(/([A-Z])/g, '_?$1');\n const pattern = new RegExp(`\\\\{{1,2}\\\\s*${snakeTolerant}\\\\s*\\\\}{1,2}`, 'gi');\n\n return acc.replace(pattern, `{{${token}}}`);\n }, text);\n};\n", "import { htmlToTiptap } from '~/transforms/htmlToTiptap/htmlToTiptap';\nimport { normalizeTokens } from '~/transforms/normalizeTokens';\n\nconst HTML_TAG_RE = /<[a-zA-Z]/;\n\nconst containsHtml = (text: string): boolean => HTML_TAG_RE.test(text);\n\nconst isObject = (x: unknown): x is Record<string, unknown> => x !== null && typeof x === 'object' && !Array.isArray(x);\n\nconst normalizeLangValue = (value: unknown): unknown => {\n if (typeof value !== 'string') return value;\n\n const tokenized = normalizeTokens(value);\n\n return containsHtml(tokenized) ? htmlToTiptap(tokenized) : tokenized;\n};\n\n/**\n * Walks an untyped CABRootSection-shaped object (post deepCamelCase, pre schema\n * parse) and rewrites `text` sections' `content[lang]` strings so that:\n *\n * - `{firstName}` (single brace) becomes `{{firstName}}` (canonical), and\n * - HTML-laden strings become a fully-formed `TiptapDocument`.\n *\n * Plain strings pass through unchanged. Non-text sections only recurse into\n * their `sections` array; Tiptap docs and other nested objects are not walked.\n */\nexport const normalizeTextContent = (node: unknown): unknown => {\n if (Array.isArray(node)) return node.map(normalizeTextContent);\n\n if (!isObject(node)) return node;\n\n if (node.sectionType === 'text' && isObject(node.content)) {\n const nextContent: Record<string, unknown> = {};\n\n for (const [lang, value] of Object.entries(node.content)) {\n nextContent[lang] = normalizeLangValue(value);\n }\n\n return { ...node, content: nextContent };\n }\n\n if (Array.isArray(node.sections)) {\n return { ...node, sections: node.sections.map(normalizeTextContent) };\n }\n\n return node;\n};\n", "import { type CabShopConfig } from '~/schema/cabShopConfig';\n\nexport type ActiveExperiment = CabShopConfig['activeExperiments'][number];\n\n/** What the client needs to render the chosen variant and emit the A/B analytics. */\nexport type ResolvedExperiment = {\n /** The widget whose settings actually render \u2014 the chosen variant (not the placeholder). */\n elementId: number;\n experimentId: number;\n /** The experiment's raw engine type (e.g. `CheckoutOffer`); the analytics layer snake-cases it. */\n experimentType: string;\n /** The variant's experiment-element id \u2014 `abTestViewed`'s `defined_noun_id` half. */\n selectedId: number;\n};\n\n/**\n * Deterministic [0, 100) bucket from a seed string (FNV-1a \u2192 two-decimal percent). Replaces React's\n * `Math.random() * 100`: hashing `visitorId:experimentId` keeps a visitor in the SAME variant across\n * requests WITHOUT a client-stored selection \u2014 the server can't read the client's storage, so\n * stickiness has to come from a stable input it is handed (the visitor id).\n */\nconst rollPercent = (seed: string): number => {\n let hash = 0x811c9dc5;\n\n for (let index = 0; index < seed.length; index++) {\n hash ^= seed.charCodeAt(index);\n hash = Math.imul(hash, 0x01000193);\n }\n\n return ((hash >>> 0) % 10000) / 100;\n};\n\n/**\n * Picks the A/B variant for the placeholder widget `placeholderId`, or `undefined` when no experiment\n * targets it (the common case \u2014 render the placeholder itself). Walks the variants by cumulative\n * `traffic` weight against a visitor-stable roll, mirroring React's `useABTesting` selection but\n * server-side and deterministic. Falls back to the first variant when the weights under-cover the roll.\n */\nexport const resolveExperiment = (\n experiments: ActiveExperiment[],\n placeholderId: number,\n visitorId: string\n): ResolvedExperiment | undefined => {\n const experiment = experiments.find((candidate) => candidate.placeholderId === placeholderId);\n\n if (!experiment || experiment.data.length === 0) return undefined;\n\n const roll = rollPercent(`${visitorId}:${experiment.id}`);\n let cumulative = 0;\n\n const variant =\n experiment.data.find((candidate) => {\n cumulative += candidate.traffic;\n\n // Half-open roll [0, 100) with `<` (not `<=`): a 0-traffic bucket is never entered (so a paused\n // head can't capture the roll-0 visitor), and boundaries split evenly (50/50 \u2192 5000/5000).\n return roll < cumulative;\n }) ?? experiment.data[0];\n\n return {\n elementId: variant.elementId,\n experimentId: experiment.id,\n experimentType: experiment.type,\n selectedId: variant.id,\n };\n};\n", "/**\n * Default localized labels for the offer card's add-to-order button states and the opt-in undo banner,\n * keyed by slot then locale (same 26 locales as `SWITCH_LABELS`). The converter overlays a defined v1\n * merchant value as the `en` entry (verbatim) and falls back to these for blank/absent values, so a\n * migrated widget keeps its copy while new/unset widgets localize. `addedToCartMessage` tokens are\n * camelCase (CAB default); legacy snake_case tokens in merchant overrides still resolve client-side.\n */\nexport const OFFER_LABELS = {\n addedToCart: {\n ar: '\u062A\u0645\u062A \u0627\u0644\u0625\u0636\u0627\u0641\u0629!',\n cs: 'P\u0159id\u00E1no!',\n da: 'Tilf\u00F8jet!',\n de: 'Hinzugef\u00FCgt!',\n en: 'Added!',\n es: '\u00A1A\u00F1adido!',\n fi: 'Lis\u00E4tty!',\n fr: 'Ajout\u00E9 !',\n ga: 'Curtha leis!',\n he: '\u05E0\u05D5\u05E1\u05E3!',\n hi: '\u091C\u094B\u0921\u093C\u093E \u0917\u092F\u093E!',\n id: 'Ditambahkan!',\n it: 'Aggiunto!',\n ja: '\u8FFD\u52A0\u3057\u307E\u3057\u305F\uFF01',\n ko: '\uCD94\uAC00\uB428!',\n nl: 'Toegevoegd!',\n no: 'Lagt til!',\n pl: 'Dodano!',\n pt: 'Adicionado!',\n ru: '\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E!',\n sv: 'Tillagd!',\n th: '\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E41\u0E25\u0E49\u0E27!',\n tr: 'Eklendi!',\n uk: '\u0414\u043E\u0434\u0430\u043D\u043E!',\n vi: '\u0110\u00E3 th\u00EAm!',\n zh: '\u5DF2\u6DFB\u52A0\uFF01',\n },\n addedToCartMessage: {\n ar: '\u062A\u0645\u062A \u0625\u0636\u0627\u0641\u0629 {{quantity}} {{productTitle}} \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629.',\n cs: '{{quantity}} {{productTitle}} p\u0159id\u00E1no do ko\u0161\u00EDku.',\n da: '{{quantity}} {{productTitle}} lagt i kurven.',\n de: '{{quantity}} {{productTitle}} zum Warenkorb hinzugef\u00FCgt.',\n en: '{{quantity}} {{productTitle}} successfully added to cart.',\n es: '{{quantity}} {{productTitle}} a\u00F1adido al carrito.',\n fi: '{{quantity}} {{productTitle}} lis\u00E4tty ostoskoriin.',\n fr: '{{quantity}} {{productTitle}} ajout\u00E9 au panier.',\n ga: 'Cuireadh {{quantity}} {{productTitle}} sa chairt.',\n he: '{{quantity}} {{productTitle}} \u05E0\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4.',\n hi: '{{quantity}} {{productTitle}} \u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u093E \u0917\u092F\u093E\u0964',\n id: '{{quantity}} {{productTitle}} ditambahkan ke keranjang.',\n it: '{{quantity}} {{productTitle}} aggiunto al carrello.',\n ja: '{{quantity}} {{productTitle}}\u3092\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0\u3057\u307E\u3057\u305F\u3002',\n ko: '{{quantity}} {{productTitle}}\uC774(\uAC00) \uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00\uB418\uC5C8\uC2B5\uB2C8\uB2E4.',\n nl: '{{quantity}} {{productTitle}} toegevoegd aan winkelwagen.',\n no: '{{quantity}} {{productTitle}} lagt i handlekurven.',\n pl: '{{quantity}} {{productTitle}} dodano do koszyka.',\n pt: '{{quantity}} {{productTitle}} adicionado ao carrinho.',\n ru: '{{quantity}} {{productTitle}} \u0434\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u043E \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443.',\n sv: '{{quantity}} {{productTitle}} har lagts i varukorgen.',\n th: '\u0E40\u0E1E\u0E34\u0E48\u0E21 {{quantity}} {{productTitle}} \u0E25\u0E07\u0E15\u0E30\u0E01\u0E23\u0E49\u0E32\u0E41\u0E25\u0E49\u0E27',\n tr: '{{quantity}} {{productTitle}} sepete eklendi.',\n uk: '{{quantity}} {{productTitle}} \u0434\u043E\u0434\u0430\u043D\u043E \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430.',\n vi: '\u0110\u00E3 th\u00EAm {{quantity}} {{productTitle}} v\u00E0o gi\u1ECF h\u00E0ng.',\n zh: '{{quantity}} {{productTitle}} \u5DF2\u52A0\u5165\u8D2D\u7269\u8F66\u3002',\n },\n addingToCart: {\n ar: '\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0636\u0627\u0641\u0629...',\n cs: 'P\u0159id\u00E1v\u00E1n\u00ED...',\n da: 'Tilf\u00F8jer...',\n de: 'Wird hinzugef\u00FCgt...',\n en: 'Adding...',\n es: 'A\u00F1adiendo...',\n fi: 'Lis\u00E4t\u00E4\u00E4n...',\n fr: 'Ajout en cours...',\n ga: '\u00C1 chur leis...',\n he: '\u05DE\u05D5\u05E1\u05D9\u05E3...',\n hi: '\u091C\u094B\u0921\u093C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948...',\n id: 'Menambahkan...',\n it: 'Aggiunta in corso...',\n ja: '\u8FFD\u52A0\u4E2D...',\n ko: '\uCD94\uAC00 \uC911...',\n nl: 'Toevoegen...',\n no: 'Legger til...',\n pl: 'Dodawanie...',\n pt: 'Adicionando...',\n ru: '\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435...',\n sv: 'L\u00E4gger till...',\n th: '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E40\u0E1E\u0E34\u0E48\u0E21...',\n tr: 'Ekleniyor...',\n uk: '\u0414\u043E\u0434\u0430\u0432\u0430\u043D\u043D\u044F...',\n vi: '\u0110ang th\u00EAm...',\n zh: '\u6B63\u5728\u6DFB\u52A0...',\n },\n addToCart: {\n ar: '\u0623\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629',\n cs: 'P\u0159idat do ko\u0161\u00EDku',\n da: 'L\u00E6g i kurv',\n de: 'In den Warenkorb',\n en: 'Add to cart',\n es: 'A\u00F1adir al carrito',\n fi: 'Lis\u00E4\u00E4 ostoskoriin',\n fr: 'Ajouter au panier',\n ga: 'Cuir sa chairt',\n he: '\u05D4\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4',\n hi: '\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u0947\u0902',\n id: 'Tambahkan ke keranjang',\n it: 'Aggiungi al carrello',\n ja: '\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0',\n ko: '\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00',\n nl: 'In winkelwagen',\n no: 'Legg i handlekurven',\n pl: 'Dodaj do koszyka',\n pt: 'Adicionar ao carrinho',\n ru: '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443',\n sv: 'L\u00E4gg i varukorgen',\n th: '\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E15\u0E30\u0E01\u0E23\u0E49\u0E32',\n tr: 'Sepete ekle',\n uk: '\u0414\u043E\u0434\u0430\u0442\u0438 \u0432 \u043A\u043E\u0448\u0438\u043A',\n vi: 'Th\u00EAm v\u00E0o gi\u1ECF h\u00E0ng',\n zh: '\u52A0\u5165\u8D2D\u7269\u8F66',\n },\n redirectToCheckout: {\n ar: '\u0627\u0644\u062F\u0641\u0639',\n cs: 'Pokladna',\n da: 'Til kassen',\n de: 'Zur Kasse',\n en: 'Checkout',\n es: 'Finalizar compra',\n fi: 'Kassalle',\n fr: 'Paiement',\n ga: 'Seice\u00E1il amach',\n he: '\u05DC\u05EA\u05E9\u05DC\u05D5\u05DD',\n hi: '\u091A\u0947\u0915\u0906\u0909\u091F',\n id: 'Checkout',\n it: 'Cassa',\n ja: '\u30C1\u30A7\u30C3\u30AF\u30A2\u30A6\u30C8',\n ko: '\uACB0\uC81C\uD558\uAE30',\n nl: 'Afrekenen',\n no: 'Til kassen',\n pl: 'Do kasy',\n pt: 'Finalizar compra',\n ru: '\u041E\u0444\u043E\u0440\u043C\u0438\u0442\u044C \u0437\u0430\u043A\u0430\u0437',\n sv: 'Till kassan',\n th: '\u0E0A\u0E33\u0E23\u0E30\u0E40\u0E07\u0E34\u0E19',\n tr: '\u00D6deme',\n uk: '\u041E\u0444\u043E\u0440\u043C\u0438\u0442\u0438 \u0437\u0430\u043C\u043E\u0432\u043B\u0435\u043D\u043D\u044F',\n vi: 'Thanh to\u00E1n',\n zh: '\u7ED3\u8D26',\n },\n soldOut: {\n ar: '\u0646\u0641\u062F\u062A \u0627\u0644\u0643\u0645\u064A\u0629',\n cs: 'Vyprod\u00E1no',\n da: 'Udsolgt',\n de: 'Ausverkauft',\n en: 'Sold out',\n es: 'Agotado',\n fi: 'Loppuunmyyty',\n fr: '\u00C9puis\u00E9',\n ga: 'D\u00EDolta amach',\n he: '\u05D0\u05D6\u05DC \u05DE\u05D4\u05DE\u05DC\u05D0\u05D9',\n hi: '\u0938\u094D\u091F\u0949\u0915 \u0916\u093C\u0924\u094D\u092E',\n id: 'Habis terjual',\n it: 'Esaurito',\n ja: '\u58F2\u308A\u5207\u308C',\n ko: '\uD488\uC808',\n nl: 'Uitverkocht',\n no: 'Utsolgt',\n pl: 'Wyprzedane',\n pt: 'Esgotado',\n ru: '\u0420\u0430\u0441\u043F\u0440\u043E\u0434\u0430\u043D\u043E',\n sv: 'Sluts\u00E5ld',\n th: '\u0E2A\u0E34\u0E19\u0E04\u0E49\u0E32\u0E2B\u0E21\u0E14',\n tr: 'T\u00FCkendi',\n uk: '\u0420\u043E\u0437\u043F\u0440\u043E\u0434\u0430\u043D\u043E',\n vi: 'H\u1EBFt h\u00E0ng',\n zh: '\u5DF2\u552E\u7F44',\n },\n undo: {\n ar: '\u062A\u0631\u0627\u062C\u0639',\n cs: 'Zp\u011Bt',\n da: 'Fortryd',\n de: 'R\u00FCckg\u00E4ngig',\n en: 'Undo',\n es: 'Deshacer',\n fi: 'Kumoa',\n fr: 'Annuler',\n ga: 'Cealaigh',\n he: '\u05D1\u05D8\u05DC',\n hi: '\u092A\u0942\u0930\u094D\u0935\u0935\u0924 \u0915\u0930\u0947\u0902',\n id: 'Urungkan',\n it: 'Annulla',\n ja: '\u5143\u306B\u623B\u3059',\n ko: '\uC2E4\uD589 \uCDE8\uC18C',\n nl: 'Ongedaan maken',\n no: 'Angre',\n pl: 'Cofnij',\n pt: 'Desfazer',\n ru: '\u041E\u0442\u043C\u0435\u043D\u0438\u0442\u044C',\n sv: '\u00C5ngra',\n th: '\u0E40\u0E25\u0E34\u0E01\u0E17\u0E33',\n tr: 'Geri al',\n uk: '\u0421\u043A\u0430\u0441\u0443\u0432\u0430\u0442\u0438',\n vi: 'Ho\u00E0n t\u00E1c',\n zh: '\u64A4\u9500',\n },\n} as const satisfies Record<string, Record<string, string>>;\n", "import { OFFER_LABELS } from '~/schema/widgets/checkout-and-beyond/offerLabels';\n\n/**\n * The canonical base \"Checkout Offers\" CAB layout \u2014 designed in the editor by Jeff (REB-23182) and\n * exported. It was authored inside the content-block editor (the only surface that can lay out an\n * offers section), so the export originally carried that widget type + the test store's data source;\n * those have been cleaned here to read as a real offer template. `buildOfferTemplate` still strips any\n * residual section ids (so each created widget gets fresh ones) and injects the per-widget name +\n * editor mode at runtime. Regenerate by re-exporting + the generator script, not by hand \u2014 with ONE\n * hand-completed exception a re-export must preserve: the add button's `addedToCart`/`soldOut`/\n * `redirectToCheckout` slots (`OFFER_LABELS` defaults). The editor export carried only\n * `addingToCart`/`addToCart`, which left the sold-out/added/Buy-Now states falling back to the add\n * label at runtime (guarded by a `buildOfferTemplate` test).\n */\nexport const OFFER_TEMPLATE_SEED = {\n alignment: {\n horizontal: 'center',\n vertical: 'top',\n },\n border: {\n radius: 'base',\n style: 'none',\n width: 'thick',\n },\n direction: 'rows',\n editorMode: 'checkoutExtension',\n grid: {\n columns: ['auto'],\n rows: ['auto'],\n },\n padding: 'tight',\n previewMode: false,\n sections: [\n {\n alignment: {\n horizontal: 'end',\n vertical: 'top',\n },\n autoAdvanceInterval: 0,\n border: {\n radius: 'base',\n style: 'none',\n width: 'base',\n },\n direction: 'rows',\n grid: {\n columns: ['auto'],\n rows: ['auto', 'auto'],\n },\n itemsAtOnce: 2,\n padding: 'none',\n sections: [\n {\n alignment: {\n horizontal: 'start',\n vertical: 'middle',\n },\n border: {\n radius: 'base',\n style: 'none',\n width: 'base',\n },\n direction: 'columns',\n grid: {\n columns: ['auto', 'auto'],\n rows: ['auto'],\n },\n name: 'pagination',\n padding: 'none',\n sections: [\n {\n action: 'goToPrevPage',\n buttonStyle: 'plain',\n disableDowngrade: false,\n popover: {\n alignment: 'center',\n position: 'blockStart',\n },\n sections: [\n {\n buttonField: 'buttonLabel',\n content: {\n ar: '\u2039',\n cs: '\u2039',\n da: '\u2039',\n de: '\u2039',\n en: '\u2039',\n es: '\u2039',\n fi: '\u2039',\n fr: '\u2039',\n ga: '\u2039',\n he: '\u2039',\n hi: '\u2039',\n id: '\u2039',\n it: '\u2039',\n ja: '\u2039',\n ko: '\u2039',\n nl: '\u2039',\n no: '\u2039',\n pl: '\u2039',\n pt: '\u2039',\n ru: '\u2039',\n sv: '\u2039',\n th: '\u2039',\n tr: '\u2039',\n uk: '\u2039',\n vi: '\u2039',\n zh: '\u2039',\n },\n sectionType: 'text',\n },\n ],\n sectionType: 'button',\n },\n {\n action: 'goToNextPage',\n buttonStyle: 'plain',\n disableDowngrade: false,\n popover: {\n alignment: 'center',\n position: 'blockStart',\n },\n sections: [\n {\n buttonField: 'buttonLabel',\n content: {\n ar: '\u203A',\n cs: '\u203A',\n da: '\u203A',\n de: '\u203A',\n en: '\u203A',\n es: '\u203A',\n fi: '\u203A',\n fr: '\u203A',\n ga: '\u203A',\n he: '\u203A',\n hi: '\u203A',\n id: '\u203A',\n it: '\u203A',\n ja: '\u203A',\n ko: '\u203A',\n nl: '\u203A',\n no: '\u203A',\n pl: '\u203A',\n pt: '\u203A',\n ru: '\u203A',\n sv: '\u203A',\n th: '\u203A',\n tr: '\u203A',\n uk: '\u203A',\n vi: '\u203A',\n zh: '\u203A',\n },\n sectionType: 'text',\n },\n ],\n sectionType: 'button',\n },\n ],\n sectionType: 'layout',\n spacing: 'base',\n width: 100,\n },\n {\n alignment: {\n horizontal: 'start',\n vertical: 'middle',\n },\n border: {\n radius: 'base',\n style: 'base',\n width: 'base',\n },\n direction: 'rows',\n grid: {\n columns: ['15%'],\n rows: ['auto', 'auto'],\n },\n padding: 'base',\n sections: [\n {\n alignment: {\n horizontal: 'start',\n vertical: 'middle',\n },\n border: {\n radius: 'base',\n style: 'none',\n width: 'base',\n },\n direction: 'grid',\n grid: {\n columns: ['15%', 'fill', 'auto'],\n rows: ['auto'],\n },\n padding: 'none',\n sections: [\n {\n altText: '',\n aspectRatio: null,\n border: {\n radius: 'base',\n style: 'none',\n width: 'base',\n },\n category: null,\n name: 'Product Image',\n naturalHeight: 0,\n naturalWidth: 0,\n objectFit: 'cover',\n sectionType: 'image',\n source: '{{productImage}}',\n width: 100,\n },\n {\n content: {\n en: {\n attrs: {\n blockSpacing: 'none',\n },\n content: [\n {\n attrs: {\n textAlign: 'start',\n },\n content: [\n {\n marks: [\n {\n attrs: {\n color: 'base',\n fontSize: 'medium',\n },\n type: 'textStyle',\n },\n {\n type: 'bold',\n },\n ],\n text: '{{productAndVariantTitle}}',\n type: 'text',\n },\n ],\n type: 'paragraph',\n },\n {\n attrs: {\n textAlign: 'start',\n },\n content: [\n {\n marks: [\n {\n attrs: {\n color: 'accent',\n fontSize: 'medium',\n },\n type: 'textStyle',\n },\n ],\n text: '{{variantPrice}}',\n type: 'text',\n },\n ],\n type: 'paragraph',\n },\n ],\n type: 'doc',\n },\n },\n name: 'Product Info',\n sectionType: 'text',\n },\n {\n action: 'addToOrder',\n buttonStyle: 'primary',\n disableDowngrade: false,\n popover: {\n alignment: 'center',\n position: 'blockStart',\n },\n sections: [\n {\n buttonField: 'addingToCart',\n content: {\n ar: '\u064A\u062A\u0645 \u0627\u0644\u0625\u0636\u0627\u0641\u0629 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629',\n cs: 'P\u0159id\u00E1v\u00E1m do ko\u0161\u00EDku',\n da: 'Tilf\u00F8jer til kurv',\n de: 'Wird zum Warenkorb hinzugef\u00FCgt',\n en: 'Adding...',\n es: 'Agregando al carrito',\n fi: 'Lis\u00E4t\u00E4\u00E4n ostoskoriin',\n fr: 'Ajout au panier',\n ga: '\u00C1 Chur le Cairt',\n he: '\u05DE\u05D5\u05E1\u05D9\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4',\n hi: '\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C \u0930\u0939\u0947 \u0939\u0948\u0902',\n id: 'Menambahkan ke Keranjang',\n it: 'Aggiungendo al carrello',\n ja: '\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0\u4E2D',\n ko: '\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00 \uC911',\n nl: 'Toevoegen aan winkelwagen',\n no: 'Legger i handlekurv',\n pl: 'Dodaj\u0119 do koszyka',\n pt: 'Adicionando ao carrinho',\n ru: '\u0414\u043E\u0431\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443',\n sv: 'L\u00E4gger till i varukorg',\n th: '\u0E01\u0E33\u0E25\u0E31\u0E07\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E43\u0E19\u0E23\u0E16\u0E40\u0E02\u0E47\u0E19',\n tr: 'Sepete Ekleniyor',\n uk: '\u0414\u043E\u0434\u0430\u0454\u043C\u043E \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430',\n vi: '\u0110ang th\u00EAm v\u00E0o gi\u1ECF h\u00E0ng',\n zh: '\u6B63\u5728\u52A0\u5165\u8D2D\u7269\u8F66',\n },\n sectionType: 'text',\n },\n {\n buttonField: 'addToCart',\n content: {\n ar: '\u0623\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0633\u0644\u0629',\n cs: 'P\u0159idat do ko\u0161\u00EDku',\n da: 'F\u00F8j til kurv',\n de: 'In den Warenkorb',\n en: 'Add',\n es: 'Agregar al carrito',\n fi: 'Lis\u00E4\u00E4 ostoskoriin',\n fr: 'Ajouter au panier',\n ga: 'Cuir le Cairt',\n he: '\u05D4\u05D5\u05E1\u05E3 \u05DC\u05E2\u05D2\u05DC\u05D4',\n hi: '\u0915\u093E\u0930\u094D\u091F \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u0947\u0902',\n id: 'Tambah ke Keranjang',\n it: 'Aggiungi al carrello',\n ja: '\u30AB\u30FC\u30C8\u306B\u8FFD\u52A0',\n ko: '\uC7A5\uBC14\uAD6C\uB2C8\uC5D0 \uCD94\uAC00',\n nl: 'Toevoegen aan winkelwagen',\n no: 'Legg i handlekurv',\n pl: 'Dodaj do koszyka',\n pt: 'Adicionar ao carrinho',\n ru: '\u0414\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u0440\u0437\u0438\u043D\u0443',\n sv: 'L\u00E4gg i varukorg',\n th: '\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E25\u0E07\u0E43\u0E19\u0E23\u0E16\u0E40\u0E02\u0E47\u0E19',\n tr: 'Sepete Ekle',\n uk: '\u0414\u043E\u0434\u0430\u0442\u0438 \u0434\u043E \u043A\u043E\u0448\u0438\u043A\u0430',\n vi: 'Th\u00EAm v\u00E0o gi\u1ECF h\u00E0ng',\n zh: '\u52A0\u5165\u8D2D\u7269\u8F66',\n },\n sectionType: 'text',\n },\n {\n buttonField: 'addedToCart',\n content: OFFER_LABELS.addedToCart,\n sectionType: 'text',\n },\n {\n buttonField: 'soldOut',\n content: OFFER_LABELS.soldOut,\n sectionType: 'text',\n },\n {\n buttonField: 'redirectToCheckout',\n content: OFFER_LABELS.redirectToCheckout,\n sectionType: 'text',\n },\n ],\n sectionType: 'button',\n },\n ],\n sectionType: 'layout',\n spacing: 'base',\n width: 100,\n },\n {\n alignment: {\n horizontal: 'start',\n vertical: 'top',\n },\n border: {\n radius: 'base',\n style: 'none',\n width: 'base',\n },\n direction: 'rows',\n grid: {\n columns: ['auto'],\n rows: ['auto'],\n },\n padding: 'none',\n sections: [\n {\n errorMessages: {\n en: {\n max: 'Maximum quantity allowed is {{max}}',\n min: 'Minimum quantity required is {{min}}',\n neg: 'Quantity cannot be negative',\n },\n },\n inputType: 'select',\n max: 10,\n min: 1,\n sectionType: 'quantity',\n },\n ],\n sectionType: 'layout',\n spacing: 'base',\n width: 100,\n },\n {\n limit: 3,\n sectionType: 'dataSource',\n },\n {\n sectionType: 'products',\n },\n ],\n sectionType: 'offers',\n spacing: 'base',\n width: 100,\n },\n ],\n sectionType: 'carousel',\n spacing: 'base',\n width: 100,\n },\n ],\n sectionType: 'layout',\n spacing: 'base',\n targetArea: {\n icon: 'splitscreen_left',\n label: 'Main Column',\n width: '503px',\n },\n type: 'shopify_checkout_extension',\n version: 2,\n width: 100,\n};\n", "/**\n * Minimal v1 Offer (Checkout Offers / product recommendations) input types.\n * The legacy widget's settings `type` is the generic `shopify_checkout_extension`\n * (the offer is the \"base\" checkout-extension type; other widgets carry\n * `ui_extension_*`), which uniquely identifies it at the settings level.\n */\nimport { type TiptapDocument } from '~/schema/widgets/checkout-and-beyond/text';\n\nexport const SHOPIFY_CHECKOUT_EXTENSION = 'shopify_checkout_extension' as const;\n\nexport type V1OfferLanguage = {\n addedToCart?: string;\n addingToCart?: string;\n addToCart?: string;\n /** Subscribe \u2192 one-time label for the offers `switchToSubscription` button. */\n cartSwitchToOnetime?: string;\n /** One-time \u2192 subscribe label (carries `{{subscription_discount}}`) for the `switchToSubscription` button. */\n cartSwitchToSubscription?: string;\n description?: string;\n /** Buy Now link label on off-checkout surfaces (thank-you / order-status), real key `redirect_to_checkout`. */\n redirectToCheckout?: string;\n /** Real payload key is `sold_out_label` \u2192 `soldOutLabel` (NOT `soldOut`). */\n soldOutLabel?: string;\n /** Opt-in undo banner shown after a buyer adds a recommended product. */\n successBannerEnabled?: boolean;\n successBannerMessageRte?: TiptapDocument | string;\n superTitle?: string;\n title?: string;\n /** Legacy \"Upgrade to Subscription and Save {{subscription_discount}}%\" upsell label. */\n upgradeToSubscription?: string;\n};\n\n/** v1 per-product text styling; `textSize` is the CAB `textSizeNames` enum verbatim. */\nexport type V1TextStyle = {\n textEmphasis?: 'base' | 'bold' | 'italic';\n textSize?: 'extraSmall' | 'small' | 'base' | 'medium' | 'large' | 'extraLarge';\n};\n\n/** v1 `displaySettings` \u2014 the controls behind product/variant/image/review presentation. */\nexport type V1OfferDisplaySettings = {\n image?: { imageFit?: 'contain' | 'cover' };\n product?: V1TextStyle;\n reviews?: { color?: string; size?: 'small' | 'default' | 'large' };\n variant?: V1TextStyle;\n};\n\n/**\n * v1 layout is per-breakpoint; CAB has no breakpoints, so the converter collapses them.\n * `style` drives orientation: list \u2192 rows, line \u2192 columns, grid \u2192 grid (none \u2192 rows).\n */\nexport type V1OfferBreakpointLayout = {\n carousel?: boolean;\n columns?: number;\n showPaginations?: boolean;\n style?: 'grid' | 'line' | 'list' | 'none';\n};\n\nexport type V1OfferSettings = {\n /** Free-form in real payloads; the converter safelists to the CAB enum (junk \u2192 'primary'). */\n button?: { kind?: string };\n /** `showSavingAmount` false hides the compare-at (sale) price; `amount`/`type`/`discountedFrom`/`discountedBy` drive the discount-setting price computation (emitted onto the offers section for the client's pricing pass). */\n discount?: {\n amount?: number | string;\n discountedBy?: string;\n discountedFrom?: string;\n /** Merchant-facing promo label (e.g. \"Enjoy 10% off!\") \u2192 carried onto the data-source discount. */\n message?: string;\n /** How many items the discount applies to (defaults to 1) \u2192 carried onto the discount section. */\n quantity?: number;\n showSavingAmount?: boolean;\n type?: string;\n };\n /** Per-product/variant/image/review presentation controls. */\n displaySettings?: V1OfferDisplaySettings;\n /** Engine path appended to `/api/v1` (e.g. '/products/recommended'). */\n endpoint?: string | null;\n images?: { source?: 'product' | 'variant' };\n /**\n * Nominally boolean, but legacy data carries \"yes\"/\"no\" strings (reviewsio, in prod) and numeric\n * 1/0 (PHP serialization) \u2014 the converter coerces both so neither throws at the schema boolean.\n */\n integrations?: Record<string, boolean | number | string>;\n language?: V1OfferLanguage;\n layout?: { large?: V1OfferBreakpointLayout; medium?: V1OfferBreakpointLayout; small?: V1OfferBreakpointLayout };\n limit?: number;\n location?: 'checkout' | 'order-status' | 'thank-you';\n /** The legacy widget's name, present in the settings payload; carried to the converted root. */\n name?: string;\n previewMode?: boolean;\n productOptions?: {\n hideOutOfStockVariants?: boolean;\n matchVariant?: boolean;\n matchVariantOutOfStock?: boolean;\n /** 'hide' (or absent) hides the per-card product description; any other value shows it. */\n showProductDescription?: string;\n showVariantOptions?: 'always' | 'default' | 'never';\n showVariantsAsProducts?: boolean;\n /** 'hide' (or absent) hides the selected-variant title line; any other value shows it. */\n showVariantTitle?: string;\n };\n productType?: 'both' | 'one-time' | 'subscription';\n quantityInputs?: {\n enabled?: boolean;\n /** Custom over-max error copy \u2192 CAB `errorMessages.en.max`. */\n maxError?: string;\n maxValue?: number;\n /** Custom under-min error copy \u2192 CAB `errorMessages.en.min`. */\n minError?: string;\n minValue?: number;\n /** Custom negative-value error copy \u2192 CAB `errorMessages.en.neg`. */\n negativeError?: string;\n /** Stepper kind ('dropdown-select' | 'buttons-manual-input') \u2192 CAB `inputType` (select | number). */\n type?: string;\n };\n /** Default subscribe-vs-one-time when `productType` is `both`. */\n subscriptionIsDefault?: boolean;\n tracking?: { enableAttribution?: boolean; enableSource?: boolean; enableWidget?: boolean };\n treatAsGwp?: boolean;\n type: typeof SHOPIFY_CHECKOUT_EXTENSION;\n /** Absent on real checkout-offers payloads; only `type` is the reliable discriminator. */\n version?: 1;\n /** v1 `viewOptions`: `displayActions === false` hides the variant selector (legacy `getVariantSelect`). */\n viewOptions?: { displayActions?: boolean; variantSelector?: 'select' | 'radio' | 'button' };\n};\n\nexport type V1OfferConvertInput = {\n id: number;\n /** The legacy widget's name; set on the converted root (the admin save schema requires it). */\n name?: string;\n settings: V1OfferSettings;\n};\n\n/**\n * The offer's settings `type` uniquely identifies it. Unlike the `ui_extension_*` widgets, the legacy\n * checkout-offers payload carries NO top-level `version` \u2014 so we must NOT gate on it (doing so silently\n * dropped real offers to the passthrough branch). `version: 2` payloads are already claimed upstream by\n * `isCABRootSection`, so they never reach here.\n */\nexport const isOfferV1 = (data: unknown): data is V1OfferSettings => {\n if (!data || typeof data !== 'object') return false;\n\n return (data as Record<string, unknown>).type === SHOPIFY_CHECKOUT_EXTENSION;\n};\n", "import { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { OFFER_TEMPLATE_SEED } from '~/transforms/offerV1/offerTemplateSeed';\nimport { SHOPIFY_CHECKOUT_EXTENSION } from '~/transforms/offerV1/types';\n\nconst LOCATION_TO_EDITOR_MODE = {\n checkout: 'checkoutExtension',\n 'order-status': 'orderStatusPage',\n 'thank-you': 'thankYouPage',\n} as const;\n\nexport type BuildOfferTemplateInput = {\n location?: 'checkout' | 'order-status' | 'thank-you';\n name?: string;\n};\n\n/**\n * Build a brand-new \"Checkout Offers\" widget as a `CABRootSection` from the designed base layout.\n * Pure and synchronous (admin-side, network-free): overlays the per-widget `name` + editor mode and\n * the offer widget type, then parses. The seed carries NO section ids (enforced by a test), so `parse`\n * mints fresh `uuidv7`s on every call \u2014 two created widgets never share section ids.\n */\nexport const buildOfferTemplate = ({ location, name }: BuildOfferTemplateInput = {}): CABRootSection =>\n CABRootSection.parse({\n ...OFFER_TEMPLATE_SEED,\n editorMode: LOCATION_TO_EDITOR_MODE[location ?? 'checkout'],\n ...(name && { name }),\n previewMode: false,\n type: SHOPIFY_CHECKOUT_EXTENSION,\n });\n", "import { OFFER_LABELS } from '~/schema/widgets/checkout-and-beyond/offerLabels';\nimport { SWITCH_LABELS } from '~/schema/widgets/checkout-and-beyond/switchLabels';\nimport { localizedContent } from '~/transforms/localizedContent';\nimport { type V1OfferSettings, type V1TextStyle } from '~/transforms/offerV1/types';\n\n/** v1 `viewOptions.variantSelector` \u2192 CAB `variants.selector` ('select' is the v1 name for a dropdown menu). */\nconst VARIANT_SELECTOR = { button: 'button', radio: 'radio', select: 'menu' } as const;\n\n/**\n * A single-token Tiptap doc carrying a v1 text style: `textSize` is the CAB `fontSize`\n * verbatim (identical enums); `textEmphasis` adds a bold/italic mark ('base' adds none).\n */\nconst buildStyledText = (token: string, style: V1TextStyle | undefined, color = 'base') => {\n const marks: Record<string, unknown>[] = [\n { attrs: { color, fontSize: style?.textSize ?? 'base' }, type: 'textStyle' },\n ];\n\n if (style?.textEmphasis === 'bold') marks.push({ type: 'bold' });\n\n if (style?.textEmphasis === 'italic') marks.push({ type: 'italic' });\n\n return { content: [{ content: [{ marks, text: token, type: 'text' }], type: 'paragraph' }], type: 'doc' };\n};\n\n/**\n * The price line: the variant price, optionally followed by a strikethrough,\n * subdued compare-at price. The extension resolves `{{variantCompareAtPrice}}`\n * to '' off-sale, so the strikethrough disappears unless the variant is genuinely\n * discounted. `discount.showSavingAmount` false drops the compare-at node entirely.\n */\nconst buildPriceContent = (settings: V1OfferSettings) => {\n const content: Record<string, unknown>[] = [{ text: '{{variantPrice}}', type: 'text' }];\n\n if (settings.discount?.showSavingAmount !== false) {\n content.push(\n { text: ' ', type: 'text' },\n {\n marks: [{ type: 'strike' }, { attrs: { color: 'subdued' }, type: 'textStyle' }],\n text: '{{variantCompareAtPrice}}',\n type: 'text',\n }\n );\n }\n\n return { content: [{ content, type: 'paragraph' }], type: 'doc' };\n};\n\n/** A `reviews` star section, emitted only when the merchant has a review integration enabled. */\nconst buildReviews = (settings: V1OfferSettings): Record<string, unknown>[] => {\n if (!settings.integrations || !Object.values(settings.integrations).some(Boolean)) return [];\n\n const reviews = settings.displaySettings?.reviews;\n\n return [\n {\n ...(reviews?.color && { color: reviews.color }),\n sectionType: 'reviews',\n ...(reviews?.size && { size: reviews.size }),\n },\n ];\n};\n\n/** The recommended product's image; objectFit comes from v1 `displaySettings.image.imageFit`. */\nconst buildImage = (settings: V1OfferSettings): Record<string, unknown> => ({\n ...(settings.displaySettings?.image?.imageFit && {\n objectFit: settings.displaySettings.image.imageFit,\n }),\n /** Accessible name for the product image (legacy `OfferImage` used `accessibilityDescription={variantTitle}`); the renderer interpolates it, so an empty default would announce the image as decorative. */\n altText: '{{variantTitle}}',\n sectionType: 'image',\n source: settings.images?.source === 'product' ? '{{productImage}}' : '{{variantImage}}',\n width: 100,\n});\n\n/** The product title text, styled from v1 `displaySettings.product`. */\nconst buildTitle = (settings: V1OfferSettings): Record<string, unknown> => ({\n content: { en: buildStyledText('{{productTitle}}', settings.displaySettings?.product) },\n sectionType: 'text',\n});\n\n/** The price line (variant price + on-sale compare-at strikethrough). */\nconst buildPrice = (settings: V1OfferSettings): Record<string, unknown> => ({\n content: { en: buildPriceContent(settings) },\n sectionType: 'text',\n});\n\n/** The selected-variant title line, gated by `productOptions.showVariantTitle` ('hide'/absent = off). */\nconst buildVariantTitle = (settings: V1OfferSettings): Record<string, unknown>[] => {\n const show = settings.productOptions?.showVariantTitle;\n\n if (!show || show === 'hide') return [];\n\n return [\n {\n content: { en: buildStyledText('{{variantTitle}}', settings.displaySettings?.variant) },\n sectionType: 'text',\n },\n ];\n};\n\n/** The per-card product description, gated by `productOptions.showProductDescription` ('hide'/absent = off). */\nconst buildDescription = (settings: V1OfferSettings): Record<string, unknown>[] => {\n const show = settings.productOptions?.showProductDescription;\n\n if (!show || show === 'hide') return [];\n\n return [{ content: { en: buildStyledText('{{productDescription}}', undefined) }, sectionType: 'text' }];\n};\n\n/** The variant selector, unless the merchant hid variant options or turned actions off entirely. */\nconst buildVariants = (settings: V1OfferSettings): Record<string, unknown>[] => {\n /** Legacy `getVariantSelect`: `view_options.display_actions === false` suppresses the selector. */\n if (settings.viewOptions?.displayActions === false) return [];\n\n if (settings.productOptions?.showVariantOptions === 'never') return [];\n\n const selector = settings.viewOptions?.variantSelector;\n\n return [\n {\n hideOutOfStockVariants: !!settings.productOptions?.hideOutOfStockVariants,\n ...(selector && { selector: VARIANT_SELECTOR[selector] }),\n sectionType: 'variants',\n },\n ];\n};\n\n/** v1 stepper kind \u2192 CAB `inputType`. Unknown/absent \u2192 omitted so the schema default ('select') applies. */\nconst QUANTITY_INPUT_TYPE: Record<string, 'number' | 'select'> = {\n 'buttons-manual-input': 'number',\n 'dropdown-select': 'select',\n};\n\n/** Custom quantity error copy \u2192 CAB `errorMessages.en.{min,max,neg}`; omitted entirely when none is set. */\nconst buildQuantityErrors = (quantity: NonNullable<V1OfferSettings['quantityInputs']>) => {\n const en = {\n ...(quantity.maxError && { max: quantity.maxError }),\n ...(quantity.minError && { min: quantity.minError }),\n ...(quantity.negativeError && { neg: quantity.negativeError }),\n };\n\n return Object.keys(en).length ? { errorMessages: { en } } : {};\n};\n\n/** The quantity stepper, when the merchant enabled quantity input. */\nconst buildQuantity = (settings: V1OfferSettings): Record<string, unknown>[] => {\n const quantity = settings.quantityInputs;\n\n if (!quantity?.enabled) return [];\n\n const inputType = quantity.type ? QUANTITY_INPUT_TYPE[quantity.type] : undefined;\n\n // Legacy quantity had no upper bound (DefaultQuantityRule.MAX = null) and allowed 0; the CAB\n // schema pins `max` to [1, 100] and `min` to >= 1. Clamp instead of passing through so a legacy\n // `maxValue: 250` (or a 0) degrades to a valid widget rather than throwing at parse.\n const max = Math.min(Math.max(quantity.maxValue ?? 10, 1), 100);\n // Also cap `min` at `max` \u2014 the schema has no cross-field refine, so a legacy `min > max` (e.g.\n // {maxValue: 5, minValue: 8}) would parse but render a degenerate stepper (REB #766).\n const min = Math.min(Math.max(quantity.minValue ?? 1, 1), max);\n\n return [\n {\n ...buildQuantityErrors(quantity),\n ...(inputType && { inputType }),\n max,\n min,\n sectionType: 'quantity',\n },\n ];\n};\n\n/**\n * The in-card subscribe / one-time toggle: a `switchToSubscription` button with its four label slots\n * (the same `SWITCH_LABELS` slot set as the line-item editor, including the `subscriptionOption`\n * frequency template, so the frequency select localizes). Emitted when the merchant offers\n * subscriptions (`productType` both/subscription); the extension shows it per-product by selling-plan\n * availability. v1 carries the with-discount upsell (`upgradeToSubscription`) plus the cart switch\n * labels; anything blank/absent falls back to the shared localized defaults.\n */\nconst buildSubscriptionButton = (settings: V1OfferSettings): Record<string, unknown>[] => {\n if (settings.productType !== 'both' && settings.productType !== 'subscription') return [];\n\n const language = settings.language;\n\n const slot = (buttonField: keyof typeof SWITCH_LABELS, override: string | undefined) => ({\n buttonField,\n content: localizedContent(SWITCH_LABELS[buttonField], override),\n sectionType: 'text',\n });\n\n return [\n {\n action: 'switchToSubscription',\n buttonStyle: 'plain',\n /** A `subscription` widget offers no one-time purchase (legacy's offers checkbox renders only when `isProductTypeBoth`); suppress the downgrade so the buyer can't switch to one-time on a subscription-only offer. */\n ...(settings.productType === 'subscription' && { disableDowngrade: true }),\n sections: [\n slot('subscriptionOption', undefined),\n slot('switchToOneTimePurchase', language?.cartSwitchToOnetime),\n slot('switchToSubscriptionNoDiscount', language?.cartSwitchToSubscription),\n slot('switchToSubscriptionWithDiscount', language?.upgradeToSubscription),\n ],\n sectionType: 'button',\n },\n ];\n};\n\n/** v1 stores free-form `button.kind`; anything outside the CAB enum falls back to the legacy 'primary'. */\nconst BUTTON_KINDS = ['plain', 'primary', 'secondary'] as const;\n\n/** The add-to-order button with its four label slots (add / adding / added / sold-out). */\nconst buildAddButton = (settings: V1OfferSettings): Record<string, unknown> => {\n const kind = settings.button?.kind;\n\n const slot = (\n buttonField: 'addedToCart' | 'addingToCart' | 'addToCart' | 'redirectToCheckout' | 'soldOut',\n override?: string\n ) => ({\n buttonField,\n content: localizedContent(OFFER_LABELS[buttonField], override),\n sectionType: 'text',\n });\n\n return {\n action: 'addToOrder',\n buttonStyle: BUTTON_KINDS.includes(kind as (typeof BUTTON_KINDS)[number]) ? kind : 'primary',\n sections: [\n slot('addToCart', settings.language?.addToCart),\n slot('addingToCart', settings.language?.addingToCart),\n slot('addedToCart', settings.language?.addedToCart),\n slot('soldOut', settings.language?.soldOutLabel),\n // Off-checkout Buy Now: the label the button shows once it links to the created checkout.\n slot('redirectToCheckout', settings.language?.redirectToCheckout),\n ],\n sectionType: 'button',\n };\n};\n\n/** A `rows` layout wrapping sections into one grid cell (so they stack within a column of the card). */\nconst rowsLayout = (sections: Record<string, unknown>[]): Record<string, unknown> => ({\n direction: 'rows',\n sections,\n sectionType: 'layout',\n});\n\n/**\n * The per-offer product card: the sections rendered once per recommended product (the\n * offers renderer mounts a product context, so the `{{...}}` tokens resolve per product).\n *\n * `horizontal` mirrors the v1 layout orientation (see `convertOfferToV2`):\n * - horizontal (v1 `list`/default, vertical-stacked products): a 3-column grid card \u2014\n * image | title/price/reviews/variants | actions \u2014 matching the compact V1 row.\n * - vertical (v1 `grid`/`line`, side-by-side products): a flat top-to-bottom stack\n * (image \u2192 title \u2192 price \u2192 \u2026 \u2192 button), the narrow column card.\n *\n * Quantity is a full-width row beneath the card in the horizontal layout; in the vertical\n * layout it sits inline in the stack. NOT carried: the savings-amount badge (no live v1\n * control) and variant text styling (no CAB field).\n */\nexport const buildOfferCard = (settings: V1OfferSettings, horizontal: boolean): Record<string, unknown>[] => {\n const image = buildImage(settings);\n const title = buildTitle(settings);\n const variantTitle = buildVariantTitle(settings);\n const price = buildPrice(settings);\n const description = buildDescription(settings);\n const reviews = buildReviews(settings);\n const variants = buildVariants(settings);\n const quantity = buildQuantity(settings);\n const subscription = buildSubscriptionButton(settings);\n const addButton = buildAddButton(settings);\n\n if (!horizontal) {\n return [\n image,\n title,\n ...variantTitle,\n price,\n ...description,\n ...reviews,\n ...variants,\n ...quantity,\n ...subscription,\n addButton,\n ];\n }\n\n const info = rowsLayout([title, ...variantTitle, price, ...description, ...reviews, ...variants]);\n const actions = [...subscription, addButton];\n const actionsCell = actions.length === 1 ? actions[0] : rowsLayout(actions);\n\n const card = {\n direction: 'grid',\n grid: { columns: ['15%', 'fill', 'auto'], rows: ['auto'] },\n sections: [image, info, actionsCell],\n sectionType: 'layout',\n };\n\n return [card, ...quantity];\n};\n", "import { OFFER_LABELS } from '~/schema/widgets/checkout-and-beyond/offerLabels';\nimport { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { convertContentBlockTextToV2 } from '~/transforms/contentBlockV1/convertContentBlockTextToV2';\nimport { stripContentBlockHtml } from '~/transforms/contentBlockV1/stripContentBlockHtml';\nimport { buildOfferCard } from '~/transforms/offerV1/offerCard';\nimport {\n SHOPIFY_CHECKOUT_EXTENSION,\n type V1OfferBreakpointLayout,\n type V1OfferConvertInput,\n type V1OfferSettings,\n} from '~/transforms/offerV1/types';\n\nconst LOCATION_TO_EDITOR_MODE = {\n checkout: 'checkoutExtension',\n 'order-status': 'orderStatusPage',\n 'thank-you': 'thankYouPage',\n} as const;\n\n/**\n * v1 per-breakpoint `layout.style` \u2192 CAB product-list `direction`. This is the product-TO-product\n * orientation and the card orientation flips with it (see `convertOfferToV2`):\n * - `grid`/`line` \u2192 products sit side-by-side (`grid`/`columns`); each card is a vertical stack.\n * - `list`/`none`/absent \u2192 products stack vertically (`rows`); each card is a horizontal row.\n * The v1 carousel toggle writes exactly these two: VERTICAL \u2192 `list`, HORIZONTAL \u2192 `grid`.\n */\nconst STYLE_TO_DIRECTION = {\n grid: 'grid',\n line: 'columns',\n list: 'rows',\n none: 'rows',\n} as const;\n\nconst directionForStyle = (style: V1OfferBreakpointLayout['style']) => (style ? STYLE_TO_DIRECTION[style] : 'rows');\n\n/**\n * The product-to-product layout \u2014 it belongs on the CONTAINER that holds the offers (the carousel\n * wrapper), NOT on the offers section. The renderer repeats the offers layout per product into its\n * parent's stack/grid, so a `grid` direction with N `'fill'` columns lays the products out N-across;\n * `list`/`none` stay a vertical stack.\n *\n * `'fill'` (equal share) \u2014 NOT `'auto'` (sizes to content), which yields unequal columns and so\n * unequal `objectFit: contain` image heights across products.\n */\nconst buildProductListLayout = (direction: string, columns: number) =>\n direction === 'grid'\n ? { direction, grid: { columns: Array.from({ length: Math.max(columns, 1) }, () => 'fill'), rows: ['auto'] } }\n : { direction };\n\nconst hasHeaderText = (language: V1OfferSettings['language']): boolean =>\n !!(language?.title || language?.superTitle || language?.description);\n\n/**\n * v1 `discountedFrom` \u2192 CAB `discountSources`. v1's \"Discounted From\" / \"Compare Price With\" select\n * stores `price` / `compare_at_price` directly; the legacy `original_price` (written in Shopify-Functions\n * mode) is the regular price, i.e. `price`. Unknown values are omitted (the CAB enum would reject them).\n */\nconst DISCOUNTED_FROM: Record<string, 'compare_at_price' | 'price'> = {\n compare_at_price: 'compare_at_price',\n original_price: 'price',\n price: 'price',\n};\n\n/**\n * The active widget-level discount as the `CABDiscount` carried on the DATA-SOURCE section \u2014 the field\n * the extension's price forecast actually reads (`dataSource.discount` \u2192 `priceVariant`); a discount\n * emitted anywhere else never reaches the card price. Undefined when there's no active discount;\n * `showSavingAmount` is a card-display concern handled in `buildOfferCard`.\n */\nconst dataSourceDiscount = (discount: V1OfferSettings['discount']): Record<string, unknown> | undefined => {\n if (!discount?.type || discount.type === 'none') return undefined;\n\n const discountedFrom = discount.discountedFrom ? DISCOUNTED_FROM[discount.discountedFrom] : undefined;\n\n return {\n amount: discount.amount ?? 0,\n ...(discount.discountedBy && { discountedBy: discount.discountedBy }),\n ...(discountedFrom && { discountedFrom }),\n type: discount.type,\n };\n};\n\n/**\n * The same discount as the config-only `discount` section just above the undo banner \u2014 the editor-facing\n * home of the FULL v1 shape (`message`/`quantity` have no `CABDiscount` counterpart). Both projections\n * come from the one v1 input in the same pass, so they cannot drift apart.\n */\nconst buildDiscountSection = (discount: V1OfferSettings['discount']): Record<string, unknown>[] => {\n const base = dataSourceDiscount(discount);\n\n if (!base) return [];\n\n return [\n {\n ...base,\n ...(discount?.message && { message: discount.message }),\n ...(discount?.quantity != null && { quantity: discount.quantity }),\n sectionType: 'discount',\n },\n ];\n};\n\n/**\n * The banner's success message content: a defined v1 message overrides `en`, absent falls back to the\n * localized defaults (P4 language policy). A string message is sanitized (a raw-HTML label would fail\n * `CABTextSection.content` and 500 the widget); an RTE doc passes through as authored. A string that\n * sanitizes to empty falls back to the defaults, same as absent.\n */\nconst bannerMessageContent = (message: NonNullable<V1OfferSettings['language']>['successBannerMessageRte']) => {\n const sanitized = typeof message === 'string' ? stripContentBlockHtml(message) : message;\n\n return sanitized ? { ...OFFER_LABELS.addedToCartMessage, en: sanitized } : OFFER_LABELS.addedToCartMessage;\n};\n\n/**\n * Legacy integrations values are nominally boolean but prod data carries \"yes\"/\"no\" strings\n * (React special-cased exactly this for reviewsio: only 'true'/'yes' count as enabled) and numeric\n * 1/0 (legacy PHP serialization). Coerce every value so neither a string nor a number can throw at\n * the schema's `z.boolean()` and kill the widget: only 'true'/'yes' and 1 count as enabled.\n */\nconst coerceIntegrations = (integrations: Record<string, boolean | number | string>): Record<string, boolean> =>\n Object.fromEntries(\n Object.entries(integrations).map(([key, value]) => {\n if (typeof value === 'string') return [key, ['true', 'yes'].includes(value.toLowerCase())];\n\n if (typeof value === 'number') return [key, value === 1];\n\n return [key, value];\n })\n );\n\n/** The opt-in undo banner: a success `banner` of the message + a plain undo button. */\nconst buildBanner = (language: V1OfferSettings['language']): Record<string, unknown>[] =>\n language?.successBannerEnabled\n ? [\n {\n /**\n * The banner-level tag is the extraction/routing key on BOTH renderers (React CAB's\n * `isBannerType` + marker check; the Preact extension's `isUndoBanner`) \u2014 without it\n * the banner renders per card as an always-visible plain success banner and the\n * cart-scoped undo rail never runs. The schema's default offers tree carries it too.\n */\n buttonField: 'undoAddToOrder',\n color: 'success',\n dismissible: true,\n sections: [\n {\n content: bannerMessageContent(language.successBannerMessageRte),\n sectionType: 'text',\n },\n {\n action: 'undoAddToOrder',\n buttonStyle: 'plain',\n /**\n * Tagged `undoAddToOrder`, never `buttonLabel` \u2014 the renderers (React CAB and\n * the Preact extension) and the schema's default offers tree resolve that slot.\n */\n sections: [\n { buttonField: 'undoAddToOrder', content: OFFER_LABELS.undo, sectionType: 'text' },\n ],\n sectionType: 'button',\n },\n ],\n sectionType: 'banner',\n },\n ]\n : [];\n\n/**\n * Translates a v1 Offer (Checkout Offers / product recommendations) widget into\n * a `CABRootSection`: an optional header (title/superTitle/description, reusing\n * the content-block text converter) over a `carousel` wrapper that ALWAYS contains\n * the `offers` section (the carousel is the required structural parent; it only\n * paginates when the v1 layout has carousel on). The offers section's `dataSource`\n * child carries the engine fetch config; its remaining children are the\n * per-offer card (see `buildOfferCard`).\n *\n * v1 `layout` is per-breakpoint; CAB has none, so the converter collapses to\n * the largest provided breakpoint. A widget-level discount lands on the data\n * source's `discount` field (what the extension prices cards from) plus a\n * config-only `discount` section, and an opt-in undo `banner` is appended after\n * the data source (discount above, banner pinned last) when each is configured.\n */\nexport const convertOfferToV2 = ({ id, name, settings }: V1OfferConvertInput): CABRootSection => {\n const layout = settings.layout?.large ?? settings.layout?.medium ?? settings.layout?.small;\n const columns = layout?.columns ?? 1;\n const direction = directionForStyle(layout?.style);\n const listLayout = buildProductListLayout(direction, columns);\n\n // The card orientation is the inverse of the product-list orientation: vertically-stacked\n // products (`rows`) carry a compact horizontal card (image | info | add); side-by-side products\n // (`grid`/`columns`) carry a narrow vertical card (image \u2192 info \u2192 add).\n const horizontalCard = direction === 'rows';\n\n const discount = dataSourceDiscount(settings.discount);\n\n const dataSource = {\n ...(settings.endpoint && { dataSourcePath: settings.endpoint }),\n ...(discount && { discount }),\n ...(settings.integrations && { integrations: coerceIntegrations(settings.integrations) }),\n ...(settings.limit !== undefined && { limit: settings.limit }),\n matchVariant: !!settings.productOptions?.matchVariant,\n matchVariantOutOfStock: !!settings.productOptions?.matchVariantOutOfStock,\n ...(settings.productType && { productType: settings.productType }),\n sectionType: 'dataSource',\n ...(settings.subscriptionIsDefault && { subscriptionIsDefault: true }),\n ...(settings.treatAsGwp && { treatAsGwp: true }),\n };\n\n // The visible card sections come first so their indices stay contiguous from\n // the top (the admin UI prepends newly-added visible sections). The trailing\n // config-only sections are never rendered per-card: data source (engine fetch\n // config), then the optional discount, then the undo banner pinned to the very\n // bottom. `offers` keeps the default `rows` direction; the card's own\n // orientation is baked into the sections `buildOfferCard` returns.\n const offers = {\n sections: [\n ...buildOfferCard(settings, horizontalCard),\n dataSource,\n ...buildDiscountSection(settings.discount),\n ...buildBanner(settings.language),\n ],\n sectionType: 'offers',\n };\n\n // Offers ALWAYS live inside a `carousel` section \u2014 it's the structural wrapper the CAB offers\n // architecture requires, regardless of whether the widget actually paginates (the name is\n // historical). It only shows pagination when there are more products than `itemsAtOnce`, so a\n // non-carousel v1 widget sets `itemsAtOnce` to the full limit and shows everything at once. The\n // product-list layout (direction/grid from the v1 style + columns) rides on this wrapper.\n const display = {\n autoAdvanceInterval: 0,\n // `itemsAtOnce` feeds the carousel schema's `.min(1)`; a legacy `columns`/`limit` of 0 would\n // otherwise throw at parse, so floor it at 1 (the carousel still shows a product per page).\n itemsAtOnce: Math.max(layout?.carousel ? columns : (settings.limit ?? columns), 1),\n ...listLayout,\n sections: [offers],\n sectionType: 'carousel',\n };\n\n return CABRootSection.parse({\n direction: 'rows',\n editorMode: LOCATION_TO_EDITOR_MODE[settings.location ?? 'checkout'],\n // The widget name is required by the admin save schema; carry the legacy widget's name through.\n ...(name && { name }),\n previewMode: settings.previewMode,\n sections: [\n ...(hasHeaderText(settings.language)\n ? [{ content: { en: convertContentBlockTextToV2(settings.language) }, sectionType: 'text' }]\n : []),\n display,\n ],\n tracking: {\n enableAttribution: settings.tracking?.enableAttribution ?? true,\n enableSource: settings.tracking?.enableSource ?? true,\n enableWidget: settings.tracking?.enableWidget ?? true,\n },\n type: SHOPIFY_CHECKOUT_EXTENSION,\n version: 2,\n widgetId: id,\n });\n};\n", "import { type z } from 'zod';\n\nimport { convertNumericObjects } from '~/transforms/convertNumericObjects';\nimport { deepCamelCase } from '~/transforms/deepCamelCase';\n\n/**\n * Runs the shielded-CDN response through the canonical pipeline:\n *\n * raw \u2192 deepCamelCase \u2192 convertNumericObjects \u2192 transform? \u2192 schema.parse\n *\n * `schema.parse` hydrates `.default(...)` values and surfaces any drift as a\n * ZodError. The optional `transform` step is for normalization that must run\n * before* validation \u2014 e.g. converting HTML-laden text content into Tiptap\n * documents (since the canonical CAB schema rejects HTML strings outright).\n *\n * @param schema - The canonical Zod schema to validate against.\n * @param raw - Untrusted upstream JSON.\n * @param transform - Optional pre-parse transform (defaults to identity).\n *\n * @returns The parsed-and-default-hydrated `z.infer<S>`.\n */\nexport const parseShielded = <S extends z.ZodType>(\n schema: S,\n raw: unknown,\n transform: (input: unknown) => unknown = (input) => input\n): z.infer<S> => schema.parse(transform(convertNumericObjects(deepCamelCase(raw))));\n", "export const UI_EXTENSION_PROGRESS_BAR = 'ui_extension_progress_bar' as const;\n\n/**\n * Per-currency free-shipping thresholds as production actually writes them: each amount is a FLAT sibling\n * key (CENTS, ISO code any casing) alongside `enabled`, while `currencies` is the admin's array of enabled\n * code strings \u2014 NOT a code\u2192amount map. The onsite reader indexes it flat (`presentment[code]`), same as the\n * smart-cart tier shape.\n */\nexport type V1PresentmentCurrencies = {\n [code: string]: number | string | string[] | boolean | undefined;\n currencies?: string[];\n enabled?: boolean;\n};\n\nexport type V1ProgressBarSettings = {\n barSettings: {\n barType: 'shipping' | 'smart-cart';\n configLabelsAndText?: {\n /** v1 field name carries this typo. Supports `{{remaining_amount}}`. */\n amoundRemaining?: string;\n amountReached?: string;\n };\n countryCodes?: string[];\n freeShippingOptions?: {\n freeShippingOnAll?: boolean;\n freeShippingOnSubscriptions?: boolean;\n presentmentCurrencies?: V1PresentmentCurrencies;\n };\n limitCountries?: boolean;\n /** Shop-currency DOLLARS (e.g. 75 for $75). */\n unlockPrice?: number;\n };\n location?: 'checkout' | 'order-status' | 'thank-you';\n previewMode?: boolean;\n type: typeof UI_EXTENSION_PROGRESS_BAR;\n version: 1;\n};\n\nexport type V1ProgressBarConvertInput = {\n id: number;\n /** The shop theme's `buttonBackground` (bar fill), resolved by the caller; stays absent when unresolved. */\n progressColor?: string;\n settings: V1ProgressBarSettings;\n};\n\nexport const isProgressBarV1 = (data: unknown): data is V1ProgressBarSettings => {\n if (!data || typeof data !== 'object') return false;\n\n const obj = data as Record<string, unknown>;\n\n return (\n obj.version === 1 &&\n obj.type === UI_EXTENSION_PROGRESS_BAR &&\n !!obj.barSettings &&\n typeof obj.barSettings === 'object'\n );\n};\n\n/**\n * Only `barType: 'shipping'` carries its full config in the widget settings.\n * Smart-cart bars reference settings that live in the smart-cart config (a\n * separate fetch in the old runtime) \u2014 they pass through unconverted until a\n * server-side source for that config exists.\n */\nexport const isConvertibleProgressBarV1 = (data: unknown): data is V1ProgressBarSettings =>\n isProgressBarV1(data) && data.barSettings.barType === 'shipping';\n", "import { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { normalizeTextContent } from '~/transforms/normalizeTextContent';\nimport { normalizeTokens } from '~/transforms/normalizeTokens';\nimport {\n UI_EXTENSION_PROGRESS_BAR,\n type V1PresentmentCurrencies,\n type V1ProgressBarConvertInput,\n} from '~/transforms/progressBarV1/types';\n\nconst LOCATION_TO_EDITOR_MODE = {\n checkout: 'checkoutExtension',\n 'order-status': 'orderStatusPage',\n 'thank-you': 'thankYouPage',\n} as const;\n\nconst DEFAULT_REMAINING = 'Spend {{remainingAmount}} more to unlock free shipping!';\nconst DEFAULT_REACHED = \"Congratulations! You've unlocked free shipping!\";\n\n/**\n * Lowercased per-currency thresholds (cents) harvested from the FLAT presentment keys as production writes\n * them (`{ enabled, currencies: ['cad'], cad: 9900 }`) \u2014 `currencies` is the admin's enabled-code ARRAY, not\n * a code\u2192amount map, so amounts sit as flat siblings. Drops `enabled`, `currencies`, and malformed values.\n * Mirrors the onsite reader (`presentment[code]`) and the smart-cart tier converter.\n */\nconst toThresholds = (presentment?: V1PresentmentCurrencies): Record<string, number> => {\n if (!presentment?.enabled) return {};\n\n const thresholds: Record<string, number> = {};\n\n for (const [code, cents] of Object.entries(presentment)) {\n if (code === 'enabled' || code === 'currencies') continue;\n\n const value = Math.round(Number(cents));\n\n if (Number.isFinite(value) && value >= 0) thresholds[code.toLowerCase()] = value;\n }\n\n return thresholds;\n};\n\ntype TextSectionInput = Record<string, unknown>;\n\n/**\n * The progress-bar widget layout blueprint (decided 2026-06-12): a `rows`\n * layout with the progress bar in the first row, a `columns` layout of the\n * tiers' labels in the second row (omitted when no tier has a label), and any\n * other labels as further rows. The v1 SHIPPING bar has a single unlabeled\n * tier, so it emits just the bar row \u2014 the multi-tier smart-cart conversion\n * reuses this builder when its settings source exists.\n */\nexport const buildProgressBarLayout = (\n progressBar: Record<string, unknown>,\n tierLabels: TextSectionInput[],\n extraRows: TextSectionInput[] = []\n) => ({\n direction: 'rows',\n sections: [\n progressBar,\n ...(tierLabels.length > 0 ? [{ direction: 'columns', sections: tierLabels, sectionType: 'layout' }] : []),\n ...extraRows,\n ],\n sectionType: 'layout',\n});\n\n/**\n * `freeShippingOnAll` maps to a zero threshold (always reached). `freeShippingOnSubscriptions` rides on the\n * section so the client treats the bar as reached when the cart holds a subscription item (a live-cart\n * condition the server can't precompute).\n */\nexport const convertProgressBarToV2 = ({ id, progressColor, settings }: V1ProgressBarConvertInput): CABRootSection => {\n const { barSettings } = settings;\n const labels = barSettings.configLabelsAndText;\n const alwaysReached = barSettings.freeShippingOptions?.freeShippingOnAll === true;\n\n const progressBar = {\n /**\n * `limit_countries` enabled with an EMPTY list hid the bar everywhere in React (country \u2208 []\n * is never true), but the schema reads an empty countryCodes as UNRESTRICTED \u2014 that\n * misconfiguration would flip the bar visible. 'XX' (ISO 3166 user-assigned, never a real\n * buyer country) preserves the hide-everywhere reading without a schema change.\n */\n countryCodes: barSettings.limitCountries\n ? barSettings.countryCodes?.length\n ? barSettings.countryCodes\n : ['XX']\n : [],\n freeShippingOnSubscription: barSettings.freeShippingOptions?.freeShippingOnSubscriptions === true,\n ...(progressColor && { progressColor }),\n sections: [\n {\n buttonField: 'progressRemaining',\n content: { en: normalizeTokens(labels?.amoundRemaining || DEFAULT_REMAINING, ['remainingAmount']) },\n sectionType: 'text',\n },\n {\n buttonField: 'progressReached',\n content: { en: labels?.amountReached || DEFAULT_REACHED },\n sectionType: 'text',\n },\n ],\n sectionType: 'progressBar',\n tiers: [\n {\n threshold: alwaysReached ? 0 : Math.round((Number(barSettings.unlockPrice) || 0) * 100),\n thresholds: alwaysReached ? {} : toThresholds(barSettings.freeShippingOptions?.presentmentCurrencies),\n tierType: 'shipping',\n },\n ],\n };\n\n /** Merchant copy can carry HTML \u2014 the canonical pipeline converts it to Tiptap BEFORE the parse. */\n return CABRootSection.parse(\n normalizeTextContent({\n ...buildProgressBarLayout(progressBar, []),\n editorMode: LOCATION_TO_EDITOR_MODE[settings.location ?? 'checkout'],\n previewMode: settings.previewMode,\n type: UI_EXTENSION_PROGRESS_BAR,\n version: 2,\n widgetId: id,\n })\n );\n};\n", "import { type SmartCartBar, type SmartCartTier } from '~/schema/smartCart';\nimport { CABProgressTier } from '~/schema/widgets/checkout-and-beyond/progressBar';\nimport { CABRootSection } from '~/schema/widgets/checkout-and-beyond/root';\nimport { normalizeTextContent } from '~/transforms/normalizeTextContent';\nimport { normalizeTokens } from '~/transforms/normalizeTokens';\nimport { UI_EXTENSION_PROGRESS_BAR, type V1ProgressBarSettings } from '~/transforms/progressBarV1/types';\n\nconst LOCATION_TO_EDITOR_MODE = {\n checkout: 'checkoutExtension',\n 'order-status': 'orderStatusPage',\n 'thank-you': 'thankYouPage',\n} as const;\n\nconst DEFAULT_REMAINING = 'Spend {{remainingAmount}} more to unlock your reward!';\nconst DEFAULT_REACHED = \"Congratulations! You've unlocked your reward!\";\n\n/** All four onsite tier types render at checkout (discount/decorative migrated per the P12 re-scope). */\nconst IN_SCOPE_TIER_TYPES = new Set(['decorative', 'discount', 'product', 'shipping']);\n\nconst inScope = (tier: SmartCartTier): boolean => IN_SCOPE_TIER_TYPES.has(tier.type ?? '');\n\ntype TierType = 'decorative' | 'discount' | 'product' | 'shipping';\n\n/** The tier's `CABProgressTier` type \u2014 its config `type` when one of the four, else `product`. */\nconst tierTypeOf = (tier: SmartCartTier): TierType =>\n tier.type === 'shipping' || tier.type === 'discount' || tier.type === 'decorative' ? tier.type : 'product';\n\n/** The tier's threshold in its own unit: a raw item count for `item_quantity` tiers, shop-currency cents otherwise. */\nconst thresholdOf = (tier: SmartCartTier): number =>\n tier.unlockConditionType === 'item_quantity'\n ? Math.round(tier.minimum ?? 0)\n : Math.round((tier.minimum ?? 0) * 100);\n\n/**\n * Smart-cart tiers key per-currency thresholds as FLAT siblings on `presentmentCurrencies`\n * (`{ enabled, usd: 5000, \u2026 }`) \u2014 the same flat shape the shipping bar's `toThresholds` reads (that one\n * also carries a `currencies` code array). Returns lowercased ISO \u2192 cents, dropping `enabled` and malformed values.\n */\nconst tierThresholds = (tier: SmartCartTier): Record<string, number> => {\n const presentment = tier.presentmentCurrencies;\n\n if (!presentment?.enabled) return {};\n\n const thresholds: Record<string, number> = {};\n\n for (const [code, cents] of Object.entries(presentment)) {\n if (code === 'enabled') continue;\n\n const value = Math.round(Number(cents));\n\n if (Number.isFinite(value) && value >= 0) thresholds[code.toLowerCase()] = value;\n }\n\n return thresholds;\n};\n\n/**\n * The onsite `getTierLabel` step-row label (blank \u2192 no label under the icon): the merchant custom label\n * (always used for `decorative`), else the type default \u2014 'Free Shipping', the discount amount\n * (`{n}% Discount`, or `{{discountAmount}} Off` whose fixed amount the client resolves FX-aware per tier),\n * or the gift product title / 'Free Product'. Plain text \u2014 the compact step label is not rich copy.\n */\nconst tierLabel = (tier: SmartCartTier): string => {\n const type = tierTypeOf(tier);\n\n if ((tier.customTierLabel || type === 'decorative') && tier.customTierLabelText) return tier.customTierLabelText;\n\n if (type === 'decorative') return tier.customTierLabelText ?? '';\n\n if (type === 'shipping') return 'Free Shipping';\n\n if (type === 'discount')\n return tier.discountType === 'fixedAmount'\n ? '{{discountAmount}} Off'\n : `${tier.discountAmountFromTotal ?? 0}% Discount`;\n\n return tier.products?.[0]?.title ?? tier.allProducts?.[0]?.title ?? 'Free Product';\n};\n\n/**\n * The order-discount reward on a `discount` tier, carried so the client resolves `{{discountAmount}}`:\n * `fixedAmount` in shop-currency CENTS (FX-scaled client-side like the threshold), else the raw percent.\n */\nconst discountOf = (tier: SmartCartTier) => {\n if (tier.type !== 'discount') return undefined;\n\n const amount = tier.discountAmountFromTotal ?? 0;\n\n return tier.discountType === 'fixedAmount'\n ? { amount: Math.round(amount * 100), type: 'fixedAmount' as const }\n : { amount, type: 'percentage' as const };\n};\n\n/** The gift reward for a product tier (the first configured product), or undefined for shipping / unset. */\nconst giftOf = (tier: SmartCartTier) => {\n if (tier.type !== 'product') return undefined;\n\n const product = tier.products?.[0] ?? tier.allProducts?.[0];\n\n if (!product) return undefined;\n\n const productId = product.productId ?? product.id;\n\n if (productId === undefined) return undefined;\n\n return {\n productId,\n title: product.title,\n // One junk (non-positive) variant id must not fail the whole tier's schema \u2014 drop only the bad ids.\n variantIds: (product.variantIds ?? []).filter((id) => Number.isInteger(id) && id > 0),\n };\n};\n\n/**\n * A tier \u2192 its `CABProgressTier` metadata on the bar (threshold/gift/tierType/unit \u2014 NOT visual\n * content). Units resolve PER TIER (onsite `getTierMinimum`): an `item_quantity` tier's minimum is a\n * raw item count checked BEFORE any money handling \u2014 no \u00D7100, no presentment overrides (rounded only\n * because the schema pins counts to integers; onsite compares the raw value, so an integer count is\n * identical and junk fractional data degrades to the nearest count instead of a parse failure).\n */\nconst toTierMeta = (tier: SmartCartTier) => {\n const discount = discountOf(tier);\n const gift = giftOf(tier);\n const isItemCount = tier.unlockConditionType === 'item_quantity';\n const label = tierLabel(tier);\n const type = tierTypeOf(tier);\n\n return {\n ...(discount && { discount }),\n ...(gift && { gift }),\n ...(label && { label: { en: label } }),\n threshold: thresholdOf(tier),\n thresholds: !isItemCount && type === 'shipping' ? tierThresholds(tier) : {},\n ...(tier.id && { tierId: tier.id }),\n tierType: type,\n ...(isItemCount && { unit: 'item' }),\n };\n};\n\n/**\n * The renderable tiers of a bar: in scope (one of the four types) AND whose built `CABProgressTier` meta\n * passes the strict schema. A tier whose meta would fail (negative threshold, non-positive gift id, \u2026) is\n * dropped here rather than thrown by the final `CABRootSection.parse` \u2014 keeping the widget fail-safe against\n * numerically-valid-but-out-of-domain values that the loose `SmartCartTier` schema lets through.\n */\nconst renderableTiers = (bar: SmartCartBar): SmartCartTier[] =>\n (bar.tiers ?? []).filter((tier) => inScope(tier) && CABProgressTier.safeParse(toTierMeta(tier)).success);\n\nconst PRODUCT_TOKENS = ['productTitle', 'remainingAmount'];\nconst DISCOUNT_TOKENS = ['discountAmount', 'remainingAmount'];\nconst DECORATIVE_TOKENS = ['remainingAmount'];\n\ntype TierCopy = {\n reached?: boolean;\n reachedText?: string;\n remaining?: boolean;\n remainingText?: string;\n tokens: string[];\n};\n\n/** onsite's per-tier feedback copy for a non-shipping tier (shipping uses the bar-level free-shipping pair). */\nconst tierCopy = (tier: SmartCartTier): TierCopy => {\n switch (tierTypeOf(tier)) {\n case 'discount':\n return {\n reached: tier.discountAmountReachedLabel,\n reachedText: tier.discountAmountReachedLabelText,\n remaining: tier.discountAmountRemainingLabel,\n remainingText: tier.discountAmountRemainingLabelText,\n tokens: DISCOUNT_TOKENS,\n };\n case 'decorative':\n return {\n reached: tier.decorativeAmountReachedLabel,\n reachedText: tier.decorativeAmountReachedLabelText,\n remaining: tier.decorativeAmountRemainingLabel,\n remainingText: tier.decorativeAmountRemainingLabelText,\n tokens: DECORATIVE_TOKENS,\n };\n default:\n return {\n reached: tier.productAmountReachedLabel,\n reachedText: tier.productAmountReachedLabelText,\n remaining: tier.productAmountRemainingLabel,\n remainingText: tier.productAmountRemainingLabelText,\n tokens: PRODUCT_TOKENS,\n };\n }\n};\n\n/**\n * Per-tier feedback `text` sections (onsite `getTierFeedbackText`/`getTierCompletedText`): one for the\n * remaining prompt, one for the reached prompt, each tagged with the tier's id so the renderer shows it\n * only while that tier is the active one \u2014 falling back to the bar-level pair when a tier's copy is\n * blank/disabled (F-05). O-B3 is NOT replicated: the remaining prompt uses the remaining field, never the\n * reached one. Shipping tiers (and tiers with no id) emit nothing; the bar-level pair speaks for them.\n */\nconst toTierFeedback = (tier: SmartCartTier) => {\n if (tierTypeOf(tier) === 'shipping' || !tier.id) return [];\n\n const copy = tierCopy(tier);\n const meta = { threshold: thresholdOf(tier), tierId: tier.id, tierType: tierTypeOf(tier) };\n const sections: Record<string, unknown>[] = [];\n\n if (copy.remaining && copy.remainingText)\n sections.push({\n buttonField: 'progressRemaining',\n content: { en: normalizeTokens(copy.remainingText, copy.tokens) },\n sectionType: 'text',\n tier: meta,\n });\n\n if (copy.reached && copy.reachedText)\n sections.push({\n buttonField: 'progressReached',\n content: { en: normalizeTokens(copy.reachedText, copy.tokens) },\n sectionType: 'text',\n tier: meta,\n });\n\n return sections;\n};\n\n/**\n * A bar + its in-scope tiers \u2192 a self-contained `progressBar` container (a `rows` layout): the tier display\n * (if any) and the reached/remaining copy as children, the milestones on `tiers`. The renderer adds the bar\n * fill + active message; the country/FX gate covers the whole thing since it's one section. The caller\n * (`dedupeBars`) decides `countryCodes`/`excludeCountryCodes` so the rendered set matches React `getbar`.\n */\nconst toProgressBarSection = (\n bar: SmartCartBar,\n tiers: SmartCartTier[],\n countryCodes: string[],\n excludeCountryCodes: string[],\n progressColor?: string\n) => ({\n countryCodes,\n direction: 'rows',\n excludeCountryCodes,\n /** Discount tiers force the pre-discount subtotal so the tier's own reward can't un-reach it (F-08). */\n excludeDiscountInSubtotal:\n (bar.excludeDiscountInSubtotal ?? false) || tiers.some((tier) => tier.type === 'discount'),\n // Bar-level ids (not covered by the per-tier safeParse): drop non-positive ones so one junk id can't\n // fail `excludedVariantIds`' strict `.int().positive()` schema and 500 the whole widget.\n excludedVariantIds: (bar.excludedProducts ?? [])\n .flatMap((product) => product.variantIds ?? [])\n .filter((id) => Number.isInteger(id) && id > 0),\n freeShippingOnSubscription: bar.freeShippingOnSubscription ?? false,\n /** Absent \u21D2 omit so the section schema's `.default({ en: 'FREE GIFTS' })` is the single source of the fallback. */\n ...(bar.language?.giftAreaTitle && { giftAreaTitle: { en: bar.language.giftAreaTitle } }),\n ...(progressColor && { progressColor }),\n sections: [\n ...tiers.flatMap(toTierFeedback),\n {\n buttonField: 'progressRemaining',\n // Token-normalized here; any HTML in the copy is coerced to Tiptap by the text schema on parse.\n // `productTitle` resolves client-side to the active tier's gift (`{{product_title}}` parity).\n content: {\n en: normalizeTokens(bar.language?.freeShippingRemaining || DEFAULT_REMAINING, [\n 'productTitle',\n 'remainingAmount',\n ]),\n },\n sectionType: 'text',\n },\n {\n buttonField: 'progressReached',\n // `remainingAmount` normalized too (F24) \u2014 onsite reached copy can carry `{{remaining_amount}}`.\n content: {\n en: normalizeTokens(bar.language?.freeShippingReached || DEFAULT_REACHED, [\n 'productTitle',\n 'remainingAmount',\n ]),\n },\n sectionType: 'text',\n },\n ],\n sectionType: 'progressBar',\n tiers: tiers.map(toTierMeta),\n});\n\ntype BarEntry = { bar: SmartCartBar; tiers: SmartCartTier[] };\ntype RenderedBar = { countryCodes: string[]; entry: BarEntry; excludeCountryCodes: string[] };\n\n/** A bar's country codes, uppercased + de-duplicated (empty when unset). */\nconst barCountries = (bar: SmartCartBar): string[] => [\n ...new Set((bar.countryCodes ?? []).map((code) => code.trim().toUpperCase()).filter(Boolean)),\n];\n\n/**\n * Decide each bar's country gate to mirror React `getbar`, which renders exactly ONE bar per country: a geo\n * bar owns only the countries no EARLIER geo bar already claimed \u2014 and drops when it has none left (including\n * a geo bar that lists no countries, which `getbar` never matches); only the FIRST default (non-geo) bar\n * renders, gated to hide wherever any geo bar applies. Returns the bars that render, in order, with gates.\n *\n * A geo bar CLAIMS (shadows) its countries even when it has no renderable tiers \u2014 so an unrenderable geo bar\n * still hides the default (and any later geo bar) there, matching `getbar` one-bar-per-country precedence \u2014\n * but such a shadowing-only bar is not itself pushed (it renders nothing). Likewise an empty default never\n * consumes the default slot: the first default WITH tiers wins.\n */\nconst dedupeBars = (entries: BarEntry[]): RenderedBar[] => {\n const geoCountries = [\n ...new Set(entries.filter((entry) => entry.bar.geolocationEnabled).flatMap((entry) => barCountries(entry.bar))),\n ];\n const claimed = new Set<string>();\n const rendered: RenderedBar[] = [];\n let defaultUsed = false;\n\n for (const entry of entries) {\n if (entry.bar.geolocationEnabled) {\n const own = barCountries(entry.bar).filter((code) => !claimed.has(code));\n\n if (own.length === 0) continue;\n\n own.forEach((code) => claimed.add(code));\n\n if (entry.tiers.length > 0) rendered.push({ countryCodes: own, entry, excludeCountryCodes: [] });\n } else if (!defaultUsed && entry.tiers.length > 0) {\n defaultUsed = true;\n rendered.push({ countryCodes: [], entry, excludeCountryCodes: geoCountries });\n }\n }\n\n return rendered;\n};\n\n/**\n * Converts a smart-cart progress-bar widget into a CAB tree: a `rows` layout holding one self-contained\n * `progressBar` container per configured bar (tiers come from the shop's smart-cart config \u2014 see\n * `extractSmartCartBars`). Each container holds its tier display (composable `columns \u2192 rows \u2192 text/image`)\n * + copy as children, with milestones on `tiers` (server-precomputed per tier: cents \u2014 base +\n * per-presentment-currency for shipping tiers \u2014 or a raw item count for `item_quantity` tiers) so the\n * client only compares each tier against its own unit's progress, mirroring the shipping bar. DISPLAY\n * ONLY \u2014 gift add/remove is a later stage. Tiers whose meta fails the strict schema are dropped (never\n * thrown); a bar left with no renderable tier renders nothing \u2014 but a geo bar still shadows its countries\n * (so the default can't leak into them) even when it renders nothing.\n */\nexport const convertSmartCartProgressBarToV2 = (input: {\n bars: SmartCartBar[];\n id: number;\n /** The shop theme's `buttonBackground` (bar fill), resolved by the caller; schema-defaulted when absent. */\n progressColor?: string;\n settings: V1ProgressBarSettings;\n}): CABRootSection => {\n // NOT pre-filtered by renderable tiers: `dedupeBars` must see every geo bar so an unrenderable one\n // still claims (shadows) its countries; it only pushes bars that actually have tiers to render.\n const entries = input.bars.map((bar) => ({ bar, tiers: renderableTiers(bar) }));\n\n const sections = dedupeBars(entries).map(({ countryCodes, entry, excludeCountryCodes }) =>\n toProgressBarSection(entry.bar, entry.tiers, countryCodes, excludeCountryCodes, input.progressColor)\n );\n\n /** Merchant copy/labels can carry HTML \u2014 the canonical pipeline converts it to Tiptap BEFORE the parse. */\n return CABRootSection.parse(\n normalizeTextContent({\n direction: 'rows',\n editorMode: LOCATION_TO_EDITOR_MODE[input.settings.location ?? 'checkout'],\n previewMode: input.settings.previewMode,\n sections,\n sectionType: 'layout',\n type: UI_EXTENSION_PROGRESS_BAR,\n version: 2,\n widgetId: input.id,\n })\n );\n};\n", "import { type SmartCartBar, type SmartCartConfig } from '~/schema/smartCart';\n\n/** Component `type` value that carries the checkout smart-cart progress-bar tiers. */\nexport const SMART_CART_TIERED_PROGRESS_BAR = 'tiered_progress_bar' as const;\n\n/**\n * Pulls the progress-bar bars out of a shop's smart-cart config: the first\n * `tiered_progress_bar` component's `settings.bars`. Returns `[]` when smart cart is\n * absent / disabled / has no such component \u2014 the caller then renders nothing, matching\n * the legacy runtime (which only shows a smart-cart bar when one is configured).\n *\n * One bar per geo segment is returned as-is; country selection happens downstream via\n * each bar's `countryCodes` gate (parity with the shipping bar \u2014 no buyer country is\n * known at conversion time).\n */\nexport const extractSmartCartBars = (smartCart: SmartCartConfig | null | undefined): SmartCartBar[] => {\n const component = smartCart?.components?.find((entry) => entry.type === SMART_CART_TIERED_PROGRESS_BAR);\n\n return component?.settings?.bars ?? [];\n};\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,MAAMA,gBAAc;AAC7B,SAAS,KAAAC,WAAS;;;ACDX,IAAM,aAAa,CAA8B,WACpD,OAAO,OAAO,OAAO,YAAY,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAExD,IAAM,eAAe,CAAC,QAAQ,WAAW,WAAW,UAAU;AAC9D,IAAM,cAAc,WAAW,YAAY;AAG3C,IAAM,cAAc,CAAC,QAAQ,SAAS,QAAQ,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AACzC;",
|
|
6
6
|
"names": ["uuidv7", "z", "z", "z", "z", "z", "z", "uuidv7", "z", "isString", "uuidv7", "z", "z", "uuidv7", "isString", "z", "uuidv7", "z", "z", "uuidv7", "z", "z", "uuidv7", "uuidv7", "z", "uuidv7", "z", "z", "uuidv7", "z", "uuidv7", "z", "z", "z", "z", "uuidv7", "z", "z", "uuidv7", "uuidv7", "z", "z", "uuidv7", "z", "z", "uuidv7", "z", "z", "uuidv7", "uuidv7", "z", "z", "uuidv7", "uuidv7", "z", "z", "uuidv7", "z", "z", "uuidv7", "z", "z", "ARRAY_INDEX_STRING", "isPlainObject", "isPlainObject", "DYNAMIC_TOKEN_REGEX", "HTML_COMMENT_RE", "HTML_TAG_RE", "LOCATION_TO_EDITOR_MODE", "BUTTON_KINDS", "LOCATION_TO_EDITOR_MODE", "LOCATION_TO_EDITOR_MODE", "LOCATION_TO_EDITOR_MODE", "DEFAULT_REMAINING", "DEFAULT_REACHED"]
|
|
7
7
|
}
|