@delopay/sdk 0.164.0 → 0.165.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
@@ -63,6 +63,7 @@ __export(index_exports, {
63
63
  DEFAULT_BADGES_DARK: () => DEFAULT_BADGES_DARK,
64
64
  DEFAULT_BRANDING: () => DEFAULT_BRANDING,
65
65
  DEFAULT_BRANDING_DARK: () => DEFAULT_BRANDING_DARK,
66
+ DEFAULT_NOTICES: () => DEFAULT_NOTICES,
66
67
  Delopay: () => Delopay,
67
68
  DelopayAuthenticationError: () => DelopayAuthenticationError,
68
69
  DelopayError: () => DelopayError,
@@ -84,6 +85,12 @@ __export(index_exports, {
84
85
  NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
85
86
  NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
86
87
  NOMUPAY_FORM_STYLES: () => NOMUPAY_FORM_STYLES,
88
+ NOTICES_PER_SECTION: () => NOTICES_PER_SECTION,
89
+ NOTICE_ICONS: () => NOTICE_ICONS,
90
+ NOTICE_ICON_FALLBACK: () => NOTICE_ICON_FALLBACK,
91
+ NOTICE_ICON_PATHS: () => NOTICE_ICON_PATHS,
92
+ NOTICE_LABEL_MAX_LENGTH: () => NOTICE_LABEL_MAX_LENGTH,
93
+ NOTICE_SECTIONS: () => NOTICE_SECTIONS,
87
94
  OperationLimits: () => OperationLimits,
88
95
  PANES_MAX: () => PANES_MAX,
89
96
  PANE_CATEGORY_KEYS: () => PANE_CATEGORY_KEYS,
@@ -141,6 +148,7 @@ __export(index_exports, {
141
148
  cloneBranding: () => cloneBranding,
142
149
  cloneCustomField: () => cloneCustomField,
143
150
  cloneNativePane: () => cloneNativePane,
151
+ cloneNotice: () => cloneNotice,
144
152
  clonePane: () => clonePane,
145
153
  compareSections: () => compareSections,
146
154
  contrastRatio: () => contrastRatio,
@@ -156,11 +164,13 @@ __export(index_exports, {
156
164
  decodeMethodSectionLabels: () => decodeMethodSectionLabels,
157
165
  decodeMethodSectionOrder: () => decodeMethodSectionOrder,
158
166
  decodeNativePanes: () => decodeNativePanes,
167
+ decodeNotices: () => decodeNotices,
159
168
  decodePanes: () => decodePanes,
160
169
  defaultBranding: () => defaultBranding,
161
170
  defaultCustomFieldVisibility: () => defaultCustomFieldVisibility,
162
171
  defaultMethodSectionOrder: () => defaultMethodSectionOrder,
163
172
  defaultNativePane: () => defaultNativePane,
173
+ defaultNotices: () => defaultNotices,
164
174
  defaultOperatorForSource: () => defaultOperatorForSource,
165
175
  defaultPane: () => defaultPane,
166
176
  emptyPaneCatalog: () => emptyPaneCatalog,
@@ -170,6 +180,7 @@ __export(index_exports, {
170
180
  encodeMethodSectionLabels: () => encodeMethodSectionLabels,
171
181
  encodeMethodSectionOrder: () => encodeMethodSectionOrder,
172
182
  encodeNativePanes: () => encodeNativePanes,
183
+ encodeNotices: () => encodeNotices,
173
184
  encodePanes: () => encodePanes,
174
185
  evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
175
186
  evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
@@ -180,13 +191,17 @@ __export(index_exports, {
180
191
  inputPadValue: () => inputPadValue,
181
192
  isCheckboxChecked: () => isCheckboxChecked,
182
193
  isDarkSurface: () => isDarkSurface,
194
+ isDefaultBadgeSet: () => isDefaultBadgeSet,
183
195
  isHexColor: () => isHexColor,
196
+ isNoticeIcon: () => isNoticeIcon,
184
197
  isSubscriptionDisputeWebhook: () => isSubscriptionDisputeWebhook,
185
198
  isSubscriptionLifecycleWebhook: () => isSubscriptionLifecycleWebhook,
186
199
  knownSectionLabelKey: () => knownSectionLabelKey,
187
200
  leaf: () => leaf,
188
201
  logoDimensions: () => logoDimensions,
189
202
  nativePaneMethodInfo: () => nativePaneMethodInfo,
203
+ noticeText: () => noticeText,
204
+ noticesIn: () => noticesIn,
190
205
  offerablePaneMethods: () => offerablePaneMethods,
191
206
  paneCatalogFor: () => paneCatalogFor,
192
207
  paneDisplayDefaults: () => paneDisplayDefaults,
@@ -195,6 +210,7 @@ __export(index_exports, {
195
210
  paneViewVisibility: () => paneViewVisibility,
196
211
  parseCustomFieldsLoose: () => parseCustomFieldsLoose,
197
212
  parseImportedBranding: () => parseImportedBranding,
213
+ parseNoticesLoose: () => parseNoticesLoose,
198
214
  programToTree: () => programToTree,
199
215
  radiusValue: () => radiusValue,
200
216
  readableInkOn: () => readableInkOn,
@@ -202,12 +218,14 @@ __export(index_exports, {
202
218
  resolveAirwallexLabelStyle: () => resolveAirwallexLabelStyle,
203
219
  resolveApplePayButtonStyle: () => resolveApplePayButtonStyle,
204
220
  resolveGooglePayButtonColor: () => resolveGooglePayButtonColor,
221
+ resolveNoticesAndBadges: () => resolveNoticesAndBadges,
205
222
  resolveStripeTheme: () => resolveStripeTheme,
206
223
  ruleMatchToTree: () => ruleMatchToTree,
207
224
  sanitizeCustomCss: () => sanitizeCustomCss,
208
225
  sectionLabel: () => sectionLabel,
209
226
  sectionOrderOf: () => sectionOrderOf,
210
227
  shadowFor: () => shadowFor,
228
+ shownNotices: () => shownNotices,
211
229
  stripeSpacingValues: () => stripeSpacingValues,
212
230
  surchargeFigurePlan: () => surchargeFigurePlan,
213
231
  surchargeShowsLabel: () => surchargeShowsLabel,
@@ -6719,6 +6737,66 @@ function surchargeWordFor(branding, isDiscount, locale) {
6719
6737
  locale
6720
6738
  );
6721
6739
  }
6740
+ var NOTICE_SECTIONS = ["summary", "payment"];
6741
+ var NOTICES_PER_SECTION = 3;
6742
+ var NOTICE_LABEL_MAX_LENGTH = 80;
6743
+ var NOTICE_ICONS = [
6744
+ "lock",
6745
+ "shield",
6746
+ "check",
6747
+ "truck",
6748
+ "package",
6749
+ "refresh",
6750
+ "star",
6751
+ "support",
6752
+ "globe",
6753
+ "tag",
6754
+ "heart",
6755
+ "leaf",
6756
+ "clock",
6757
+ "bank"
6758
+ ];
6759
+ var NOTICE_ICON_FALLBACK = "check";
6760
+ var NOTICE_ICON_PATHS = {
6761
+ lock: [
6762
+ "M6 10h12a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2z",
6763
+ "M8 10V7a4 4 0 0 1 8 0v3"
6764
+ ],
6765
+ shield: ["M12 3l7 3v6c0 4.2-2.9 7.6-7 9-4.1-1.4-7-4.8-7-9V6z", "M9 12l2.5 2.5 4-4.5"],
6766
+ check: ["M21 12a9 9 0 1 1-18 0a9 9 0 1 1 18 0z", "M8 12.5l3 3 5-6"],
6767
+ truck: [
6768
+ "M3 7.5h10v9H3z",
6769
+ "M13 11h4l3 3v2.5h-7z",
6770
+ "M8.8 18a1.8 1.8 0 1 1-3.6 0a1.8 1.8 0 1 1 3.6 0z",
6771
+ "M18.8 18a1.8 1.8 0 1 1-3.6 0a1.8 1.8 0 1 1 3.6 0z"
6772
+ ],
6773
+ package: [
6774
+ "M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",
6775
+ "M12 22V12",
6776
+ "M3.29 7L12 12l8.71-5"
6777
+ ],
6778
+ refresh: ["M20 12a8 8 0 1 1-2.5-5.8", "M20 4v5h-5"],
6779
+ star: ["m12 3.6 2.6 5.3 5.9.9-4.3 4.1 1 5.8-5.2-2.7-5.2 2.7 1-5.8-4.3-4.1 5.9-.9z"],
6780
+ support: [
6781
+ "M5 13v-1a7 7 0 0 1 14 0v1",
6782
+ "M3.5 14.5a1.8 1.8 0 0 1 1.8-1.8H7v5H5.3a1.8 1.8 0 0 1-1.8-1.8z",
6783
+ "M20.5 14.5a1.8 1.8 0 0 0-1.8-1.8H17v5h1.7a1.8 1.8 0 0 0 1.8-1.8z",
6784
+ "M19 17.7v.8a2.5 2.5 0 0 1-2.5 2.5H13"
6785
+ ],
6786
+ globe: [
6787
+ "M21 12a9 9 0 1 1-18 0a9 9 0 1 1 18 0z",
6788
+ "M3 12h18",
6789
+ "M12 3a14 14 0 0 1 0 18a14 14 0 0 1 0-18z"
6790
+ ],
6791
+ tag: ["M11 3H4v7l10 10 7-7z", "M9.1 7a1.3 1.3 0 1 1-2.6 0a1.3 1.3 0 1 1 2.6 0z"],
6792
+ heart: ["M12 20s-7-4.4-7-9.3A3.9 3.9 0 0 1 12 8a3.9 3.9 0 0 1 7 2.7c0 4.9-7 9.3-7 9.3z"],
6793
+ leaf: ["M20 4c0 9-5.4 13-9.5 13A4.5 4.5 0 0 1 6 12.5C6 7 12 4 20 4z", "M4 20c2-4.5 5-7.5 9-9.5"],
6794
+ clock: ["M21 12a9 9 0 1 1-18 0a9 9 0 1 1 18 0z", "M12 7v5l3 2"],
6795
+ bank: ["M3 9.5 12 4l9 5.5", "M5 10v8M9.5 10v8M14.5 10v8M19 10v8", "M3 20h18"]
6796
+ };
6797
+ function isNoticeIcon(value) {
6798
+ return typeof value === "string" && NOTICE_ICONS.includes(value);
6799
+ }
6722
6800
  var FONT_STACKS = {
6723
6801
  inter: "'Inter Variable', 'Inter', system-ui, -apple-system, sans-serif",
6724
6802
  system: "system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif",
@@ -6888,6 +6966,96 @@ var DEFAULT_BADGES_DARK = [
6888
6966
  borderColor: "#1e40af"
6889
6967
  }
6890
6968
  ];
6969
+ var DEFAULT_NOTICES = [
6970
+ {
6971
+ id: "secure",
6972
+ section: "summary",
6973
+ icon: "shield",
6974
+ label: "Secure payment",
6975
+ labelTranslations: {
6976
+ de: "Sichere Zahlung",
6977
+ fr: "Paiement s\xE9curis\xE9",
6978
+ es: "Pago seguro",
6979
+ it: "Pagamento sicuro",
6980
+ nl: "Veilig betalen",
6981
+ zh: "\u5B89\u5168\u652F\u4ED8",
6982
+ "zh-Hant": "\u5B89\u5168\u4ED8\u6B3E",
6983
+ hi: "\u0938\u0941\u0930\u0915\u094D\u0937\u093F\u0924 \u092D\u0941\u0917\u0924\u093E\u0928",
6984
+ ar: "\u062F\u0641\u0639 \u0622\u0645\u0646"
6985
+ }
6986
+ },
6987
+ {
6988
+ id: "ssl",
6989
+ section: "summary",
6990
+ icon: "lock",
6991
+ label: "Encrypted \xB7 256-bit SSL",
6992
+ labelTranslations: {
6993
+ de: "Verschl\xFCsselt \xB7 256-Bit-SSL",
6994
+ fr: "Chiffr\xE9 \xB7 SSL 256 bits",
6995
+ es: "Cifrado \xB7 SSL de 256 bits",
6996
+ it: "Crittografato \xB7 SSL a 256 bit",
6997
+ nl: "Versleuteld \xB7 256-bit SSL",
6998
+ zh: "\u52A0\u5BC6 \xB7 256 \u4F4D SSL",
6999
+ "zh-Hant": "\u52A0\u5BC6 \xB7 256 \u4F4D\u5143 SSL",
7000
+ hi: "\u090F\u0928\u094D\u0915\u094D\u0930\u093F\u092A\u094D\u091F\u0947\u0921 \xB7 256-\u092C\u093F\u091F SSL",
7001
+ ar: "\u0645\u0634\u0641\u0651\u0631 \xB7 SSL \u0628\u0637\u0648\u0644 256 \u0628\u062A"
7002
+ }
7003
+ }
7004
+ ];
7005
+ function defaultNotices() {
7006
+ return DEFAULT_NOTICES.map(cloneNotice);
7007
+ }
7008
+ function cloneNotice(notice) {
7009
+ return { ...notice, labelTranslations: { ...notice.labelTranslations } };
7010
+ }
7011
+ function hexChannels(hex) {
7012
+ const raw = /^#([0-9a-f]{6})$/i.exec(hex.trim())?.[1];
7013
+ if (!raw) return null;
7014
+ return [
7015
+ parseInt(raw.slice(0, 2), 16),
7016
+ parseInt(raw.slice(2, 4), 16),
7017
+ parseInt(raw.slice(4, 6), 16)
7018
+ ];
7019
+ }
7020
+ function isThemeTintedBadgeColouring(textColor, fill, border) {
7021
+ const primary = hexChannels(textColor);
7022
+ const bg = hexChannels(fill);
7023
+ const line = hexChannels(border);
7024
+ if (!primary || !bg || !line) return false;
7025
+ const mixed = (surface, to, share) => Math.round(surface + (to - surface) * share);
7026
+ return primary.every((p, i) => {
7027
+ for (let surface = 0; surface <= 255; surface += 1) {
7028
+ if (mixed(surface, p, 0.08) === bg[i] && mixed(surface, p, 0.3) === line[i]) return true;
7029
+ }
7030
+ return false;
7031
+ });
7032
+ }
7033
+ function isDefaultBadgeSet(badges) {
7034
+ if (badges.length !== DEFAULT_BADGES.length) return false;
7035
+ const sameContent = badges.every(
7036
+ (badge, i) => badge.id === DEFAULT_BADGES[i]?.id && badge.label === DEFAULT_BADGES[i]?.label
7037
+ );
7038
+ if (!sameContent) return false;
7039
+ const colouring = (set) => set.map((b) => [b.textColor, b.backgroundColor, b.borderColor ?? ""].join("|").toLowerCase()).join("/");
7040
+ const mine = colouring(badges);
7041
+ if (mine === colouring(DEFAULT_BADGES) || mine === colouring(DEFAULT_BADGES_DARK)) return true;
7042
+ const [first] = badges;
7043
+ const border = first?.borderColor;
7044
+ if (!first || !border) return false;
7045
+ const same = (a, b) => (a ?? "").toLowerCase() === b.toLowerCase();
7046
+ return badges.every(
7047
+ (b) => same(b.textColor, first.textColor) && same(b.backgroundColor, first.backgroundColor) && same(b.borderColor, border)
7048
+ ) && isThemeTintedBadgeColouring(first.textColor, first.backgroundColor, border);
7049
+ }
7050
+ function resolveNoticesAndBadges(savedBadges, savedNotices) {
7051
+ if (savedNotices !== null) {
7052
+ return { trustBadges: savedBadges ?? [], notices: savedNotices };
7053
+ }
7054
+ if (savedBadges === null || isDefaultBadgeSet(savedBadges)) {
7055
+ return { trustBadges: [], notices: defaultNotices() };
7056
+ }
7057
+ return { trustBadges: savedBadges, notices: [] };
7058
+ }
6891
7059
  var METHOD_SECTION_ORDER_KEY = "methodSectionOrder";
6892
7060
  var METHOD_SECTION_LABELS_KEY = "methodSectionLabels";
6893
7061
  var MIN_SECTION_ORDER = 1;
@@ -7174,7 +7342,11 @@ var DEFAULT_BRANDING_BASE = {
7174
7342
  var DEFAULT_BRANDING = {
7175
7343
  ...DEFAULT_BRANDING_BASE,
7176
7344
  ...LIGHT_PALETTE,
7177
- trustBadges: DEFAULT_BADGES.map((b) => ({ ...b })),
7345
+ // No badges by default since todos#218 — notices took their place.
7346
+ // `DEFAULT_BADGES` stays exported because `isDefaultBadgeSet` still has to
7347
+ // recognise the pair on shops saved before.
7348
+ trustBadges: [],
7349
+ notices: defaultNotices(),
7178
7350
  customFields: [],
7179
7351
  methodSectionOrder: defaultMethodSectionOrder(),
7180
7352
  methodSectionLabels: {}
@@ -7197,7 +7369,8 @@ var DEFAULT_BRANDING_DARK = {
7197
7369
  // end of the ramp — 10.69 and 9.29 against the dark surface, also pinned.
7198
7370
  surchargeColor: "#fbbf24",
7199
7371
  discountColor: "#34d399",
7200
- trustBadges: DEFAULT_BADGES_DARK.map((b) => ({ ...b })),
7372
+ trustBadges: [],
7373
+ notices: defaultNotices(),
7201
7374
  customFields: [],
7202
7375
  methodSectionOrder: defaultMethodSectionOrder(),
7203
7376
  methodSectionLabels: {}
@@ -7209,6 +7382,7 @@ function cloneBranding(b) {
7209
7382
  return {
7210
7383
  ...b,
7211
7384
  trustBadges: b.trustBadges.map((badge) => ({ ...badge })),
7385
+ notices: b.notices.map(cloneNotice),
7212
7386
  customFields: b.customFields.map(cloneCustomField),
7213
7387
  methodSectionOrder: { ...b.methodSectionOrder },
7214
7388
  methodSectionLabels: Object.fromEntries(
@@ -7318,6 +7492,80 @@ function encodeBadges(badges) {
7318
7492
  }))
7319
7493
  );
7320
7494
  }
7495
+ var NOTICE_ID_MAX_LENGTH = 40;
7496
+ function capNoticeText(value) {
7497
+ return Array.from(value).slice(0, NOTICE_LABEL_MAX_LENGTH).join("");
7498
+ }
7499
+ function normalizeNotices(list) {
7500
+ const seen = /* @__PURE__ */ new Set();
7501
+ const perSection = /* @__PURE__ */ new Map();
7502
+ const out = [];
7503
+ list.forEach((raw, index) => {
7504
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return;
7505
+ const src = raw;
7506
+ const label = typeof src["label"] === "string" ? capNoticeText(src["label"]) : "";
7507
+ const labelTranslations = {};
7508
+ for (const [locale, text] of Object.entries(parseTranslations(src["labelTranslations"]))) {
7509
+ labelTranslations[locale] = capNoticeText(text);
7510
+ }
7511
+ if (label.trim().length === 0 && Object.keys(labelTranslations).length === 0) return;
7512
+ const section = pickEnum(src["section"], NOTICE_SECTIONS, "summary");
7513
+ const used = perSection.get(section) ?? 0;
7514
+ if (used >= NOTICES_PER_SECTION) return;
7515
+ perSection.set(section, used + 1);
7516
+ let id = typeof src["id"] === "string" ? src["id"].replace(/[^A-Za-z0-9_-]/g, "").slice(0, NOTICE_ID_MAX_LENGTH) : "";
7517
+ if (!id || seen.has(id)) id = `notice-${index + 1}`;
7518
+ while (seen.has(id)) id = `${id}x`;
7519
+ seen.add(id);
7520
+ out.push({
7521
+ id,
7522
+ section,
7523
+ icon: isNoticeIcon(src["icon"]) ? src["icon"] : NOTICE_ICON_FALLBACK,
7524
+ label,
7525
+ labelTranslations
7526
+ });
7527
+ });
7528
+ return out;
7529
+ }
7530
+ function decodeNotices(raw) {
7531
+ if (raw === void 0) return null;
7532
+ let parsed;
7533
+ try {
7534
+ parsed = JSON.parse(raw);
7535
+ } catch {
7536
+ return null;
7537
+ }
7538
+ return Array.isArray(parsed) ? normalizeNotices(parsed) : null;
7539
+ }
7540
+ function parseNoticesLoose(raw) {
7541
+ if (typeof raw === "string") return decodeNotices(raw);
7542
+ return Array.isArray(raw) ? normalizeNotices(raw) : null;
7543
+ }
7544
+ function encodeNotices(notices) {
7545
+ return JSON.stringify(
7546
+ notices.map((n) => {
7547
+ const translations = Object.entries(n.labelTranslations).filter(
7548
+ ([, text]) => text.trim().length > 0
7549
+ );
7550
+ return {
7551
+ id: n.id,
7552
+ section: n.section,
7553
+ icon: n.icon,
7554
+ label: n.label,
7555
+ ...translations.length > 0 ? { labelTranslations: Object.fromEntries(translations) } : {}
7556
+ };
7557
+ })
7558
+ );
7559
+ }
7560
+ function noticeText(notice, locale) {
7561
+ return translationFor(notice.labelTranslations, locale) ?? notice.label;
7562
+ }
7563
+ function noticesIn(notices, section) {
7564
+ return notices.filter((n) => n.section === section).slice(0, NOTICES_PER_SECTION);
7565
+ }
7566
+ function shownNotices(notices, section, locale) {
7567
+ return noticesIn(notices, section).map((notice) => ({ notice, text: noticeText(notice, locale).trim() })).filter((entry) => entry.text.length > 0);
7568
+ }
7321
7569
  var CUSTOM_FIELDS_MAX = 20;
7322
7570
  var CUSTOM_FIELD_KEY_PATTERN = /^[A-Za-z][A-Za-z0-9_-]{0,39}$/;
7323
7571
  var ALL_CUSTOM_FIELD_TYPES = [
@@ -7661,7 +7909,10 @@ function customFieldOptionLabel(option, locale) {
7661
7909
  function decodeBranding(source) {
7662
7910
  if (!source) return cloneBranding(DEFAULT_BRANDING);
7663
7911
  const extras = source.sdk_ui_rules?.[BRANDING_GROUP_KEY] ?? {};
7664
- const decodedBadges = decodeBadges(extras["trustBadges"]);
7912
+ const trustRow = resolveNoticesAndBadges(
7913
+ decodeBadges(extras["trustBadges"]),
7914
+ decodeNotices(extras["notices"])
7915
+ );
7665
7916
  const decodedCustomFields = decodeCustomFields(extras["customFields"]);
7666
7917
  const displayName = s(source.merchant_name) || s(source.seller_name);
7667
7918
  const logoUrl = s(source.merchant_logo) || s(source.logo);
@@ -7840,7 +8091,8 @@ function decodeBranding(source) {
7840
8091
  totalLabel: s(extras["totalLabel"]) || DEFAULT_BRANDING.totalLabel,
7841
8092
  showCurrencyCode: parseBool(extras["showCurrencyCode"], DEFAULT_BRANDING.showCurrencyCode),
7842
8093
  showOrderItems: parseBool(extras["showOrderItems"], DEFAULT_BRANDING.showOrderItems),
7843
- trustBadges: decodedBadges ?? DEFAULT_BRANDING.trustBadges.map((b) => ({ ...b })),
8094
+ trustBadges: trustRow.trustBadges,
8095
+ notices: trustRow.notices,
7844
8096
  customFields: decodedCustomFields ?? [],
7845
8097
  methodSectionOrder: decodeMethodSectionOrder(extras[METHOD_SECTION_ORDER_KEY]),
7846
8098
  methodSectionLabels: decodeMethodSectionLabels(extras[METHOD_SECTION_LABELS_KEY]),
@@ -8124,9 +8376,14 @@ function encodeBranding(branding, base) {
8124
8376
  nomupayApplePayButtonType: branding.nomupayApplePayButtonType,
8125
8377
  nomupayGooglePayButtonColor: branding.nomupayGooglePayButtonColor,
8126
8378
  nomupayGooglePayButtonType: branding.nomupayGooglePayButtonType,
8127
- trustBadges: encodeBadges(branding.trustBadges),
8379
+ // Always written, `[]` included — its presence is what stops a later
8380
+ // decode from migrating the shop again (`resolveNoticesAndBadges`).
8381
+ notices: encodeNotices(branding.notices),
8128
8382
  [METHOD_SECTION_ORDER_KEY]: encodeMethodSectionOrder(branding.methodSectionOrder)
8129
8383
  };
8384
+ if (branding.trustBadges.length > 0) {
8385
+ extras["trustBadges"] = encodeBadges(branding.trustBadges);
8386
+ }
8130
8387
  const sectionLabels = encodeMethodSectionLabels(branding.methodSectionLabels);
8131
8388
  if (sectionLabels) extras[METHOD_SECTION_LABELS_KEY] = sectionLabels;
8132
8389
  if (branding.customFields.length > 0) {
@@ -8192,7 +8449,10 @@ function parseImportedBranding(raw) {
8192
8449
  const dflt = DEFAULT_BRANDING;
8193
8450
  const sStr = (v, fallback) => typeof v === "string" ? v : fallback;
8194
8451
  const sHex = (v, fallback) => typeof v === "string" && isHexColor(v) ? v : fallback;
8195
- const trustBadges = parseTrustBadgesLoose(root["trustBadges"]) ?? dflt.trustBadges.map((b) => ({ ...b }));
8452
+ const { trustBadges, notices } = resolveNoticesAndBadges(
8453
+ parseTrustBadgesLoose(root["trustBadges"]),
8454
+ parseNoticesLoose(root["notices"])
8455
+ );
8196
8456
  const customFields = parseCustomFieldsLoose(root["customFields"]) ?? [];
8197
8457
  const labelStyle = (() => {
8198
8458
  const v = root["labelStyle"];
@@ -8335,6 +8595,7 @@ function parseImportedBranding(raw) {
8335
8595
  showCurrencyCode: parseBool(root["showCurrencyCode"], dflt.showCurrencyCode),
8336
8596
  showOrderItems: parseBool(root["showOrderItems"], dflt.showOrderItems),
8337
8597
  trustBadges,
8598
+ notices,
8338
8599
  customFields,
8339
8600
  // An export writes the decoded maps; a hand-written file may carry the
8340
8601
  // JSON strings the bag uses. Both are accepted, and neither is required.
@@ -9531,6 +9792,7 @@ var encodeNativePanes = encodePanes;
9531
9792
  DEFAULT_BADGES_DARK,
9532
9793
  DEFAULT_BRANDING,
9533
9794
  DEFAULT_BRANDING_DARK,
9795
+ DEFAULT_NOTICES,
9534
9796
  Delopay,
9535
9797
  DelopayAuthenticationError,
9536
9798
  DelopayError,
@@ -9552,6 +9814,12 @@ var encodeNativePanes = encodePanes;
9552
9814
  NATIVE_PANE_CATEGORY_KEYS,
9553
9815
  NATIVE_PANE_ICON_KEYS,
9554
9816
  NOMUPAY_FORM_STYLES,
9817
+ NOTICES_PER_SECTION,
9818
+ NOTICE_ICONS,
9819
+ NOTICE_ICON_FALLBACK,
9820
+ NOTICE_ICON_PATHS,
9821
+ NOTICE_LABEL_MAX_LENGTH,
9822
+ NOTICE_SECTIONS,
9555
9823
  OperationLimits,
9556
9824
  PANES_MAX,
9557
9825
  PANE_CATEGORY_KEYS,
@@ -9609,6 +9877,7 @@ var encodeNativePanes = encodePanes;
9609
9877
  cloneBranding,
9610
9878
  cloneCustomField,
9611
9879
  cloneNativePane,
9880
+ cloneNotice,
9612
9881
  clonePane,
9613
9882
  compareSections,
9614
9883
  contrastRatio,
@@ -9624,11 +9893,13 @@ var encodeNativePanes = encodePanes;
9624
9893
  decodeMethodSectionLabels,
9625
9894
  decodeMethodSectionOrder,
9626
9895
  decodeNativePanes,
9896
+ decodeNotices,
9627
9897
  decodePanes,
9628
9898
  defaultBranding,
9629
9899
  defaultCustomFieldVisibility,
9630
9900
  defaultMethodSectionOrder,
9631
9901
  defaultNativePane,
9902
+ defaultNotices,
9632
9903
  defaultOperatorForSource,
9633
9904
  defaultPane,
9634
9905
  emptyPaneCatalog,
@@ -9638,6 +9909,7 @@ var encodeNativePanes = encodePanes;
9638
9909
  encodeMethodSectionLabels,
9639
9910
  encodeMethodSectionOrder,
9640
9911
  encodeNativePanes,
9912
+ encodeNotices,
9641
9913
  encodePanes,
9642
9914
  evaluateCustomFieldCondition,
9643
9915
  evaluateCustomFieldVisibility,
@@ -9648,13 +9920,17 @@ var encodeNativePanes = encodePanes;
9648
9920
  inputPadValue,
9649
9921
  isCheckboxChecked,
9650
9922
  isDarkSurface,
9923
+ isDefaultBadgeSet,
9651
9924
  isHexColor,
9925
+ isNoticeIcon,
9652
9926
  isSubscriptionDisputeWebhook,
9653
9927
  isSubscriptionLifecycleWebhook,
9654
9928
  knownSectionLabelKey,
9655
9929
  leaf,
9656
9930
  logoDimensions,
9657
9931
  nativePaneMethodInfo,
9932
+ noticeText,
9933
+ noticesIn,
9658
9934
  offerablePaneMethods,
9659
9935
  paneCatalogFor,
9660
9936
  paneDisplayDefaults,
@@ -9663,6 +9939,7 @@ var encodeNativePanes = encodePanes;
9663
9939
  paneViewVisibility,
9664
9940
  parseCustomFieldsLoose,
9665
9941
  parseImportedBranding,
9942
+ parseNoticesLoose,
9666
9943
  programToTree,
9667
9944
  radiusValue,
9668
9945
  readableInkOn,
@@ -9670,12 +9947,14 @@ var encodeNativePanes = encodePanes;
9670
9947
  resolveAirwallexLabelStyle,
9671
9948
  resolveApplePayButtonStyle,
9672
9949
  resolveGooglePayButtonColor,
9950
+ resolveNoticesAndBadges,
9673
9951
  resolveStripeTheme,
9674
9952
  ruleMatchToTree,
9675
9953
  sanitizeCustomCss,
9676
9954
  sectionLabel,
9677
9955
  sectionOrderOf,
9678
9956
  shadowFor,
9957
+ shownNotices,
9679
9958
  stripeSpacingValues,
9680
9959
  surchargeFigurePlan,
9681
9960
  surchargeShowsLabel,