@rebuy/rebuy 3.46.0 → 3.48.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.cjs CHANGED
@@ -6157,6 +6157,20 @@ var tiptapPlainText = (doc) => listOf(doc?.content).map(
6157
6157
  (paragraph) => listOf(paragraph.content).map((node) => node.text ?? "").join("")
6158
6158
  ).join(" ").trim();
6159
6159
 
6160
+ // src/transforms/productCard/addToOrderButton.ts
6161
+ var labelSlot = (buttonField, defaults, override, knownTokens = [], legacyDefaults = []) => ({
6162
+ buttonField,
6163
+ content: localizedContent(defaults, override, knownTokens, legacyDefaults),
6164
+ sectionType: "text"
6165
+ });
6166
+ var addToOrderButton = (buttonStyle, sections, extra = {}) => ({
6167
+ action: "addToOrder",
6168
+ buttonStyle,
6169
+ sections,
6170
+ sectionType: "button",
6171
+ ...extra
6172
+ });
6173
+
6160
6174
  // src/transforms/productCard/earnedText.ts
6161
6175
  var contentMutator = (effect, variable, operator) => ({
6162
6176
  effect,
@@ -6225,16 +6239,13 @@ var quantitySection = ({ errorMessages, inputType, maxValue, minValue, name }) =
6225
6239
  var SWITCH_LABEL_TOKENS = ["subscriptionDiscount", "frequency", "interval"];
6226
6240
  var subscriptionToggle = (productType, labels = {}) => {
6227
6241
  if (productType !== "both" && productType !== "subscription") return [];
6228
- const slot = (buttonField, override) => ({
6242
+ const slot = (buttonField, override) => labelSlot(
6229
6243
  buttonField,
6230
- content: localizedContent(
6231
- SWITCH_LABELS[buttonField],
6232
- override,
6233
- SWITCH_LABEL_TOKENS,
6234
- LEGACY_LABEL_DEFAULTS[buttonField]
6235
- ),
6236
- sectionType: "text"
6237
- });
6244
+ SWITCH_LABELS[buttonField],
6245
+ override,
6246
+ SWITCH_LABEL_TOKENS,
6247
+ LEGACY_LABEL_DEFAULTS[buttonField]
6248
+ );
6238
6249
  return [
6239
6250
  {
6240
6251
  action: "switchToSubscription",
@@ -6433,20 +6444,16 @@ var buildRevealButton = (settings) => revealsVariants(settings) ? [
6433
6444
  }
6434
6445
  ] : [];
6435
6446
  var buildAddButton = (settings) => {
6436
- const slot = (buttonField, override) => ({
6447
+ const slot = (buttonField, override) => labelSlot(
6437
6448
  buttonField,
6438
- content: localizedContent(
6439
- OFFER_LABELS[buttonField],
6440
- override,
6441
- ADD_LABEL_TOKENS,
6442
- LEGACY_LABEL_DEFAULTS[buttonField]
6443
- ),
6444
- sectionType: "text"
6445
- });
6446
- return {
6447
- action: "addToOrder",
6448
- buttonStyle: buttonKind(settings),
6449
- sections: [
6449
+ OFFER_LABELS[buttonField],
6450
+ override,
6451
+ ADD_LABEL_TOKENS,
6452
+ LEGACY_LABEL_DEFAULTS[buttonField]
6453
+ );
6454
+ return addToOrderButton(
6455
+ buttonKind(settings),
6456
+ [
6450
6457
  slot("addToCart", settings.language?.addToCart),
6451
6458
  slot("addingToCart", settings.language?.addingToCart),
6452
6459
  slot("addedToCart", settings.language?.addedToCart),
@@ -6454,9 +6461,8 @@ var buildAddButton = (settings) => {
6454
6461
  // Off-checkout Buy Now: the label the button shows once it links to the created checkout.
6455
6462
  slot("redirectToCheckout", settings.language?.redirectToCheckout)
6456
6463
  ],
6457
- sectionType: "button",
6458
- ...revealsVariants(settings) && { visibility: { variable: SHOW_VARIANTS, visibleWhen: true } }
6459
- };
6464
+ revealsVariants(settings) ? { visibility: { variable: SHOW_VARIANTS, visibleWhen: true } } : {}
6465
+ );
6460
6466
  };
6461
6467
  var buildOfferCard = (settings, horizontal) => {
6462
6468
  const image = buildImage(settings);
package/dist/index.mjs CHANGED
@@ -5686,6 +5686,20 @@ var tiptapPlainText = (doc) => listOf(doc?.content).map(
5686
5686
  (paragraph) => listOf(paragraph.content).map((node) => node.text ?? "").join("")
5687
5687
  ).join(" ").trim();
5688
5688
 
5689
+ // src/transforms/productCard/addToOrderButton.ts
5690
+ var labelSlot = (buttonField, defaults, override, knownTokens = [], legacyDefaults = []) => ({
5691
+ buttonField,
5692
+ content: localizedContent(defaults, override, knownTokens, legacyDefaults),
5693
+ sectionType: "text"
5694
+ });
5695
+ var addToOrderButton = (buttonStyle, sections, extra = {}) => ({
5696
+ action: "addToOrder",
5697
+ buttonStyle,
5698
+ sections,
5699
+ sectionType: "button",
5700
+ ...extra
5701
+ });
5702
+
5689
5703
  // src/transforms/productCard/earnedText.ts
5690
5704
  var contentMutator = (effect, variable, operator) => ({
5691
5705
  effect,
@@ -5754,16 +5768,13 @@ var quantitySection = ({ errorMessages, inputType, maxValue, minValue, name }) =
5754
5768
  var SWITCH_LABEL_TOKENS = ["subscriptionDiscount", "frequency", "interval"];
5755
5769
  var subscriptionToggle = (productType, labels = {}) => {
5756
5770
  if (productType !== "both" && productType !== "subscription") return [];
5757
- const slot = (buttonField, override) => ({
5771
+ const slot = (buttonField, override) => labelSlot(
5758
5772
  buttonField,
5759
- content: localizedContent(
5760
- SWITCH_LABELS[buttonField],
5761
- override,
5762
- SWITCH_LABEL_TOKENS,
5763
- LEGACY_LABEL_DEFAULTS[buttonField]
5764
- ),
5765
- sectionType: "text"
5766
- });
5773
+ SWITCH_LABELS[buttonField],
5774
+ override,
5775
+ SWITCH_LABEL_TOKENS,
5776
+ LEGACY_LABEL_DEFAULTS[buttonField]
5777
+ );
5767
5778
  return [
5768
5779
  {
5769
5780
  action: "switchToSubscription",
@@ -5962,20 +5973,16 @@ var buildRevealButton = (settings) => revealsVariants(settings) ? [
5962
5973
  }
5963
5974
  ] : [];
5964
5975
  var buildAddButton = (settings) => {
5965
- const slot = (buttonField, override) => ({
5976
+ const slot = (buttonField, override) => labelSlot(
5966
5977
  buttonField,
5967
- content: localizedContent(
5968
- OFFER_LABELS[buttonField],
5969
- override,
5970
- ADD_LABEL_TOKENS,
5971
- LEGACY_LABEL_DEFAULTS[buttonField]
5972
- ),
5973
- sectionType: "text"
5974
- });
5975
- return {
5976
- action: "addToOrder",
5977
- buttonStyle: buttonKind(settings),
5978
- sections: [
5978
+ OFFER_LABELS[buttonField],
5979
+ override,
5980
+ ADD_LABEL_TOKENS,
5981
+ LEGACY_LABEL_DEFAULTS[buttonField]
5982
+ );
5983
+ return addToOrderButton(
5984
+ buttonKind(settings),
5985
+ [
5979
5986
  slot("addToCart", settings.language?.addToCart),
5980
5987
  slot("addingToCart", settings.language?.addingToCart),
5981
5988
  slot("addedToCart", settings.language?.addedToCart),
@@ -5983,9 +5990,8 @@ var buildAddButton = (settings) => {
5983
5990
  // Off-checkout Buy Now: the label the button shows once it links to the created checkout.
5984
5991
  slot("redirectToCheckout", settings.language?.redirectToCheckout)
5985
5992
  ],
5986
- sectionType: "button",
5987
- ...revealsVariants(settings) && { visibility: { variable: SHOW_VARIANTS, visibleWhen: true } }
5988
- };
5993
+ revealsVariants(settings) ? { visibility: { variable: SHOW_VARIANTS, visibleWhen: true } } : {}
5994
+ );
5989
5995
  };
5990
5996
  var buildOfferCard = (settings, horizontal) => {
5991
5997
  const image = buildImage(settings);
@@ -5,7 +5,7 @@ import { type MonetizeInput } from '../server/shared';
5
5
  * Compose one ads-engine offer into a renderable CAB card: a bordered `layout` whose `viewUrl` is the
6
6
  * impression pixel, holding the header chrome, the copy (headline + HTML body, pre-converted to a
7
7
  * small-sized Tiptap doc by {@link smallText}) beside the optional image (75%/fill — the React desktop split),
8
- * the two CTAs in a 50/50 row, and the right-aligned Privacy Policy footer. `acceptOffer` links out
8
+ * the two CTAs in a 50/50 row, the paging dots, and the right-aligned Privacy Policy footer. `acceptOffer` links out
9
9
  * to the advertiser (`destinationUrl` = `click_url`, which self-tracks); `declineOffer` fires the
10
10
  * decline pixel (`trackingUrl`) and advances. Parsing through the schema fills defaults and validates
11
11
  * the shape.
@@ -71,7 +71,7 @@ __export(server_exports, {
71
71
  module.exports = __toCommonJS(server_exports);
72
72
 
73
73
  // src/server/dataSourceResults.ts
74
- var import_es_toolkit7 = require("es-toolkit");
74
+ var import_es_toolkit8 = require("es-toolkit");
75
75
 
76
76
  // src/gwp/getValidGwpProductIds.ts
77
77
  var getValidGwpProductIds = (matchedRules = []) => new Set(
@@ -3300,6 +3300,20 @@ var tiptapPlainText = (doc) => listOf(doc?.content).map(
3300
3300
  (paragraph) => listOf(paragraph.content).map((node) => node.text ?? "").join("")
3301
3301
  ).join(" ").trim();
3302
3302
 
3303
+ // src/transforms/productCard/addToOrderButton.ts
3304
+ var labelSlot = (buttonField, defaults, override, knownTokens = [], legacyDefaults = []) => ({
3305
+ buttonField,
3306
+ content: localizedContent(defaults, override, knownTokens, legacyDefaults),
3307
+ sectionType: "text"
3308
+ });
3309
+ var addToOrderButton = (buttonStyle, sections, extra = {}) => ({
3310
+ action: "addToOrder",
3311
+ buttonStyle,
3312
+ sections,
3313
+ sectionType: "button",
3314
+ ...extra
3315
+ });
3316
+
3303
3317
  // src/transforms/productCard/earnedText.ts
3304
3318
  var contentMutator = (effect, variable, operator) => ({
3305
3319
  effect,
@@ -3368,16 +3382,13 @@ var quantitySection = ({ errorMessages, inputType, maxValue, minValue, name }) =
3368
3382
  var SWITCH_LABEL_TOKENS2 = ["subscriptionDiscount", "frequency", "interval"];
3369
3383
  var subscriptionToggle = (productType, labels = {}) => {
3370
3384
  if (productType !== "both" && productType !== "subscription") return [];
3371
- const slot = (buttonField, override) => ({
3385
+ const slot = (buttonField, override) => labelSlot(
3372
3386
  buttonField,
3373
- content: localizedContent(
3374
- SWITCH_LABELS[buttonField],
3375
- override,
3376
- SWITCH_LABEL_TOKENS2,
3377
- LEGACY_LABEL_DEFAULTS[buttonField]
3378
- ),
3379
- sectionType: "text"
3380
- });
3387
+ SWITCH_LABELS[buttonField],
3388
+ override,
3389
+ SWITCH_LABEL_TOKENS2,
3390
+ LEGACY_LABEL_DEFAULTS[buttonField]
3391
+ );
3381
3392
  return [
3382
3393
  {
3383
3394
  action: "switchToSubscription",
@@ -3576,20 +3587,16 @@ var buildRevealButton = (settings) => revealsVariants(settings) ? [
3576
3587
  }
3577
3588
  ] : [];
3578
3589
  var buildAddButton = (settings) => {
3579
- const slot = (buttonField, override) => ({
3590
+ const slot = (buttonField, override) => labelSlot(
3580
3591
  buttonField,
3581
- content: localizedContent(
3582
- OFFER_LABELS[buttonField],
3583
- override,
3584
- ADD_LABEL_TOKENS,
3585
- LEGACY_LABEL_DEFAULTS[buttonField]
3586
- ),
3587
- sectionType: "text"
3588
- });
3589
- return {
3590
- action: "addToOrder",
3591
- buttonStyle: buttonKind(settings),
3592
- sections: [
3592
+ OFFER_LABELS[buttonField],
3593
+ override,
3594
+ ADD_LABEL_TOKENS,
3595
+ LEGACY_LABEL_DEFAULTS[buttonField]
3596
+ );
3597
+ return addToOrderButton(
3598
+ buttonKind(settings),
3599
+ [
3593
3600
  slot("addToCart", settings.language?.addToCart),
3594
3601
  slot("addingToCart", settings.language?.addingToCart),
3595
3602
  slot("addedToCart", settings.language?.addedToCart),
@@ -3597,9 +3604,8 @@ var buildAddButton = (settings) => {
3597
3604
  // Off-checkout Buy Now: the label the button shows once it links to the created checkout.
3598
3605
  slot("redirectToCheckout", settings.language?.redirectToCheckout)
3599
3606
  ],
3600
- sectionType: "button",
3601
- ...revealsVariants(settings) && { visibility: { variable: SHOW_VARIANTS, visibleWhen: true } }
3602
- };
3607
+ revealsVariants(settings) ? { visibility: { variable: SHOW_VARIANTS, visibleWhen: true } } : {}
3608
+ );
3603
3609
  };
3604
3610
  var buildOfferCard = (settings, horizontal) => {
3605
3611
  const image = buildImage(settings);
@@ -4280,95 +4286,28 @@ var convertImageContentBlock = (raw, report) => {
4280
4286
  return [CABLayoutSection.parse({ frame: "offer-content", sections: [inner], spacing: "none" })];
4281
4287
  };
4282
4288
 
4283
- // src/transforms/postPurchase/convertPayButtonBlock.ts
4284
- var convertPayButtonBlock = (raw, report) => {
4285
- const omit = () => {
4286
- report?.({ detail: "Unreadable post-purchase Pay block", kind: "section" });
4287
- return [];
4288
- };
4289
- const parsed = PayButtonBlock.safeParse(raw);
4290
- if (!parsed.success) return omit();
4291
- const { settings, styles: styles2 } = parsed.data;
4292
- const label2 = settings.label ? `${settings.label} \xB7 {{total}}` : "{{total}}";
4293
- const text2 = CABTextSection.safeParse({ content: { en: label2 } });
4294
- if (!text2.success) return omit();
4295
- return [
4296
- CABLayoutSection.parse({
4297
- alignment: { horizontal: "center" },
4298
- direction: "grid",
4299
- grid: { columns: ["100%"] },
4300
- sections: [
4301
- CABButtonSection.parse({
4302
- action: "addToOrder",
4303
- sections: [text2.data]
4304
- })
4305
- ],
4306
- width: styles2.buttonWidth
4307
- })
4308
- ];
4309
- };
4310
-
4311
- // src/transforms/postPurchase/productCardControls.ts
4312
- var SELECT_VARIANT = { en: "Select Variant" };
4313
- var PRODUCT_GROUP = { en: "Option" };
4314
- var groupSelector = { label: PRODUCT_GROUP, sectionType: "variants", selector: "menu", variantMode: "productGroup" };
4315
- var variantSelector = ({ productOptions }) => {
4316
- if (!productOptions.showVariantSelectors) return [];
4317
- const single = productOptions.variantSelectorDisplayMode === "single";
4318
- return [
4319
- {
4320
- hideOutOfStockVariants: single || productOptions.hideOutOfStockVariants,
4321
- ...single && { label: SELECT_VARIANT },
4322
- sectionType: "variants",
4323
- selector: "menu",
4324
- variantMode: single ? "single" : "multiple"
4325
- }
4326
- ];
4327
- };
4328
- var quantity = ({ language: language3, quantityInputs: quantityInputs2 }) => quantityInputs2.enabled ? [
4329
- quantitySection({
4330
- maxValue: quantityInputs2.maxValue,
4331
- minValue: quantityInputs2.minValue,
4332
- name: language3.global.quantity.trim()
4333
- })
4334
- ] : [];
4335
- var productCardControls = (settings) => [
4336
- ...subscriptionToggle(settings.productType, { frequencyLabel: "planName" }),
4337
- groupSelector,
4338
- ...variantSelector(settings),
4339
- ...quantity(settings)
4289
+ // src/transforms/postPurchase/productCardPay.ts
4290
+ var import_es_toolkit6 = require("es-toolkit");
4291
+ var PAY_NOW = { en: "Pay Now" };
4292
+ var DECLINE_THIS_OFFER = { en: "Decline this offer" };
4293
+ var NOT_AVAILABLE_DEFAULTS = ["Not available"];
4294
+ var soldOutSlot = ({ language: language3 }) => labelSlot("soldOut", OFFER_LABELS.soldOut, language3.global.notAvailable, [], NOT_AVAILABLE_DEFAULTS);
4295
+ var productCardPay = (settings) => {
4296
+ const payNow = labelSlot("payNow", PAY_NOW, settings.language.global.payNow);
4297
+ const priced = settings.language.displayCtaPrice ? { ...payNow, content: (0, import_es_toolkit6.mapValues)(payNow.content, (label2) => `${label2} \xB7 {{total}}`) } : payNow;
4298
+ return [addToOrderButton("primary", [priced, soldOutSlot(settings)])];
4299
+ };
4300
+ var productCardDecline = ({ language: language3 }) => [
4301
+ {
4302
+ action: "declineOffer",
4303
+ buttonStyle: "secondary",
4304
+ sections: [labelSlot("declineOffer", DECLINE_THIS_OFFER, language3.global.declineThisOffer)],
4305
+ sectionType: "button"
4306
+ }
4340
4307
  ];
4341
4308
 
4342
- // src/transforms/postPurchase/productCardRows.ts
4343
- var styledCopy = (text2, look) => ({
4344
- content: [{ content: [{ marks: [{ attrs: look, type: "textStyle" }], text: text2, type: "text" }], type: "paragraph" }],
4345
- type: "doc"
4346
- });
4347
- var merchantLabel = (value, fallback) => localizedContent({ en: fallback }, value);
4348
- var boundText = (variable, content) => ({
4349
- content,
4350
- sectionType: "text",
4351
- visibility: shownWhile(variable)
4352
- });
4353
- var earnedRow = ({ after, columns, label: label2, look, spacing, token, variable }) => {
4354
- const styled2 = (text2) => look ? styledCopy(text2, look) : text2;
4355
- const value = earnedText(variable, styled2(token));
4356
- return {
4357
- direction: "grid",
4358
- grid: { columns, rows: ["auto"] },
4359
- sections: [
4360
- boundText(variable, look ? { en: styled2(String(label2.en)) } : label2),
4361
- value,
4362
- ...after === void 0 ? [] : [boundText(variable, { en: styled2(String(after)) })]
4363
- ],
4364
- sectionType: "layout",
4365
- ...spacing && { spacing }
4366
- };
4367
- };
4368
- var earnedVariables = (names) => names.map((name) => ({ defaultValue: false, name }));
4369
-
4370
4309
  // src/transforms/postPurchase/productCardSettings.ts
4371
- var import_es_toolkit6 = require("es-toolkit");
4310
+ var import_es_toolkit7 = require("es-toolkit");
4372
4311
  var import_zod38 = require("zod");
4373
4312
 
4374
4313
  // src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
@@ -4560,9 +4499,12 @@ var PostPurchaseSettings = import_zod37.z.object({
4560
4499
  // src/transforms/postPurchase/productCardSettings.ts
4561
4500
  var { shape } = PostPurchaseSettings;
4562
4501
  var Labels = import_zod38.z.object(
4563
- (0, import_es_toolkit6.mapValues)(shape.language.shape.global.unwrap().unwrap().shape, (label2) => label2.catch(() => label2.parse(void 0)))
4502
+ (0, import_es_toolkit7.mapValues)(shape.language.shape.global.unwrap().unwrap().shape, (label2) => label2.catch(() => label2.parse(void 0)))
4564
4503
  );
4565
- var Language = import_zod38.z.object({ global: Labels.catch(() => Labels.parse({})) });
4504
+ var Language = import_zod38.z.object({
4505
+ displayCtaPrice: shape.language.shape.displayCtaPrice.catch(true),
4506
+ global: Labels.catch(() => Labels.parse({}))
4507
+ });
4566
4508
  var Fields = import_zod38.z.object({
4567
4509
  discount: shape.discount.catch(() => shape.discount.parse({})),
4568
4510
  language: Language.catch(() => Language.parse({})),
@@ -4576,6 +4518,93 @@ var Fields = import_zod38.z.object({
4576
4518
  var ProductCardSettings = Fields.catch(() => Fields.parse({}));
4577
4519
  var sellsSubscription = ({ productType, upgradeToSubscription }) => productType !== "one-time" || upgradeToSubscription.allow;
4578
4520
 
4521
+ // src/transforms/postPurchase/convertPayButtonBlock.ts
4522
+ var convertPayButtonBlock = (raw, report, widgetSettings) => {
4523
+ const omit = () => {
4524
+ report?.({ detail: "Unreadable post-purchase Pay block", kind: "section" });
4525
+ return [];
4526
+ };
4527
+ const parsed = PayButtonBlock.safeParse(raw);
4528
+ if (!parsed.success) return omit();
4529
+ const { settings, styles: styles2 } = parsed.data;
4530
+ const label2 = settings.label ? `${settings.label} \xB7 {{total}}` : "{{total}}";
4531
+ const text2 = CABTextSection.safeParse({ content: { en: label2 } });
4532
+ if (!text2.success) return omit();
4533
+ return [
4534
+ CABLayoutSection.parse({
4535
+ alignment: { horizontal: "center" },
4536
+ direction: "grid",
4537
+ grid: { columns: ["100%"] },
4538
+ sections: [
4539
+ CABButtonSection.parse({
4540
+ action: "addToOrder",
4541
+ sections: [text2.data, soldOutSlot(ProductCardSettings.parse(widgetSettings ?? {}))]
4542
+ })
4543
+ ],
4544
+ width: styles2.buttonWidth
4545
+ })
4546
+ ];
4547
+ };
4548
+
4549
+ // src/transforms/postPurchase/productCardControls.ts
4550
+ var SELECT_VARIANT = { en: "Select Variant" };
4551
+ var PRODUCT_GROUP = { en: "Option" };
4552
+ var groupSelector = { label: PRODUCT_GROUP, sectionType: "variants", selector: "menu", variantMode: "productGroup" };
4553
+ var variantSelector = ({ productOptions }) => {
4554
+ if (!productOptions.showVariantSelectors) return [];
4555
+ const single = productOptions.variantSelectorDisplayMode === "single";
4556
+ return [
4557
+ {
4558
+ hideOutOfStockVariants: single || productOptions.hideOutOfStockVariants,
4559
+ ...single && { label: SELECT_VARIANT },
4560
+ sectionType: "variants",
4561
+ selector: "menu",
4562
+ variantMode: single ? "single" : "multiple"
4563
+ }
4564
+ ];
4565
+ };
4566
+ var quantity = ({ language: language3, quantityInputs: quantityInputs2 }) => quantityInputs2.enabled ? [
4567
+ quantitySection({
4568
+ maxValue: quantityInputs2.maxValue,
4569
+ minValue: quantityInputs2.minValue,
4570
+ name: language3.global.quantity.trim()
4571
+ })
4572
+ ] : [];
4573
+ var productCardControls = (settings) => [
4574
+ ...subscriptionToggle(settings.productType, { frequencyLabel: "planName" }),
4575
+ groupSelector,
4576
+ ...variantSelector(settings),
4577
+ ...quantity(settings)
4578
+ ];
4579
+
4580
+ // src/transforms/postPurchase/productCardRows.ts
4581
+ var styledCopy = (text2, look) => ({
4582
+ content: [{ content: [{ marks: [{ attrs: look, type: "textStyle" }], text: text2, type: "text" }], type: "paragraph" }],
4583
+ type: "doc"
4584
+ });
4585
+ var merchantLabel = (value, fallback) => localizedContent({ en: fallback }, value);
4586
+ var boundText = (variable, content) => ({
4587
+ content,
4588
+ sectionType: "text",
4589
+ visibility: shownWhile(variable)
4590
+ });
4591
+ var earnedRow = ({ after, columns, label: label2, look, spacing, token, variable }) => {
4592
+ const styled2 = (text2) => look ? styledCopy(text2, look) : text2;
4593
+ const value = earnedText(variable, styled2(token));
4594
+ return {
4595
+ direction: "grid",
4596
+ grid: { columns, rows: ["auto"] },
4597
+ sections: [
4598
+ boundText(variable, look ? { en: styled2(String(label2.en)) } : label2),
4599
+ value,
4600
+ ...after === void 0 ? [] : [boundText(variable, { en: styled2(String(after)) })]
4601
+ ],
4602
+ sectionType: "layout",
4603
+ ...spacing && { spacing }
4604
+ };
4605
+ };
4606
+ var earnedVariables = (names) => names.map((name) => ({ defaultValue: false, name }));
4607
+
4579
4608
  // src/transforms/postPurchase/productCardCosts.ts
4580
4609
  var COST_ROWS = [
4581
4610
  ["showSubtotal", "subtotal", "Subtotal", "hasSubtotal"],
@@ -4732,7 +4761,9 @@ var convertProductInformation = (raw, report, widgetSettings) => {
4732
4761
  CABReviewsSection.parse({}),
4733
4762
  CABTextSection.parse({ content: { en: "{{productDescription}}" } }),
4734
4763
  ...productCardControls(settings),
4735
- ...productCardCosts(settings)
4764
+ ...productCardCosts(settings),
4765
+ ...productCardPay(settings),
4766
+ ...productCardDecline(settings)
4736
4767
  ]
4737
4768
  })
4738
4769
  ],
@@ -5354,7 +5385,7 @@ var reportUnreadableVerdict = (metadata, report) => {
5354
5385
  if (RuleVerdict.safeParse(metadata).success || isDefinitiveRuleAnswer(metadata)) return;
5355
5386
  report?.({ detail: "rule verdict lacks readable custom.shouldShow", kind: "ruleVerdict" });
5356
5387
  };
5357
- var dedupeById = (products) => (0, import_es_toolkit7.uniqBy)(products, (product) => product.id);
5388
+ var dedupeById = (products) => (0, import_es_toolkit8.uniqBy)(products, (product) => product.id);
5358
5389
  var MAX_REQUEST_LINE_BYTES = 32e3;
5359
5390
  var requestLineBytes = (path, search) => new TextEncoder().encode(`GET ${path}?${search} HTTP/1.1`).length;
5360
5391
  var fetchDataSourceResults = async (input, ctx) => {
@@ -5630,6 +5661,25 @@ var disclaimerSections = (offer) => {
5630
5661
  }
5631
5662
  ];
5632
5663
  };
5664
+ var pagingDot = (buttonField, opacity) => ({
5665
+ buttonField,
5666
+ sectionType: SectionType.image,
5667
+ source: `data:image/svg+xml,${encodeURIComponent(
5668
+ `<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><circle cx="4" cy="4" r="4" fill="#808080" fill-opacity="${opacity}"/></svg>`
5669
+ )}`
5670
+ });
5671
+ var pagingDots = () => ({
5672
+ alignment: { horizontal: HorizontalAlignment.center, vertical: VerticalAlignment.top },
5673
+ sections: [
5674
+ {
5675
+ action: ButtonAction.showPagination,
5676
+ buttonStyle: ButtonStyle.plain,
5677
+ sections: [pagingDot(ButtonField.activePage, 1), pagingDot(ButtonField.inactivePage, 0.35)],
5678
+ sectionType: SectionType.button
5679
+ }
5680
+ ],
5681
+ sectionType: SectionType.layout
5682
+ });
5633
5683
  var composeOfferCard = (offer, input, storeName) => {
5634
5684
  const copy = {
5635
5685
  sections: [headlineText(offer.headline), smallText(offer.description)],
@@ -5686,6 +5736,7 @@ var composeOfferCard = (offer, input, storeName) => {
5686
5736
  sectionType: SectionType.layout
5687
5737
  },
5688
5738
  ...disclaimerSections(offer),
5739
+ pagingDots(),
5689
5740
  /**
5690
5741
  * Ad-unit Privacy Policy footer (compliance). Its own end-aligned layout packs a fit-content
5691
5742
  * paragraph right; the paragraph's own `textAlign: end` covers the full-width case — together
@@ -7951,7 +8002,7 @@ var preparePostPurchaseOfferPresentation = (widgetId, settings, response, report
7951
8002
  };
7952
8003
 
7953
8004
  // src/server/analytics.ts
7954
- var import_es_toolkit8 = require("es-toolkit");
8005
+ var import_es_toolkit9 = require("es-toolkit");
7955
8006
 
7956
8007
  // src/server/analyticsSegments.ts
7957
8008
  var SEGMENT_BUCKETS = {
@@ -8070,7 +8121,7 @@ var postAnalyticsEvents = async (input, ctx) => {
8070
8121
  const events = input.events.map((event) => translateAnalyticsEvent(event, input)).filter((event) => event !== null);
8071
8122
  if (events.length === 0) return { accepted: 0 };
8072
8123
  const { shop } = await fetchUserConfig({ shop: input.shop }, ctx);
8073
- for (const batch of (0, import_es_toolkit8.chunk)(events, MAX_ANALYTICS_EVENTS)) {
8124
+ for (const batch of (0, import_es_toolkit9.chunk)(events, MAX_ANALYTICS_EVENTS)) {
8074
8125
  await ctx.fetchUpstream(
8075
8126
  "/api/v2/analytics/event/bulk",
8076
8127
  {},