@aglyn/plugins-marketplace 1.2.0 → 1.4.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.
Files changed (76) hide show
  1. package/README.md +1 -1
  2. package/package.json +14 -14
  3. package/src/lib/components/listing-content.component.js +11 -3
  4. package/src/lib/components/listing-content.component.js.map +1 -1
  5. package/src/lib/components/marketplace-pay-panel.component.d.ts +67 -0
  6. package/src/lib/components/marketplace-pay-panel.component.js +228 -0
  7. package/src/lib/components/marketplace-pay-panel.component.js.map +1 -0
  8. package/src/lib/components/publish-artifact-dialog.component.d.ts +1 -1
  9. package/src/lib/components/publish-artifact-dialog.component.js +144 -20
  10. package/src/lib/components/publish-artifact-dialog.component.js.map +1 -1
  11. package/src/lib/components/publish-starter-fields.component.d.ts +35 -0
  12. package/src/lib/components/publish-starter-fields.component.js +176 -0
  13. package/src/lib/components/publish-starter-fields.component.js.map +1 -0
  14. package/src/lib/components/starter-picker-shelf.component.d.ts +2 -2
  15. package/src/lib/components/starter-picker-shelf.component.js +28 -6
  16. package/src/lib/components/starter-picker-shelf.component.js.map +1 -1
  17. package/src/lib/hooks/use-marketplace-actions.d.ts +9 -3
  18. package/src/lib/hooks/use-marketplace-actions.js +47 -89
  19. package/src/lib/hooks/use-marketplace-actions.js.map +1 -1
  20. package/src/lib/hooks/use-marketplace-pay.d.ts +70 -0
  21. package/src/lib/hooks/use-marketplace-pay.js +359 -0
  22. package/src/lib/hooks/use-marketplace-pay.js.map +1 -0
  23. package/src/lib/hooks/use-starter-publish-facts.d.ts +25 -0
  24. package/src/lib/hooks/use-starter-publish-facts.js +116 -0
  25. package/src/lib/hooks/use-starter-publish-facts.js.map +1 -0
  26. package/src/lib/hooks/use-starter-purchase.d.ts +17 -22
  27. package/src/lib/hooks/use-starter-purchase.js +26 -73
  28. package/src/lib/hooks/use-starter-purchase.js.map +1 -1
  29. package/src/lib/model/marketplace-invoice.d.ts +52 -0
  30. package/src/lib/model/marketplace-invoice.js +75 -0
  31. package/src/lib/model/marketplace-invoice.js.map +1 -0
  32. package/src/lib/model/marketplace-pay.d.ts +42 -0
  33. package/src/lib/model/marketplace-pay.js +33 -0
  34. package/src/lib/model/marketplace-pay.js.map +1 -0
  35. package/src/lib/model/platform-seller.d.ts +37 -0
  36. package/src/lib/model/platform-seller.js +36 -0
  37. package/src/lib/model/platform-seller.js.map +1 -0
  38. package/src/lib/model/publisher-agreement.d.ts +15 -3
  39. package/src/lib/model/publisher-agreement.js +23 -3
  40. package/src/lib/model/publisher-agreement.js.map +1 -1
  41. package/src/lib/model/starter-publish.d.ts +159 -0
  42. package/src/lib/model/starter-publish.js +189 -0
  43. package/src/lib/model/starter-publish.js.map +1 -0
  44. package/src/lib/model/starter-query.d.ts +0 -8
  45. package/src/lib/model/starter-query.js +0 -10
  46. package/src/lib/model/starter-query.js.map +1 -1
  47. package/src/lib/server/billing-webhook.d.ts +6 -0
  48. package/src/lib/server/billing-webhook.js +269 -211
  49. package/src/lib/server/billing-webhook.js.map +1 -1
  50. package/src/lib/server/checkout.d.ts +2 -48
  51. package/src/lib/server/checkout.js +21 -241
  52. package/src/lib/server/checkout.js.map +1 -1
  53. package/src/lib/server/pay.d.ts +18 -0
  54. package/src/lib/server/pay.js +540 -0
  55. package/src/lib/server/pay.js.map +1 -0
  56. package/src/lib/server/platform-org.d.ts +23 -0
  57. package/src/lib/server/platform-org.js +27 -0
  58. package/src/lib/server/platform-org.js.map +1 -0
  59. package/src/lib/server/publish-preconditions.js +4 -1
  60. package/src/lib/server/publish-preconditions.js.map +1 -1
  61. package/src/lib/server/publish-starter.js +5 -2
  62. package/src/lib/server/publish-starter.js.map +1 -1
  63. package/src/lib/server/publisher-profile.d.ts +5 -0
  64. package/src/lib/server/publisher-profile.js +20 -1
  65. package/src/lib/server/publisher-profile.js.map +1 -1
  66. package/src/lib/server/publisher-standing.d.ts +26 -0
  67. package/src/lib/server/publisher-standing.js +66 -0
  68. package/src/lib/server/publisher-standing.js.map +1 -0
  69. package/src/lib/server/sale.d.ts +119 -0
  70. package/src/lib/server/sale.js +304 -0
  71. package/src/lib/server/sale.js.map +1 -0
  72. package/src/lib/server/starter-publish-facts.d.ts +36 -0
  73. package/src/lib/server/starter-publish-facts.js +135 -0
  74. package/src/lib/server/starter-publish-facts.js.map +1 -0
  75. package/src/lib/server.js +8 -0
  76. package/src/lib/server.js.map +1 -1
