@timardex/cluemart-shared 1.5.617 → 1.5.619

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.
@@ -26,7 +26,7 @@ import {
26
26
  EnumVendorType
27
27
  } from "../chunk-ZR4TGWTS.mjs";
28
28
  import "../chunk-S2VBOUOO.mjs";
29
- import "../chunk-4RD4XK5S.mjs";
29
+ import "../chunk-3NBZGJZM.mjs";
30
30
  import {
31
31
  dateFormat,
32
32
  timeFormat
package/dist/index.cjs CHANGED
@@ -114,6 +114,8 @@ __export(index_exports, {
114
114
  buildApplicationShareDescription: () => buildApplicationShareDescription,
115
115
  buildFacebookShareQuote: () => buildFacebookShareQuote,
116
116
  buildInvitationShareDescription: () => buildInvitationShareDescription,
117
+ buildPublicEventShareDescription: () => buildPublicEventShareDescription,
118
+ buildPublicVendorShareDescription: () => buildPublicVendorShareDescription,
117
119
  buildShareMessageSections: () => buildShareMessageSections,
118
120
  buildShareOgDescription: () => buildShareOgDescription,
119
121
  buildShareOgDescriptionFromSections: () => buildShareOgDescriptionFromSections,
@@ -8895,7 +8897,7 @@ var SHARE_DOLLAR_ICON = "$";
8895
8897
  var SHARE_PRICE_RANGE_PREFIX = `${SHARE_DOLLAR_ICON} Price range:`;
8896
8898
  var SHARE_CLOCK_ICON = "\u23F0";
8897
8899
  var SHARE_APPLICATION_DEADLINE_PREFIX = `${SHARE_CLOCK_ICON} Application deadline:`;
8898
- var SHARE_MORE_INFO_LINE = "More info in the ClueMart app";
8900
+ var SHARE_MORE_INFO_LINE = "Shared from ClueMart";
8899
8901
  var DEFAULT_SHARE_OG_IMAGE = `${SHARE_SITE_URL}/assets/logo.webp`;
8900
8902
  var RESOURCE_SHARE_TYPES = [
8901
8903
  "market",
@@ -8943,13 +8945,13 @@ function joinShareDescriptionSections(sections) {
8943
8945
  }
8944
8946
  function appendShareMoreInfoLine(description) {
8945
8947
  const trimmed = description.trim();
8946
- if (trimmed.endsWith(SHARE_MORE_INFO_LINE)) {
8948
+ if (trimmed.startsWith(SHARE_MORE_INFO_LINE)) {
8947
8949
  return trimmed;
8948
8950
  }
8949
8951
  if (trimmed.length === 0) {
8950
8952
  return SHARE_MORE_INFO_LINE;
8951
8953
  }
8952
- return joinShareDescriptionSections([trimmed, SHARE_MORE_INFO_LINE]);
8954
+ return joinShareDescriptionSections([SHARE_MORE_INFO_LINE, trimmed]);
8953
8955
  }
8954
8956
 
8955
8957
  // src/sharing/buildRelationShareDescription.ts
@@ -8977,26 +8979,41 @@ function formatShareRainOrShineLine(rainOrShine) {
8977
8979
  function formatShareIsFoodTrueLine(foodTruck) {
8978
8980
  return foodTruck ? SHARE_FOOD_TRUCK_LINE : null;
8979
8981
  }
8980
- function formatShareInvitationRequirementsSection(requirementLabels) {
8981
- const bullets = requirementLabels.map((label) => `- ${label}`);
8982
+ function formatShareInvitationRequirementsSection(requirements) {
8983
+ const bullets = (requirements ?? []).filter((item) => item.value).map((item) => item.label.trim()).filter((label) => label.length > 0).map((label) => `- ${label}`);
8984
+ if (bullets.length === 0) {
8985
+ return null;
8986
+ }
8982
8987
  return `${SHARE_REQUIREMENTS_SECTION_HEADING}
8983
8988
  ${bullets.join("\n")}`;
8984
8989
  }
8985
8990
  function formatShareTagsSection(tags) {
8986
- const bullets = tags.map((tag) => `- ${tag}`);
8991
+ const bullets = tags.map((tag) => tag.trim()).filter((tag) => tag.length > 0).map((tag) => `- ${tag}`);
8992
+ if (bullets.length === 0) {
8993
+ return null;
8994
+ }
8987
8995
  return `${SHARE_TAGS_SECTION_HEADING}
8988
8996
  ${bullets.join("\n")}`;
8989
8997
  }
8990
- function formatShareApplicationCategoriesSection(categoryLabels) {
8991
- const bullets = categoryLabels.map((label) => `- ${label}`);
8998
+ function formatShareApplicationCategoriesSection(categories) {
8999
+ const bullets = categories.map((category) => formatCategoryLabel(category).trim()).filter((label) => label.length > 0).map((label) => `- ${label}`);
9000
+ if (bullets.length === 0) {
9001
+ return null;
9002
+ }
8992
9003
  return `${SHARE_CATEGORIES_SECTION_HEADING}
8993
9004
  ${bullets.join("\n")}`;
8994
9005
  }
8995
9006
  function formatShareApplicationStallSizeLine(size) {
8996
9007
  return `${SHARE_STALL_SIZE_PREFIX} ${size.width}m \xD7 ${size.depth}m`;
8997
9008
  }
8998
- function formatShareApplicationComplianceSection(complianceLabels) {
8999
- const bullets = complianceLabels.map((label) => `- ${label}`);
9009
+ function formatShareApplicationComplianceSection(compliance) {
9010
+ const bullets = [
9011
+ compliance?.liabilityInsurance && "Liability insurance",
9012
+ compliance?.foodBeverageLicense && "Food & beverage licence"
9013
+ ].filter((label) => Boolean(label)).map((label) => `- ${label}`);
9014
+ if (bullets.length === 0) {
9015
+ return null;
9016
+ }
9000
9017
  return `${SHARE_COMPLIANCE_PREFIX}
9001
9018
  ${bullets.join("\n")}`;
9002
9019
  }
@@ -9011,7 +9028,6 @@ function buildInvitationShareDescription(event, eventInfo2) {
9011
9028
  if (!eventInfo2 || stallTypes2.length === 0) {
9012
9029
  return event.description?.trim() || "";
9013
9030
  }
9014
- const requirementLabels = (eventInfo2.requirements ?? []).filter((item) => item.value).map((item) => item.label);
9015
9031
  const sections = [
9016
9032
  event.location.fullAddress,
9017
9033
  formatShareRainOrShineLine(event.rainOrShine),
@@ -9020,34 +9036,41 @@ function buildInvitationShareDescription(event, eventInfo2) {
9020
9036
  formatShareInvitationApplicationDeadlineLine(
9021
9037
  eventInfo2.applicationDeadlineHours
9022
9038
  ),
9023
- requirementLabels.length > 0 && formatShareInvitationRequirementsSection(requirementLabels)
9039
+ formatShareInvitationRequirementsSection(eventInfo2.requirements)
9024
9040
  ];
9025
9041
  return joinShareDescriptionSections(sections);
9026
9042
  }
9027
9043
  function buildApplicationShareDescription(vendor, vendorInfo) {
9028
- const categoryLabels = vendor.categories.map(
9029
- (category) => formatCategoryLabel(category)
9030
- );
9031
9044
  if (!vendorInfo) {
9032
9045
  return vendor.description?.trim() || "";
9033
9046
  }
9034
- const compliance = vendorInfo.compliance;
9035
- const complianceLabels = [
9036
- compliance?.liabilityInsurance && "Liability insurance",
9037
- compliance?.foodBeverageLicense && "Food & beverage licence"
9038
- ].filter((label) => Boolean(label));
9039
9047
  const profileDescription = vendor.description?.trim();
9040
9048
  const sections = [
9041
9049
  formatShareIsFoodTrueLine(vendor.foodTruck),
9042
- categoryLabels.length > 0 && formatShareApplicationCategoriesSection(categoryLabels),
9050
+ formatShareApplicationCategoriesSection(vendor.categories),
9043
9051
  formatShareApplicationStallSizeLine(vendorInfo.stallInfo.size),
9044
- complianceLabels.length > 0 && formatShareApplicationComplianceSection(complianceLabels),
9052
+ formatShareApplicationComplianceSection(vendorInfo.compliance),
9045
9053
  formatShareApplicationPriceRangeLine(vendorInfo.product.priceRange),
9046
9054
  profileDescription
9047
9055
  ];
9048
9056
  return joinShareDescriptionSections(sections);
9049
9057
  }
9050
9058
 
9059
+ // src/sharing/buildPublicShareDescription.ts
9060
+ function buildPublicEventShareDescription(event) {
9061
+ return joinShareDescriptionSections([
9062
+ formatShareRainOrShineLine(event.rainOrShine),
9063
+ formatShareTagsSection(event.tags),
9064
+ event.description?.trim()
9065
+ ]);
9066
+ }
9067
+ function buildPublicVendorShareDescription(vendor) {
9068
+ return joinShareDescriptionSections([
9069
+ formatShareIsFoodTrueLine(vendor.foodTruck),
9070
+ vendor.description?.trim()
9071
+ ]);
9072
+ }
9073
+
9051
9074
  // src/sharing/buildShareUrl.ts
9052
9075
  var PUBLIC_SHARE_PATH_TYPES = [
9053
9076
  ...RESOURCE_SHARE_TYPES,
@@ -9058,8 +9081,8 @@ var SHARE_TYPE_PATH_REGEX = [
9058
9081
  RELATION_SHARE_APPLICATION,
9059
9082
  RELATION_SHARE_INVITATION
9060
9083
  ].join("|");
9061
- function buildShareUrl(type, id) {
9062
- return `${SHARE_SITE_URL}/share/${type}/${encodeURIComponent(id)}`;
9084
+ function buildShareUrl(type, id, utmMedium = "app") {
9085
+ return `${SHARE_SITE_URL}/share/${type}/${encodeURIComponent(id)}?utm_source=share&utm_medium=${utmMedium}&utm_campaign=${type}`;
9063
9086
  }
9064
9087
 
9065
9088
  // src/sharing/normalizeShareDescription.ts
@@ -9077,12 +9100,12 @@ function normalizeShareText(value) {
9077
9100
  }).join("\n").replace(/\n{3,}/g, "\n\n");
9078
9101
  }
9079
9102
  function shareMessageFooterPlacementForType(_shareType) {
9080
- return "after-body";
9103
+ return "before-body";
9081
9104
  }
9082
9105
  function buildShareMessageSections(input) {
9083
9106
  const title = normalizeShareText(input.title);
9084
9107
  const description = normalizeShareText(input.description);
9085
- return [title, description, SHARE_MORE_INFO_LINE].filter(
9108
+ return [SHARE_MORE_INFO_LINE, title, description].filter(
9086
9109
  (section) => section.length > 0
9087
9110
  );
9088
9111
  }
@@ -9302,6 +9325,8 @@ var gameTypeToDisplayName = {
9302
9325
  buildApplicationShareDescription,
9303
9326
  buildFacebookShareQuote,
9304
9327
  buildInvitationShareDescription,
9328
+ buildPublicEventShareDescription,
9329
+ buildPublicVendorShareDescription,
9305
9330
  buildShareMessageSections,
9306
9331
  buildShareOgDescription,
9307
9332
  buildShareOgDescriptionFromSections,