@drawbridge/drawbridge-utils 0.0.145 → 0.0.147

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.
@@ -4177,9 +4177,8 @@ var shopify_default2 = {
4177
4177
  adminAccessToken,
4178
4178
  domain: connection2.shop
4179
4179
  });
4180
- if (subscriptions.length && subscriptions.every((subscription) => typeof subscription.metered === "boolean")) {
4181
- metered = ((_a = subscriptions.find((subscription) => subscription.usageLineItemId)) == null ? void 0 : _a.usageLineItemId) || null;
4182
- }
4180
+ const usageLine = (_a = subscriptions.find((subscription) => subscription.usageLineItemId)) == null ? void 0 : _a.usageLineItemId;
4181
+ if (usageLine) metered = usageLine;
4183
4182
  } catch (probeError) {
4184
4183
  billingProbeFailed = true;
4185
4184
  (_b = logger2 == null ? void 0 : logger2.warn) == null ? void 0 : _b.call(logger2, "shopify.health.billing.probe.failed", {
@@ -4550,19 +4549,17 @@ var shopify_default2 = {
4550
4549
  //
4551
4550
  // Scope drift is NOT here: drawbridge-sync writes it onto the connection
4552
4551
  // document, and the document's own warnings render beside these.
4553
- // Both cards carry `action : 'billing'`: the dashboard renders it as a real
4554
- // button that mints the corrective subscription (POST .../billing) and sends
4555
- // the owner to Shopify's confirmation screen — the fix lives in OUR
4556
- // dashboard, and the one Shopify-hosted step is the charge consent no app
4557
- // can perform for a merchant.
4552
+ // Both cards send the merchant INTO THE APP via the store link already on
4553
+ // this page the App Home is where the issue renders (its error section)
4554
+ // and where the fix runs (the release-then-reselect flow). No dashboard
4555
+ // button: two entry points into a cancel flow is two ways to get it wrong.
4558
4556
  tasks: (data2) => {
4559
4557
  var _a;
4560
4558
  return [
4561
4559
  ...(data2 == null ? void 0 : data2.status) === "pending" ? [
4562
4560
  {
4563
- action: "billing",
4564
- message: "Approve the Drawbridge plan to activate this connection. You'll be asked to select a plan on Shopify, then everything else happens here.",
4565
- title: "Approve your plan",
4561
+ message: "Open the Drawbridge app in your Shopify admin and choose your plan. The connection activates once Shopify confirms it.",
4562
+ title: "Choose your plan",
4566
4563
  type: "warning"
4567
4564
  }
4568
4565
  ] : [],
@@ -4575,8 +4572,7 @@ var shopify_default2 = {
4575
4572
  // nagging on silence.
4576
4573
  ...(data2 == null ? void 0 : data2.status) === "active" && ((_a = data2 == null ? void 0 : data2.source) == null ? void 0 : _a.metered) === null ? [
4577
4574
  {
4578
- action: "billing",
4579
- message: "Order billing isn't set up for this store, so campaign-attributed orders aren't being charged. You'll need to reselect your plan on Shopify and approve it to fix this.",
4575
+ message: "Order billing isn't set up for this store, so campaign-attributed orders aren't being charged. Open the Drawbridge app in your Shopify admin \u2014 it shows this issue and walks you through reselecting your plan.",
4580
4576
  title: "Fix order billing",
4581
4577
  type: "error"
4582
4578
  }
@@ -4943,20 +4943,20 @@ var shopify = {
4943
4943
  domain : connection.shop
4944
4944
  });
4945
4945
 
4946
- // Only an ACTIVE approval says anything about metering — no
4947
- // subscriptions (mid-install, plan pending) leaves the stamp
4948
- // untouched rather than asserting null from silence. The
4949
- // every-boolean guard is version skew insurance: an older
4950
- // @drawbridge/shopify returns subscriptions without the flag
4951
- // (and without usageLineItemId), and reading that silence as
4952
- // unmetered would nag every healthy merchant to re-approve a
4953
- // plan that is fine the flag being boolean proves an SDK
4954
- // that also reports the line id.
4955
- if( subscriptions.length && subscriptions.every( ( subscription ) => typeof subscription.metered === 'boolean' ) ){
4956
-
4957
- metered = subscriptions.find( ( subscription ) => subscription.usageLineItemId )?.usageLineItemId || null;
4958
-
4959
- }
4946
+ // A usage line on the approval is POSITIVE evidence and gets
4947
+ // stamped. Its ABSENCE proves nothing: measured 2026-09-04
4948
+ // (both 2026-04 and unstable, against a plan whose meter
4949
+ // exists), managed-pricing App-Events meters never
4950
+ // materialize as subscription line items — AppUsagePricing is
4951
+ // the legacy usage-charge model. Reading absence as
4952
+ // "unmetered" flagged healthy stores, so absence is NO
4953
+ // VERDICT: the stamp, the Issue, the card and the
4954
+ // meter-missing pager all stay silent until a signal that can
4955
+ // actually observe the meter exists (Partner API
4956
+ // USAGE_CHARGE_APPLIED accrual events are that signal).
4957
+ const usageLine = subscriptions.find( ( subscription ) => subscription.usageLineItemId )?.usageLineItemId;
4958
+
4959
+ if( usageLine ) metered = usageLine;
4960
4960
 
4961
4961
  } catch ( probeError ) {
4962
4962
 
@@ -5417,18 +5417,16 @@ var shopify = {
5417
5417
  //
5418
5418
  // Scope drift is NOT here: drawbridge-sync writes it onto the connection
5419
5419
  // document, and the document's own warnings render beside these.
5420
- // Both cards carry `action : 'billing'`: the dashboard renders it as a real
5421
- // button that mints the corrective subscription (POST .../billing) and sends
5422
- // the owner to Shopify's confirmation screen — the fix lives in OUR
5423
- // dashboard, and the one Shopify-hosted step is the charge consent no app
5424
- // can perform for a merchant.
5420
+ // Both cards send the merchant INTO THE APP via the store link already on
5421
+ // this page the App Home is where the issue renders (its error section)
5422
+ // and where the fix runs (the release-then-reselect flow). No dashboard
5423
+ // button: two entry points into a cancel flow is two ways to get it wrong.
5425
5424
  tasks : ( data ) => [
5426
5425
  ...( data?.status === 'pending'
5427
5426
  ? [
5428
5427
  {
5429
- action : 'billing',
5430
- message : 'Approve the Drawbridge plan to activate this connection. You\'ll be asked to select a plan on Shopify, then everything else happens here.',
5431
- title : 'Approve your plan',
5428
+ message : 'Open the Drawbridge app in your Shopify admin and choose your plan. The connection activates once Shopify confirms it.',
5429
+ title : 'Choose your plan',
5432
5430
  type : 'warning'
5433
5431
  }
5434
5432
  ]
@@ -5444,8 +5442,7 @@ var shopify = {
5444
5442
  ...( data?.status === 'active' && data?.source?.metered === null
5445
5443
  ? [
5446
5444
  {
5447
- action : 'billing',
5448
- message : 'Order billing isn\'t set up for this store, so campaign-attributed orders aren\'t being charged. You\'ll need to reselect your plan on Shopify and approve it to fix this.',
5445
+ message : 'Order billing isn\'t set up for this store, so campaign-attributed orders aren\'t being charged. Open the Drawbridge app in your Shopify admin — it shows this issue and walks you through reselecting your plan.',
5449
5446
  title : 'Fix order billing',
5450
5447
  type : 'error'
5451
5448
  }
@@ -4943,20 +4943,20 @@ var shopify = {
4943
4943
  domain : connection.shop
4944
4944
  });
4945
4945
 
4946
- // Only an ACTIVE approval says anything about metering — no
4947
- // subscriptions (mid-install, plan pending) leaves the stamp
4948
- // untouched rather than asserting null from silence. The
4949
- // every-boolean guard is version skew insurance: an older
4950
- // @drawbridge/shopify returns subscriptions without the flag
4951
- // (and without usageLineItemId), and reading that silence as
4952
- // unmetered would nag every healthy merchant to re-approve a
4953
- // plan that is fine the flag being boolean proves an SDK
4954
- // that also reports the line id.
4955
- if( subscriptions.length && subscriptions.every( ( subscription ) => typeof subscription.metered === 'boolean' ) ){
4956
-
4957
- metered = subscriptions.find( ( subscription ) => subscription.usageLineItemId )?.usageLineItemId || null;
4958
-
4959
- }
4946
+ // A usage line on the approval is POSITIVE evidence and gets
4947
+ // stamped. Its ABSENCE proves nothing: measured 2026-09-04
4948
+ // (both 2026-04 and unstable, against a plan whose meter
4949
+ // exists), managed-pricing App-Events meters never
4950
+ // materialize as subscription line items — AppUsagePricing is
4951
+ // the legacy usage-charge model. Reading absence as
4952
+ // "unmetered" flagged healthy stores, so absence is NO
4953
+ // VERDICT: the stamp, the Issue, the card and the
4954
+ // meter-missing pager all stay silent until a signal that can
4955
+ // actually observe the meter exists (Partner API
4956
+ // USAGE_CHARGE_APPLIED accrual events are that signal).
4957
+ const usageLine = subscriptions.find( ( subscription ) => subscription.usageLineItemId )?.usageLineItemId;
4958
+
4959
+ if( usageLine ) metered = usageLine;
4960
4960
 
4961
4961
  } catch ( probeError ) {
4962
4962
 
@@ -5417,18 +5417,16 @@ var shopify = {
5417
5417
  //
5418
5418
  // Scope drift is NOT here: drawbridge-sync writes it onto the connection
5419
5419
  // document, and the document's own warnings render beside these.
5420
- // Both cards carry `action : 'billing'`: the dashboard renders it as a real
5421
- // button that mints the corrective subscription (POST .../billing) and sends
5422
- // the owner to Shopify's confirmation screen — the fix lives in OUR
5423
- // dashboard, and the one Shopify-hosted step is the charge consent no app
5424
- // can perform for a merchant.
5420
+ // Both cards send the merchant INTO THE APP via the store link already on
5421
+ // this page the App Home is where the issue renders (its error section)
5422
+ // and where the fix runs (the release-then-reselect flow). No dashboard
5423
+ // button: two entry points into a cancel flow is two ways to get it wrong.
5425
5424
  tasks : ( data ) => [
5426
5425
  ...( data?.status === 'pending'
5427
5426
  ? [
5428
5427
  {
5429
- action : 'billing',
5430
- message : 'Approve the Drawbridge plan to activate this connection. You\'ll be asked to select a plan on Shopify, then everything else happens here.',
5431
- title : 'Approve your plan',
5428
+ message : 'Open the Drawbridge app in your Shopify admin and choose your plan. The connection activates once Shopify confirms it.',
5429
+ title : 'Choose your plan',
5432
5430
  type : 'warning'
5433
5431
  }
5434
5432
  ]
@@ -5444,8 +5442,7 @@ var shopify = {
5444
5442
  ...( data?.status === 'active' && data?.source?.metered === null
5445
5443
  ? [
5446
5444
  {
5447
- action : 'billing',
5448
- message : 'Order billing isn\'t set up for this store, so campaign-attributed orders aren\'t being charged. You\'ll need to reselect your plan on Shopify and approve it to fix this.',
5445
+ message : 'Order billing isn\'t set up for this store, so campaign-attributed orders aren\'t being charged. Open the Drawbridge app in your Shopify admin — it shows this issue and walks you through reselecting your plan.',
5449
5446
  title : 'Fix order billing',
5450
5447
  type : 'error'
5451
5448
  }
@@ -4103,9 +4103,8 @@ var shopify_default2 = {
4103
4103
  adminAccessToken,
4104
4104
  domain: connection2.shop
4105
4105
  });
4106
- if (subscriptions.length && subscriptions.every((subscription) => typeof subscription.metered === "boolean")) {
4107
- metered = ((_a = subscriptions.find((subscription) => subscription.usageLineItemId)) == null ? void 0 : _a.usageLineItemId) || null;
4108
- }
4106
+ const usageLine = (_a = subscriptions.find((subscription) => subscription.usageLineItemId)) == null ? void 0 : _a.usageLineItemId;
4107
+ if (usageLine) metered = usageLine;
4109
4108
  } catch (probeError) {
4110
4109
  billingProbeFailed = true;
4111
4110
  (_b = logger2 == null ? void 0 : logger2.warn) == null ? void 0 : _b.call(logger2, "shopify.health.billing.probe.failed", {
@@ -4476,19 +4475,17 @@ var shopify_default2 = {
4476
4475
  //
4477
4476
  // Scope drift is NOT here: drawbridge-sync writes it onto the connection
4478
4477
  // document, and the document's own warnings render beside these.
4479
- // Both cards carry `action : 'billing'`: the dashboard renders it as a real
4480
- // button that mints the corrective subscription (POST .../billing) and sends
4481
- // the owner to Shopify's confirmation screen — the fix lives in OUR
4482
- // dashboard, and the one Shopify-hosted step is the charge consent no app
4483
- // can perform for a merchant.
4478
+ // Both cards send the merchant INTO THE APP via the store link already on
4479
+ // this page the App Home is where the issue renders (its error section)
4480
+ // and where the fix runs (the release-then-reselect flow). No dashboard
4481
+ // button: two entry points into a cancel flow is two ways to get it wrong.
4484
4482
  tasks: (data2) => {
4485
4483
  var _a;
4486
4484
  return [
4487
4485
  ...(data2 == null ? void 0 : data2.status) === "pending" ? [
4488
4486
  {
4489
- action: "billing",
4490
- message: "Approve the Drawbridge plan to activate this connection. You'll be asked to select a plan on Shopify, then everything else happens here.",
4491
- title: "Approve your plan",
4487
+ message: "Open the Drawbridge app in your Shopify admin and choose your plan. The connection activates once Shopify confirms it.",
4488
+ title: "Choose your plan",
4492
4489
  type: "warning"
4493
4490
  }
4494
4491
  ] : [],
@@ -4501,8 +4498,7 @@ var shopify_default2 = {
4501
4498
  // nagging on silence.
4502
4499
  ...(data2 == null ? void 0 : data2.status) === "active" && ((_a = data2 == null ? void 0 : data2.source) == null ? void 0 : _a.metered) === null ? [
4503
4500
  {
4504
- action: "billing",
4505
- message: "Order billing isn't set up for this store, so campaign-attributed orders aren't being charged. You'll need to reselect your plan on Shopify and approve it to fix this.",
4501
+ message: "Order billing isn't set up for this store, so campaign-attributed orders aren't being charged. Open the Drawbridge app in your Shopify admin \u2014 it shows this issue and walks you through reselecting your plan.",
4506
4502
  title: "Fix order billing",
4507
4503
  type: "error"
4508
4504
  }
@@ -4102,9 +4102,8 @@ var shopify_default2 = {
4102
4102
  adminAccessToken,
4103
4103
  domain: connection2.shop
4104
4104
  });
4105
- if (subscriptions.length && subscriptions.every((subscription) => typeof subscription.metered === "boolean")) {
4106
- metered = ((_a = subscriptions.find((subscription) => subscription.usageLineItemId)) == null ? void 0 : _a.usageLineItemId) || null;
4107
- }
4105
+ const usageLine = (_a = subscriptions.find((subscription) => subscription.usageLineItemId)) == null ? void 0 : _a.usageLineItemId;
4106
+ if (usageLine) metered = usageLine;
4108
4107
  } catch (probeError) {
4109
4108
  billingProbeFailed = true;
4110
4109
  (_b = logger2 == null ? void 0 : logger2.warn) == null ? void 0 : _b.call(logger2, "shopify.health.billing.probe.failed", {
@@ -4475,19 +4474,17 @@ var shopify_default2 = {
4475
4474
  //
4476
4475
  // Scope drift is NOT here: drawbridge-sync writes it onto the connection
4477
4476
  // document, and the document's own warnings render beside these.
4478
- // Both cards carry `action : 'billing'`: the dashboard renders it as a real
4479
- // button that mints the corrective subscription (POST .../billing) and sends
4480
- // the owner to Shopify's confirmation screen — the fix lives in OUR
4481
- // dashboard, and the one Shopify-hosted step is the charge consent no app
4482
- // can perform for a merchant.
4477
+ // Both cards send the merchant INTO THE APP via the store link already on
4478
+ // this page the App Home is where the issue renders (its error section)
4479
+ // and where the fix runs (the release-then-reselect flow). No dashboard
4480
+ // button: two entry points into a cancel flow is two ways to get it wrong.
4483
4481
  tasks: (data2) => {
4484
4482
  var _a;
4485
4483
  return [
4486
4484
  ...(data2 == null ? void 0 : data2.status) === "pending" ? [
4487
4485
  {
4488
- action: "billing",
4489
- message: "Approve the Drawbridge plan to activate this connection. You'll be asked to select a plan on Shopify, then everything else happens here.",
4490
- title: "Approve your plan",
4486
+ message: "Open the Drawbridge app in your Shopify admin and choose your plan. The connection activates once Shopify confirms it.",
4487
+ title: "Choose your plan",
4491
4488
  type: "warning"
4492
4489
  }
4493
4490
  ] : [],
@@ -4500,8 +4497,7 @@ var shopify_default2 = {
4500
4497
  // nagging on silence.
4501
4498
  ...(data2 == null ? void 0 : data2.status) === "active" && ((_a = data2 == null ? void 0 : data2.source) == null ? void 0 : _a.metered) === null ? [
4502
4499
  {
4503
- action: "billing",
4504
- message: "Order billing isn't set up for this store, so campaign-attributed orders aren't being charged. You'll need to reselect your plan on Shopify and approve it to fix this.",
4500
+ message: "Order billing isn't set up for this store, so campaign-attributed orders aren't being charged. Open the Drawbridge app in your Shopify admin \u2014 it shows this issue and walks you through reselecting your plan.",
4505
4501
  title: "Fix order billing",
4506
4502
  type: "error"
4507
4503
  }
package/dist/providers.js CHANGED
@@ -4058,9 +4058,8 @@ var shopify_default2 = {
4058
4058
  adminAccessToken,
4059
4059
  domain: connection2.shop
4060
4060
  });
4061
- if (subscriptions.length && subscriptions.every((subscription) => typeof subscription.metered === "boolean")) {
4062
- metered = ((_a = subscriptions.find((subscription) => subscription.usageLineItemId)) == null ? void 0 : _a.usageLineItemId) || null;
4063
- }
4061
+ const usageLine = (_a = subscriptions.find((subscription) => subscription.usageLineItemId)) == null ? void 0 : _a.usageLineItemId;
4062
+ if (usageLine) metered = usageLine;
4064
4063
  } catch (probeError) {
4065
4064
  billingProbeFailed = true;
4066
4065
  (_b = logger2 == null ? void 0 : logger2.warn) == null ? void 0 : _b.call(logger2, "shopify.health.billing.probe.failed", {
@@ -4431,19 +4430,17 @@ var shopify_default2 = {
4431
4430
  //
4432
4431
  // Scope drift is NOT here: drawbridge-sync writes it onto the connection
4433
4432
  // document, and the document's own warnings render beside these.
4434
- // Both cards carry `action : 'billing'`: the dashboard renders it as a real
4435
- // button that mints the corrective subscription (POST .../billing) and sends
4436
- // the owner to Shopify's confirmation screen — the fix lives in OUR
4437
- // dashboard, and the one Shopify-hosted step is the charge consent no app
4438
- // can perform for a merchant.
4433
+ // Both cards send the merchant INTO THE APP via the store link already on
4434
+ // this page the App Home is where the issue renders (its error section)
4435
+ // and where the fix runs (the release-then-reselect flow). No dashboard
4436
+ // button: two entry points into a cancel flow is two ways to get it wrong.
4439
4437
  tasks: (data2) => {
4440
4438
  var _a;
4441
4439
  return [
4442
4440
  ...(data2 == null ? void 0 : data2.status) === "pending" ? [
4443
4441
  {
4444
- action: "billing",
4445
- message: "Approve the Drawbridge plan to activate this connection. You'll be asked to select a plan on Shopify, then everything else happens here.",
4446
- title: "Approve your plan",
4442
+ message: "Open the Drawbridge app in your Shopify admin and choose your plan. The connection activates once Shopify confirms it.",
4443
+ title: "Choose your plan",
4447
4444
  type: "warning"
4448
4445
  }
4449
4446
  ] : [],
@@ -4456,8 +4453,7 @@ var shopify_default2 = {
4456
4453
  // nagging on silence.
4457
4454
  ...(data2 == null ? void 0 : data2.status) === "active" && ((_a = data2 == null ? void 0 : data2.source) == null ? void 0 : _a.metered) === null ? [
4458
4455
  {
4459
- action: "billing",
4460
- message: "Order billing isn't set up for this store, so campaign-attributed orders aren't being charged. You'll need to reselect your plan on Shopify and approve it to fix this.",
4456
+ message: "Order billing isn't set up for this store, so campaign-attributed orders aren't being charged. Open the Drawbridge app in your Shopify admin \u2014 it shows this issue and walks you through reselecting your plan.",
4461
4457
  title: "Fix order billing",
4462
4458
  type: "error"
4463
4459
  }
package/package.json CHANGED
@@ -216,5 +216,5 @@
216
216
  "prepublishOnly": ". \"$HOME/.nvm/nvm.sh\" && nvm use && tsup && node --test"
217
217
  },
218
218
  "types": "dist/index.d.ts",
219
- "version": "0.0.145"
219
+ "version": "0.0.147"
220
220
  }