@shoppexio/storefront 1.0.104 → 1.0.105

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,10 @@ 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()
24527
24538
  });
24528
24539
  var customerLoyaltySchema = external_exports.object({
24529
24540
  enabled: external_exports.boolean(),
@@ -24632,7 +24643,17 @@ var customerPortalDashboardSchema = external_exports.object({
24632
24643
  label: external_exports.string(),
24633
24644
  value: external_exports.string(),
24634
24645
  href: nullableStringSchema,
24635
- created_at: external_exports.string()
24646
+ created_at: external_exports.string(),
24647
+ // Files only: downloads left, end date and why a file closed (BuyerFileAccess).
24648
+ // Optional until the backend that sends it is deployed.
24649
+ access: external_exports.object({
24650
+ state: external_exports.enum(["open", "limit_reached", "expired", "revoked", "refunded"]),
24651
+ downloads_left: external_exports.number().nullable(),
24652
+ download_limit: external_exports.number().nullable(),
24653
+ downloads_used: external_exports.number(),
24654
+ ends_at: nullableStringSchema,
24655
+ time_zone: external_exports.string()
24656
+ }).nullable().optional()
24636
24657
  })),
24637
24658
  tickets: external_exports.array(external_exports.object({
24638
24659
  uniqid: external_exports.string(),
@@ -24642,6 +24663,22 @@ var customerPortalDashboardSchema = external_exports.object({
24642
24663
  created_at: nullableStringSchema
24643
24664
  }))
24644
24665
  });
24666
+ var customerPortalOrderReviewSchema = external_exports.object({
24667
+ can_review: external_exports.boolean(),
24668
+ already_submitted: external_exports.boolean(),
24669
+ feedback_uniqid: nullableStringSchema,
24670
+ product_title: nullableStringSchema,
24671
+ score: external_exports.union([external_exports.literal(1), external_exports.literal(3), external_exports.literal(5)]).nullable(),
24672
+ is_automated: external_exports.boolean(),
24673
+ message: nullableStringSchema,
24674
+ submitted_at: nullableStringSchema,
24675
+ reviewer_name: nullableStringSchema,
24676
+ anonymous: external_exports.boolean(),
24677
+ // The hosted review on the checkout host, null unless `can_review`. A storefront
24678
+ // account links here and never posts (#1152). Optional until the backend that
24679
+ // sends it is deployed.
24680
+ review_url: nullableStringSchema.optional()
24681
+ });
24645
24682
  var customerPortalNotificationPreferencesSchema = external_exports.object({
24646
24683
  order_created_emails: external_exports.boolean(),
24647
24684
  order_completed_emails: external_exports.boolean(),
@@ -24788,6 +24825,9 @@ function order(id) {
24788
24825
  schema: customerPortalInvoiceDetailSchema
24789
24826
  });
24790
24827
  }
24828
+ function orderReview(uniqid) {
24829
+ return requestCustomer(`/invoices/${encodeURIComponent(uniqid)}/review`, { schema: customerPortalOrderReviewSchema });
24830
+ }
24791
24831
  async function invoicePdf(id) {
24792
24832
  try {
24793
24833
  const response = await fetch(`${CUSTOMER_API_PREFIX}/invoices/${encodeURIComponent(id)}/pdf`, {
@@ -25053,6 +25093,7 @@ var shoppex = {
25053
25093
  redeemLoyaltyPoints,
25054
25094
  warranties,
25055
25095
  claimWarranty,
25096
+ orderReview,
25056
25097
  resetLicenseHwid,
25057
25098
  subscriptionBillingHistory,
25058
25099
  cancelSubscription,
@@ -25159,6 +25200,7 @@ if (typeof window !== "undefined") {
25159
25200
  normalizeStorefrontCustomFields,
25160
25201
  notificationPreferences,
25161
25202
  order,
25203
+ orderReview,
25162
25204
  orders,
25163
25205
  pauseSubscription,
25164
25206
  productMatchesSearchQuery,