@shoppexio/storefront 1.0.104 → 1.0.106

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
@@ -80,6 +80,7 @@ __export(src_exports, {
80
80
  normalizeStorefrontCustomFields: () => normalizeStorefrontCustomFields,
81
81
  notificationPreferences: () => notificationPreferences,
82
82
  order: () => order,
83
+ orderReview: () => orderReview,
83
84
  orders: () => orders,
84
85
  pauseSubscription: () => pauseSubscription,
85
86
  productMatchesSearchQuery: () => productMatchesSearchQuery,
@@ -2955,15 +2956,21 @@ async function getCategories() {
2955
2956
  }
2956
2957
 
2957
2958
  // ../contracts/src/redirect-link-template.ts
2958
- var REMAINING_PLACEHOLDER_PATTERNS = [
2959
- /\{\{[\s\S]*?\}\}/g,
2960
- /(?<!\{)\{[^{}]+\}(?!\})/g
2961
- ];
2959
+ function isInsideDoubleBrace(raw) {
2960
+ return raw.startsWith("{{");
2961
+ }
2962
+ function placeholderMatches(template, patterns) {
2963
+ return [
2964
+ ...template.matchAll(patterns.double),
2965
+ ...[...template.matchAll(patterns.single)].filter((match) => !isInsideDoubleBrace(match[0]))
2966
+ ];
2967
+ }
2968
+ var REMAINING_PLACEHOLDER_PATTERNS = {
2969
+ double: /\{\{[\s\S]*?\}\}/g,
2970
+ single: /\{?\{[^{}]+\}(?!\})/g
2971
+ };
2962
2972
  function findDanglingBraceFragments(template) {
2963
- let stripped = template;
2964
- for (const pattern of REMAINING_PLACEHOLDER_PATTERNS) {
2965
- stripped = stripped.replace(pattern, "");
2966
- }
2973
+ const stripped = template.replace(REMAINING_PLACEHOLDER_PATTERNS.double, "").replace(REMAINING_PLACEHOLDER_PATTERNS.single, (raw) => isInsideDoubleBrace(raw) ? raw : "");
2967
2974
  return /[{}]/.test(stripped) ? [...new Set(stripped.match(/[{}]+/g) ?? [])] : [];
2968
2975
  }
2969
2976
  function findRemainingProductRedirectPlaceholders(template) {
@@ -2971,10 +2978,8 @@ function findRemainingProductRedirectPlaceholders(template) {
2971
2978
  return [];
2972
2979
  }
2973
2980
  const remaining = /* @__PURE__ */ new Set();
2974
- for (const pattern of REMAINING_PLACEHOLDER_PATTERNS) {
2975
- for (const match of template.matchAll(pattern)) {
2976
- remaining.add(match[0]);
2977
- }
2981
+ for (const match of placeholderMatches(template, REMAINING_PLACEHOLDER_PATTERNS)) {
2982
+ remaining.add(match[0]);
2978
2983
  }
2979
2984
  for (const fragment of findDanglingBraceFragments(template)) {
2980
2985
  remaining.add(fragment);
@@ -24433,6 +24438,9 @@ var customerPortalAffiliateSummarySchema = external_exports.object({
24433
24438
  address: external_exports.string()
24434
24439
  }).nullable(),
24435
24440
  balance_currency: external_exports.string(),
24441
+ // The shop's IANA zone; `bound_at` is a day on its calendar.
24442
+ // Optional until the backend that sends it is deployed.
24443
+ time_zone: external_exports.string().optional(),
24436
24444
  balances: external_exports.object({
24437
24445
  pending: external_exports.string(),
24438
24446
  available: external_exports.string(),
@@ -24523,7 +24531,23 @@ var customerPortalSubscriptionSummarySchema = external_exports.object({
24523
24531
  can_cancel: external_exports.boolean(),
24524
24532
  can_undo_cancel: external_exports.boolean(),
24525
24533
  can_manage_payment_method: external_exports.boolean()
24526
- })
24534
+ }),
24535
+ // The open renewal's hosted checkout ("Pay now"). Optional until the backend
24536
+ // that sends it is deployed: a storefront script can reach buyers first.
24537
+ renewal_checkout_url: nullableStringSchema.optional(),
24538
+ // When an unpaid renewal's hold ends the subscription, and the renewal to pay now
24539
+ // (me.routes.ts dashboard wire). Optional for the same deploy order.
24540
+ hold_ends_at: nullableStringSchema.optional(),
24541
+ // Set to end without renewing (cancelled at the period end, or a voided renewal): the instant
24542
+ // it ends; null while it renews. Buyer surfaces read it for "Ends" over "Renews". Same deploy order.
24543
+ ends_at: nullableStringSchema.optional(),
24544
+ open_renewal: external_exports.object({
24545
+ uniqid: external_exports.string(),
24546
+ amount: external_exports.string(),
24547
+ currency: external_exports.string(),
24548
+ pay_by: external_exports.string(),
24549
+ pay_url: external_exports.string()
24550
+ }).nullable().optional()
24527
24551
  });
24528
24552
  var customerLoyaltySchema = external_exports.object({
24529
24553
  enabled: external_exports.boolean(),
@@ -24632,7 +24656,17 @@ var customerPortalDashboardSchema = external_exports.object({
24632
24656
  label: external_exports.string(),
24633
24657
  value: external_exports.string(),
24634
24658
  href: nullableStringSchema,
24635
- created_at: external_exports.string()
24659
+ created_at: external_exports.string(),
24660
+ // Files only: downloads left, end date and why a file closed (BuyerFileAccess).
24661
+ // Optional until the backend that sends it is deployed.
24662
+ access: external_exports.object({
24663
+ state: external_exports.enum(["open", "limit_reached", "expired", "revoked", "refunded"]),
24664
+ downloads_left: external_exports.number().nullable(),
24665
+ download_limit: external_exports.number().nullable(),
24666
+ downloads_used: external_exports.number(),
24667
+ ends_at: nullableStringSchema,
24668
+ time_zone: external_exports.string()
24669
+ }).nullable().optional()
24636
24670
  })),
24637
24671
  tickets: external_exports.array(external_exports.object({
24638
24672
  uniqid: external_exports.string(),
@@ -24642,6 +24676,22 @@ var customerPortalDashboardSchema = external_exports.object({
24642
24676
  created_at: nullableStringSchema
24643
24677
  }))
24644
24678
  });
24679
+ var customerPortalOrderReviewSchema = external_exports.object({
24680
+ can_review: external_exports.boolean(),
24681
+ already_submitted: external_exports.boolean(),
24682
+ feedback_uniqid: nullableStringSchema,
24683
+ product_title: nullableStringSchema,
24684
+ score: external_exports.union([external_exports.literal(1), external_exports.literal(3), external_exports.literal(5)]).nullable(),
24685
+ is_automated: external_exports.boolean(),
24686
+ message: nullableStringSchema,
24687
+ submitted_at: nullableStringSchema,
24688
+ reviewer_name: nullableStringSchema,
24689
+ anonymous: external_exports.boolean(),
24690
+ // The hosted review on the checkout host, null unless `can_review`. A storefront
24691
+ // account links here and never posts (#1152). Optional until the backend that
24692
+ // sends it is deployed.
24693
+ review_url: nullableStringSchema.optional()
24694
+ });
24645
24695
  var customerPortalNotificationPreferencesSchema = external_exports.object({
24646
24696
  order_created_emails: external_exports.boolean(),
24647
24697
  order_completed_emails: external_exports.boolean(),
@@ -24788,6 +24838,9 @@ function order(id) {
24788
24838
  schema: customerPortalInvoiceDetailSchema
24789
24839
  });
24790
24840
  }
24841
+ function orderReview(uniqid) {
24842
+ return requestCustomer(`/invoices/${encodeURIComponent(uniqid)}/review`, { schema: customerPortalOrderReviewSchema });
24843
+ }
24791
24844
  async function invoicePdf(id) {
24792
24845
  try {
24793
24846
  const response = await fetch(`${CUSTOMER_API_PREFIX}/invoices/${encodeURIComponent(id)}/pdf`, {
@@ -25053,6 +25106,7 @@ var shoppex = {
25053
25106
  redeemLoyaltyPoints,
25054
25107
  warranties,
25055
25108
  claimWarranty,
25109
+ orderReview,
25056
25110
  resetLicenseHwid,
25057
25111
  subscriptionBillingHistory,
25058
25112
  cancelSubscription,
@@ -25159,6 +25213,7 @@ if (typeof window !== "undefined") {
25159
25213
  normalizeStorefrontCustomFields,
25160
25214
  notificationPreferences,
25161
25215
  order,
25216
+ orderReview,
25162
25217
  orders,
25163
25218
  pauseSubscription,
25164
25219
  productMatchesSearchQuery,