package/README.md CHANGED
@@ -33,7 +33,7 @@ It also registers a `rating` custom field type (`registerCustomFieldType`) with
33
33
  - Install: `marketplace/install`, `install-plugin`, `install-layout`, `install-template`, `install-theme`, `install-dataset-schema`, `install-email-starter`, `install-email-template`, and `update-artifact` for reconciling an installed copy with a newer published version.
34
34
  - Publish: `marketplace/publish`, `publish-plugin`, `publish-layout`, `publish-template`, `publish-theme`, `publish-dataset-schema`, `publish-email-starter`, `publish-email-template`, `publisher-profile`, `verification-request`.
35
35
  - Listings: `marketplace/listing-versions`, `preview-image`, `reviews`, `report`.
36
- - Paid listings: `marketplace/checkout` and `marketplace/connect`, plus a handler on the platform billing webhook (`registerBillingWebhookHandler`).
36
+ - Paid listings: `marketplace/pay` (in the console, on the workspace's card on file), `marketplace/checkout` (the hosted page, kept for what still links to it), `marketplace/connect` and `marketplace/publisher-standing`, plus a handler on the platform billing webhook (`registerBillingWebhookHandler`).
37
37
 
38
38
  The server entry also registers the server side of the `rating` field type, so its validators run on write paths where no client loaded the plugin.
39
39
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/plugins-marketplace",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,19 +25,19 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.2.0",
29
- "@aglyn/aglyn-markdown-editor": "1.2.0",
30
- "@aglyn/shared-data-enums": "1.2.0",
31
- "@aglyn/shared-data-mdi": "1.2.0",
32
- "@aglyn/shared-ui-jsx": "1.2.0",
33
- "@aglyn/shared-ui-next": "1.2.0",
34
- "@aglyn/shared-ui-snackstack": "1.2.0",
35
- "@aglyn/shared-util-email": "1.2.0",
36
- "@aglyn/shared-util-http": "1.2.0",
37
- "@aglyn/shared-util-timestamp": "1.2.0",
38
- "@aglyn/tenant-data-admin": "1.2.0",
39
- "@aglyn/tenant-feature-instance": "1.2.0",
40
- "@aglyn/tenant-runtime": "1.2.0",
28
+ "@aglyn/aglyn": "1.4.0",
29
+ "@aglyn/aglyn-markdown-editor": "1.4.0",
30
+ "@aglyn/shared-data-enums": "1.4.0",
31
+ "@aglyn/shared-data-mdi": "1.4.0",
32
+ "@aglyn/shared-ui-jsx": "1.4.0",
33
+ "@aglyn/shared-ui-next": "1.4.0",
34
+ "@aglyn/shared-ui-snackstack": "1.4.0",
35
+ "@aglyn/shared-util-email": "1.4.0",
36
+ "@aglyn/shared-util-http": "1.4.0",
37
+ "@aglyn/shared-util-timestamp": "1.4.0",
38
+ "@aglyn/tenant-data-admin": "1.4.0",
39
+ "@aglyn/tenant-feature-instance": "1.4.0",
40
+ "@aglyn/tenant-runtime": "1.4.0",
41
41
  "@swc/helpers": "0.5.23"
42
42
  },
