@drawbridge/drawbridge-utils 0.0.89 → 0.0.91

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/fetch.cjs CHANGED
@@ -66,7 +66,19 @@ var request = async ({
66
66
  "?" + import_qs.default.stringify(
67
67
  params,
68
68
  {
69
- encode: false
69
+ // Values MUST be percent-encoded. Params routinely carry user input
70
+ // (a list search for `Smith & Sons`) and whole URLs (the OAuth
71
+ // breakout's redirectTo = /api/oauth/authorize?client_id=…&redirect_uri=…).
72
+ // With encoding off entirely, the first `&` inside a value ended that
73
+ // value and the remainder arrived as sibling params: searches
74
+ // truncated silently, and the Shopify account-link resume lost its
75
+ // redirect_uri, dropping the merchant on /organizations instead of
76
+ // back in the embedded app.
77
+ //
78
+ // encodeValuesOnly — not full encoding — because the bracket notation
79
+ // stays readable (search[keys][0]=…), so every query the api already
80
+ // parses is byte-identical whenever the values needed no escaping.
81
+ encodeValuesOnly: true
70
82
  }
71
83
  )
72
84
  );
package/dist/fetch.d.cts CHANGED
@@ -51,7 +51,19 @@ const request = async ({
51
51
  '?' + qs.stringify(
52
52
  params,
53
53
  {
54
- encode : false
54
+ // Values MUST be percent-encoded. Params routinely carry user input
55
+ // (a list search for `Smith & Sons`) and whole URLs (the OAuth
56
+ // breakout's redirectTo = /api/oauth/authorize?client_id=…&redirect_uri=…).
57
+ // With encoding off entirely, the first `&` inside a value ended that
58
+ // value and the remainder arrived as sibling params: searches
59
+ // truncated silently, and the Shopify account-link resume lost its
60
+ // redirect_uri, dropping the merchant on /organizations instead of
61
+ // back in the embedded app.
62
+ //
63
+ // encodeValuesOnly — not full encoding — because the bracket notation
64
+ // stays readable (search[keys][0]=…), so every query the api already
65
+ // parses is byte-identical whenever the values needed no escaping.
66
+ encodeValuesOnly : true
55
67
  }
56
68
  )
57
69
  );
package/dist/fetch.d.ts CHANGED
@@ -51,7 +51,19 @@ const request = async ({
51
51
  '?' + qs.stringify(
52
52
  params,
53
53
  {
54
- encode : false
54
+ // Values MUST be percent-encoded. Params routinely carry user input
55
+ // (a list search for `Smith & Sons`) and whole URLs (the OAuth
56
+ // breakout's redirectTo = /api/oauth/authorize?client_id=…&redirect_uri=…).
57
+ // With encoding off entirely, the first `&` inside a value ended that
58
+ // value and the remainder arrived as sibling params: searches
59
+ // truncated silently, and the Shopify account-link resume lost its
60
+ // redirect_uri, dropping the merchant on /organizations instead of
61
+ // back in the embedded app.
62
+ //
63
+ // encodeValuesOnly — not full encoding — because the bracket notation
64
+ // stays readable (search[keys][0]=…), so every query the api already
65
+ // parses is byte-identical whenever the values needed no escaping.
66
+ encodeValuesOnly : true
55
67
  }
56
68
  )
57
69
  );
package/dist/fetch.js CHANGED
@@ -30,7 +30,19 @@ var request = async ({
30
30
  "?" + qs.stringify(
31
31
  params,
32
32
  {
33
- encode: false
33
+ // Values MUST be percent-encoded. Params routinely carry user input
34
+ // (a list search for `Smith & Sons`) and whole URLs (the OAuth
35
+ // breakout's redirectTo = /api/oauth/authorize?client_id=…&redirect_uri=…).
36
+ // With encoding off entirely, the first `&` inside a value ended that
37
+ // value and the remainder arrived as sibling params: searches
38
+ // truncated silently, and the Shopify account-link resume lost its
39
+ // redirect_uri, dropping the merchant on /organizations instead of
40
+ // back in the embedded app.
41
+ //
42
+ // encodeValuesOnly — not full encoding — because the bracket notation
43
+ // stays readable (search[keys][0]=…), so every query the api already
44
+ // parses is byte-identical whenever the values needed no escaping.
45
+ encodeValuesOnly: true
34
46
  }
35
47
  )
36
48
  );
package/dist/plans.cjs CHANGED
@@ -423,8 +423,8 @@ var plans = {
423
423
  }
424
424
  };
425
425
  var conversionRate = (subscription) => {
426
- var _a;
427
- return (subscription == null ? void 0 : subscription.conversion) ?? ((_a = plans[subscription == null ? void 0 : subscription.plan]) == null ? void 0 : _a.conversion) ?? free.conversion;
426
+ var _a, _b;
427
+ return ((_a = subscription == null ? void 0 : subscription.overrides) == null ? void 0 : _a.conversion) ?? (subscription == null ? void 0 : subscription.conversion) ?? ((_b = plans[subscription == null ? void 0 : subscription.plan]) == null ? void 0 : _b.conversion) ?? free.conversion;
428
428
  };
429
429
  // Annotate the CommonJS export names for ESM import in node:
430
430
  0 && (module.exports = {
package/dist/plans.d.cts CHANGED
@@ -196,11 +196,14 @@ const plans = {
196
196
  };
197
197
 
198
198
  // Resolve the conversion-fee percentage for an order's owning org.
199
- // Precedence: explicit per-subscription override (admin/negotiated)
200
- // the plan's catalog default → the free-org rate. `subscription` is null
201
- // for free orgs (they have no subscription doc).
199
+ // Precedence: explicit per-subscription override (admin/negotiated) in
200
+ // subscription.overrides → the legacy top-level field (pre-migration docs;
201
+ // remove after the overrides cleanup release) the plan's catalog default →
202
+ // the free-org rate. `??` throughout — a stored 0 is a valid 0% override.
203
+ // `subscription` is null for free orgs (they have no subscription doc).
202
204
  const conversionRate = ( subscription ) =>
203
- subscription?.conversion
205
+ subscription?.overrides?.conversion
206
+ ?? subscription?.conversion
204
207
  ?? plans[ subscription?.plan ]?.conversion
205
208
  ?? free.conversion;
206
209
 
package/dist/plans.d.ts CHANGED
@@ -196,11 +196,14 @@ const plans = {
196
196
  };
197
197
 
198
198
  // Resolve the conversion-fee percentage for an order's owning org.
199
- // Precedence: explicit per-subscription override (admin/negotiated)
200
- // the plan's catalog default → the free-org rate. `subscription` is null
201
- // for free orgs (they have no subscription doc).
199
+ // Precedence: explicit per-subscription override (admin/negotiated) in
200
+ // subscription.overrides → the legacy top-level field (pre-migration docs;
201
+ // remove after the overrides cleanup release) the plan's catalog default →
202
+ // the free-org rate. `??` throughout — a stored 0 is a valid 0% override.
203
+ // `subscription` is null for free orgs (they have no subscription doc).
202
204
  const conversionRate = ( subscription ) =>
203
- subscription?.conversion
205
+ subscription?.overrides?.conversion
206
+ ?? subscription?.conversion
204
207
  ?? plans[ subscription?.plan ]?.conversion
205
208
  ?? free.conversion;
206
209
 
package/dist/plans.js CHANGED
@@ -386,8 +386,8 @@ var plans = {
386
386
  }
387
387
  };
388
388
  var conversionRate = (subscription) => {
389
- var _a;
390
- return (subscription == null ? void 0 : subscription.conversion) ?? ((_a = plans[subscription == null ? void 0 : subscription.plan]) == null ? void 0 : _a.conversion) ?? free.conversion;
389
+ var _a, _b;
390
+ return ((_a = subscription == null ? void 0 : subscription.overrides) == null ? void 0 : _a.conversion) ?? (subscription == null ? void 0 : subscription.conversion) ?? ((_b = plans[subscription == null ? void 0 : subscription.plan]) == null ? void 0 : _b.conversion) ?? free.conversion;
391
391
  };
392
392
  export {
393
393
  conversionRate,
package/package.json CHANGED
@@ -13,10 +13,10 @@
13
13
  "tinycolor2": "1.6.0"
14
14
  },
15
15
  "devDependencies": {
16
+ "@drawbridge/drawbridge-agents": "0.1.28",
16
17
  "@node-oauth/oauth2-server": "5.3.0",
17
18
  "tsup": "8.5.1",
18
- "typescript": "5.9.3",
19
- "@drawbridge/drawbridge-agents": "0.1.10"
19
+ "typescript": "5.9.3"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "@node-oauth/oauth2-server": "^5.3.0"
@@ -164,5 +164,5 @@
164
164
  "test": ". \"$HOME/.nvm/nvm.sh\" && nvm use && node --test"
165
165
  },
166
166
  "types": "dist/index.d.ts",
167
- "version": "0.0.89"
167
+ "version": "0.0.91"
168
168
  }