@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.js CHANGED
@@ -143,6 +143,15 @@ var Platform = /* @__PURE__ */ ((Platform2) => {
143
143
  Platform2["Android"] = "Android";
144
144
  return Platform2;
145
145
  })(Platform || {});
146
+ var Architecture = /* @__PURE__ */ ((Architecture2) => {
147
+ Architecture2["Unknown"] = "Unknown";
148
+ Architecture2["Universal"] = "Universal";
149
+ Architecture2["X86"] = "X86";
150
+ Architecture2["X64"] = "X64";
151
+ Architecture2["Arm"] = "Arm";
152
+ Architecture2["Arm64"] = "Arm64";
153
+ return Architecture2;
154
+ })(Architecture || {});
146
155
 
147
156
  // src/inventory/products/schemas.ts
148
157
  var manifestSchema = z2.object({
@@ -156,6 +165,7 @@ var downloadSchema = z2.object({
156
165
  name: z2.string(),
157
166
  key: z2.string(),
158
167
  platform: z2.nativeEnum(Platform),
168
+ arch: z2.nativeEnum(Architecture).nullish(),
159
169
  size: z2.number(),
160
170
  path: z2.string().nullable(),
161
171
  manifest: manifestSchema.optional()
@@ -1637,6 +1647,27 @@ var OfferUtils = class _OfferUtils {
1637
1647
  }
1638
1648
  };
1639
1649
 
1650
+ // src/utils/utm.ts
1651
+ function parseOffSiteReferrer(rawReferrer, currentOrigin) {
1652
+ if (!rawReferrer)
1653
+ return void 0;
1654
+ try {
1655
+ const referrerUrl = new URL(rawReferrer);
1656
+ if (referrerUrl.origin === currentOrigin)
1657
+ return void 0;
1658
+ return referrerUrl.host || void 0;
1659
+ } catch (e) {
1660
+ return void 0;
1661
+ }
1662
+ }
1663
+ function resolveUtm(cached, fresh) {
1664
+ const freshHasUtm = !!(fresh.source || fresh.medium || fresh.campaign || fresh.term || fresh.content);
1665
+ const freshIsExternalArrival = freshHasUtm || !!fresh.referrer;
1666
+ if (freshIsExternalArrival)
1667
+ return fresh;
1668
+ return cached != null ? cached : fresh;
1669
+ }
1670
+
1640
1671
  // src/index.ts
1641
1672
  var MoonbaseClient = class {
1642
1673
  constructor(configuration) {
@@ -1661,6 +1692,7 @@ export {
1661
1692
  ActivationRequestFulfillmentType,
1662
1693
  ActivationRequestStatus,
1663
1694
  ActivationStatus,
1695
+ Architecture,
1664
1696
  ConnectableAccountProvider,
1665
1697
  ConsoleLogger,
1666
1698
  CycleLength,
@@ -1683,7 +1715,9 @@ export {
1683
1715
  SubscriptionStatus,
1684
1716
  TokenStore,
1685
1717
  objectToQuery,
1718
+ parseOffSiteReferrer,
1686
1719
  problemDetailsSchema,
1720
+ resolveUtm,
1687
1721
  schemas_exports12 as schemas,
1688
1722
  utmToObject
1689
1723
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/storefront-api",
3
3
  "type": "module",
4
- "version": "2.0.1",
4
+ "version": "2.2.0",
5
5
  "description": "Package to let you build storefronts with Moonbase.sh as payment and delivery provider",
6
6
  "author": "Tobias Lønnerød Madsen <m@dsen.tv>",
7
7
  "license": "MIT",