43
43
  "peerDependencies": {
@@ -39,6 +39,7 @@ import ListingReviews from "./listing-reviews.component.js";
39
39
  import ReportTarget from "./report-target.component.js";
40
40
  import PluginSiteSet from "./plugin-site-set.component.js";
41
41
  import { MenuItem, TextField } from "@mui/material";
42
+ import { SITE_STARTER_ARTIFACT_TYPE } from "@aglyn/aglyn/app-utils/site-starter";
42
43
  import { useMarketplaceActions } from "../hooks/use-marketplace-actions.js";
43
44
  import { useArtifactUpdate } from "../hooks/use-artifact-update.js";
44
45
  import ArtifactUpdateDialog from "./artifact-update-dialog.component.js";
@@ -392,7 +393,9 @@ export function ListingReadme({ readme }) {
392
393
  // than let the server infer it from whichever site the surface happens to
393
394
  // be acting through.
394
395
  const orgId = useHostOrgId(hostId);
395
- const { install, installPlan, buy, uninstall } = useMarketplaceActions(hostId, orgId);
396
+ const { install, installPlan, buy, uninstall, payPanel, buying } = useMarketplaceActions(hostId, orgId, orgSlug ? buildRoute(Route.MANAGE_BILLING, {
397
+ orgSlug
398
+ }) : null);
396
399
  /** The uninstall awaiting its impact check and confirmation (AGL-1027). */ const [pendingUninstall, setPendingUninstall] = useState(null);
397
400
  const [installScope, setInstallScope] = useState('org');
398
401
  // Confirm before writing install pins (AGL-867): the install is deliberate
@@ -1489,9 +1492,13 @@ export function ListingReadme({ readme }) {
1489
1492
  fullWidth: true,
1490
1493
  variant: upToDate ? 'outlined' : 'contained',
1491
1494
  color: "primary",
1492
- disabled: Boolean(upToDate) || !(listing == null ? void 0 : listing.profileId) || // Nothing selected to install to (AGL-773).
1495
+ disabled: Boolean(upToDate) || !(listing == null ? void 0 : listing.profileId) || // Paying is under way in the panel below.
1496
+ buying || Boolean(payPanel) || // Nothing selected to install to (AGL-773).
1493
1497
  orgTargeting && !installed && !mustBuy && installPlanSteps.length === 0,
1494
- onClick: permissions.installPlugins ? ()=>// Buying goes straight to Stripe checkout,
1498
+ onClick: // A site starter is bought to create a site
1499
+ // with, so that is the permission it asks for,
1500
+ // as the pay door does (AGL-4049).
1501
+ (artifactType === SITE_STARTER_ARTIFACT_TYPE ? permissions.createHosts : permissions.installPlugins) ? ()=>// Buying opens the payment panel below,
1495
1502
  // which is its own confirmation; a free or
1496
1503
  // entitled install confirms its targets
1497
1504
  // first (AGL-867). Updating a copied
@@ -1511,6 +1518,7 @@ export function ListingReadme({ readme }) {
1511
1518
  artifactType === 'theme' ? `Applied (v${installedVersion}) · re-apply` : `${artifactType === 'emailTemplate' ? 'Draft added' : 'Added'} (v${installedVersion}) · add again` : installed ? `Update to v${offeredVersion}` : mustBuy ? licensedElsewhere ? `Buy for this workspace — $${priceUsd}` : `Buy for $${priceUsd}` : unreviewedInstall ? `Install unreviewed v${listing == null ? void 0 : listing.latestVersion} for testing` : orgTargeting || installTargets.length > 1 ? 'Install' : 'Add to this site'
1512
1519
  })
1513
1520
  }),
1521
+ payPanel,
1514
1522
  !orgPluginScope && isPlugin && installed ? /*#__PURE__*/ _jsx(Button, {
1515
1523
  fullWidth: true,
1516
1524
  size: "small",