@moonbase.sh/storefront-api 2.0.1 → 2.2.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
@@ -24,6 +24,7 @@ __export(index_exports, {
24
24
  ActivationRequestFulfillmentType: () => ActivationRequestFulfillmentType,
25
25
  ActivationRequestStatus: () => ActivationRequestStatus,
26
26
  ActivationStatus: () => ActivationStatus,
27
+ Architecture: () => Architecture,
27
28
  ConnectableAccountProvider: () => ConnectableAccountProvider,
28
29
  ConsoleLogger: () => ConsoleLogger,
29
30
  CycleLength: () => CycleLength,
@@ -46,7 +47,9 @@ __export(index_exports, {
46
47
  SubscriptionStatus: () => SubscriptionStatus,
47
48
  TokenStore: () => TokenStore,
48
49
  objectToQuery: () => objectToQuery,
50
+ parseOffSiteReferrer: () => parseOffSiteReferrer,
49
51
  problemDetailsSchema: () => problemDetailsSchema,
52
+ resolveUtm: () => resolveUtm,
50
53
  schemas: () => schemas_exports12,
51
54
  utmToObject: () => utmToObject
52
55
  });
@@ -191,6 +194,15 @@ var Platform = /* @__PURE__ */ ((Platform2) => {
191
194
  Platform2["Android"] = "Android";
192
195
  return Platform2;
193
196
  })(Platform || {});
197
+ var Architecture = /* @__PURE__ */ ((Architecture2) => {
198
+ Architecture2["Unknown"] = "Unknown";
199
+ Architecture2["Universal"] = "Universal";
200
+ Architecture2["X86"] = "X86";
201
+ Architecture2["X64"] = "X64";
202
+ Architecture2["Arm"] = "Arm";
203
+ Architecture2["Arm64"] = "Arm64";
204
+ return Architecture2;
205
+ })(Architecture || {});
194
206
 
195
207
  // src/inventory/products/schemas.ts
196
208
  var manifestSchema = import_zod2.z.object({
@@ -204,6 +216,7 @@ var downloadSchema = import_zod2.z.object({
204
216
  name: import_zod2.z.string(),
205
217
  key: import_zod2.z.string(),
206
218
  platform: import_zod2.z.nativeEnum(Platform),
219
+ arch: import_zod2.z.nativeEnum(Architecture).nullish(),
207
220
  size: import_zod2.z.number(),
208
221
  path: import_zod2.z.string().nullable(),
209
222
  manifest: manifestSchema.optional()
@@ -1685,6 +1698,27 @@ var OfferUtils = class _OfferUtils {
1685
1698
  }
1686
1699
  };
1687
1700
 
1701
+ // src/utils/utm.ts
1702
+ function parseOffSiteReferrer(rawReferrer, currentOrigin) {
1703
+ if (!rawReferrer)
1704
+ return void 0;
1705
+ try {
1706
+ const referrerUrl = new URL(rawReferrer);
1707
+ if (referrerUrl.origin === currentOrigin)
1708
+ return void 0;
1709
+ return referrerUrl.host || void 0;
1710
+ } catch (e) {
1711
+ return void 0;
1712
+ }
1713
+ }
1714
+ function resolveUtm(cached, fresh) {
1715
+ const freshHasUtm = !!(fresh.source || fresh.medium || fresh.campaign || fresh.term || fresh.content);
1716
+ const freshIsExternalArrival = freshHasUtm || !!fresh.referrer;
1717
+ if (freshIsExternalArrival)
1718
+ return fresh;
1719
+ return cached != null ? cached : fresh;
1720
+ }
1721
+
1688
1722
  // src/index.ts
1689
1723
  var MoonbaseClient = class {
1690
1724
  constructor(configuration) {
@@ -1710,6 +1744,7 @@ var MoonbaseClient = class {
1710
1744
  ActivationRequestFulfillmentType,
1711
1745
  ActivationRequestStatus,
1712
1746
  ActivationStatus,
1747
+ Architecture,
1713
1748
  ConnectableAccountProvider,
1714
1749
  ConsoleLogger,
1715
1750
  CycleLength,
@@ -1732,7 +1767,9 @@ var MoonbaseClient = class {
1732
1767
  SubscriptionStatus,
1733
1768
  TokenStore,
1734
1769
  objectToQuery,
1770
+ parseOffSiteReferrer,
1735
1771
  problemDetailsSchema,
1772
+ resolveUtm,
1736
1773
  schemas,
1737
1774
  utmToObject
1738
1775
  });