@aglyn/plugins-marketplace 1.0.0-beta.149 → 1.0.0-beta.151

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 (92) hide show
  1. package/package.json +15 -11
  2. package/src/lib/components/edit-listing-dialog.component.d.ts +20 -0
  3. package/src/lib/components/edit-listing-dialog.component.js +51 -0
  4. package/src/lib/components/edit-listing-dialog.component.js.map +1 -0
  5. package/src/lib/components/listing-detail-editor.component.d.ts +24 -0
  6. package/src/lib/components/listing-detail-editor.component.js +457 -0
  7. package/src/lib/components/listing-detail-editor.component.js.map +1 -0
  8. package/src/lib/components/listing-detail-page.component.d.ts +28 -0
  9. package/src/lib/components/listing-detail-page.component.js +151 -0
  10. package/src/lib/components/listing-detail-page.component.js.map +1 -0
  11. package/src/lib/components/listing-review-status.component.d.ts +67 -0
  12. package/src/lib/components/listing-review-status.component.js +301 -0
  13. package/src/lib/components/listing-review-status.component.js.map +1 -0
  14. package/src/lib/components/listing-verification-request.component.d.ts +40 -0
  15. package/src/lib/components/listing-verification-request.component.js +170 -0
  16. package/src/lib/components/listing-verification-request.component.js.map +1 -0
  17. package/src/lib/components/marketplace-hub.component.d.ts +43 -0
  18. package/src/lib/components/marketplace-hub.component.js +244 -0
  19. package/src/lib/components/marketplace-hub.component.js.map +1 -0
  20. package/src/lib/components/marketplace-reports-page.component.d.ts +23 -0
  21. package/src/lib/components/marketplace-reports-page.component.js +324 -0
  22. package/src/lib/components/marketplace-reports-page.component.js.map +1 -0
  23. package/src/lib/components/org-licences-panel.component.d.ts +73 -0
  24. package/src/lib/components/org-licences-panel.component.js +318 -0
  25. package/src/lib/components/org-licences-panel.component.js.map +1 -0
  26. package/src/lib/components/org-publish-panel.component.d.ts +45 -0
  27. package/src/lib/components/org-publish-panel.component.js +402 -0
  28. package/src/lib/components/org-publish-panel.component.js.map +1 -0
  29. package/src/lib/components/org-seller-panel.component.d.ts +28 -0
  30. package/src/lib/components/org-seller-panel.component.js +956 -0
  31. package/src/lib/components/org-seller-panel.component.js.map +1 -0
  32. package/src/lib/components/plugin-review-detail.component.d.ts +16 -0
  33. package/src/lib/components/plugin-review-detail.component.js +1438 -0
  34. package/src/lib/components/plugin-review-detail.component.js.map +1 -0
  35. package/src/lib/components/plugin-reviews-queue.component.d.ts +13 -0
  36. package/src/lib/components/plugin-reviews-queue.component.js +385 -0
  37. package/src/lib/components/plugin-reviews-queue.component.js.map +1 -0
  38. package/src/lib/components/plugin-reviews-surface.component.d.ts +19 -0
  39. package/src/lib/components/plugin-reviews-surface.component.js +46 -0
  40. package/src/lib/components/plugin-reviews-surface.component.js.map +1 -0
  41. package/src/lib/components/publish-plugin-form.component.d.ts +61 -0
  42. package/src/lib/components/publish-plugin-form.component.js +857 -0
  43. package/src/lib/components/publish-plugin-form.component.js.map +1 -0
  44. package/src/lib/components/publish-plugin-page.component.d.ts +29 -0
  45. package/src/lib/components/publish-plugin-page.component.js +92 -0
  46. package/src/lib/components/publish-plugin-page.component.js.map +1 -0
  47. package/src/lib/components/publisher-profile-page.component.d.ts +13 -0
  48. package/src/lib/components/publisher-profile-page.component.js +261 -0
  49. package/src/lib/components/publisher-profile-page.component.js.map +1 -0
  50. package/src/lib/constants/listing-media.d.ts +28 -0
  51. package/src/lib/constants/listing-media.js +28 -0
  52. package/src/lib/constants/listing-media.js.map +1 -0
  53. package/src/lib/model/listing-social-card.d.ts +94 -0
  54. package/src/lib/model/listing-social-card.js +177 -0
  55. package/src/lib/model/listing-social-card.js.map +1 -0
  56. package/src/lib/model/marketplace-paths.d.ts +54 -0
  57. package/src/lib/model/marketplace-paths.js +59 -0
  58. package/src/lib/model/marketplace-paths.js.map +1 -0
  59. package/src/lib/model/payout-readiness.d.ts +81 -0
  60. package/src/lib/model/payout-readiness.js +52 -0
  61. package/src/lib/model/payout-readiness.js.map +1 -0
  62. package/src/lib/model/plugin-rejection-categories.d.ts +66 -0
  63. package/src/lib/model/plugin-rejection-categories.js +124 -0
  64. package/src/lib/model/plugin-rejection-categories.js.map +1 -0
  65. package/src/lib/model/plugin-review-checklist.d.ts +62 -0
  66. package/src/lib/model/plugin-review-checklist.js +131 -0
  67. package/src/lib/model/plugin-review-checklist.js.map +1 -0
  68. package/src/lib/model/plugin-review-status.d.ts +104 -0
  69. package/src/lib/model/plugin-review-status.js +126 -0
  70. package/src/lib/model/plugin-review-status.js.map +1 -0
  71. package/src/lib/model/seller-ledger-totals.d.ts +100 -0
  72. package/src/lib/model/seller-ledger-totals.js +96 -0
  73. package/src/lib/model/seller-ledger-totals.js.map +1 -0
  74. package/src/lib/plugin.js +170 -40
  75. package/src/lib/plugin.js.map +1 -1
  76. package/src/lib/server/admin-reports.d.ts +18 -0
  77. package/src/lib/server/admin-reports.js +280 -0
  78. package/src/lib/server/admin-reports.js.map +1 -0
  79. package/src/lib/server/admin-reviews.d.ts +18 -0
  80. package/src/lib/server/admin-reviews.js +1341 -0
  81. package/src/lib/server/admin-reviews.js.map +1 -0
  82. package/src/lib/server/listing-social-card.server.d.ts +24 -0
  83. package/src/lib/server/listing-social-card.server.js +65 -0
  84. package/src/lib/server/listing-social-card.server.js.map +1 -0
  85. package/src/lib/server/publisher-review-email.d.ts +54 -0
  86. package/src/lib/server/publisher-review-email.js +85 -0
  87. package/src/lib/server/publisher-review-email.js.map +1 -0
  88. package/src/lib/server/revoke-cache-drop.d.ts +59 -0
  89. package/src/lib/server/revoke-cache-drop.js +74 -0
  90. package/src/lib/server/revoke-cache-drop.js.map +1 -0
  91. package/src/lib/server.js +47 -0
  92. package/src/lib/server.js.map +1 -1
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * A marketplace listing's mark, rendered in a grid of square tiles beside
19
+ * other publishers' — so square is not a preference here, it is the shape of
20
+ * the slot.
21
+ *
22
+ * Lived in the console's `constants/media-size-hints` until AGL-3080 moved
23
+ * the marketplace's console surfaces into this plugin. It sat there beside a
24
+ * site's favicon and a person's avatar, which are the console's own; what a
25
+ * LISTING's tile has to look like is the marketplace's, and it is the only
26
+ * hint in that file no console surface reads.
27
+ */
28
+ export declare const LISTING_LOGO_HINT: string;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * A marketplace listing's mark, rendered in a grid of square tiles beside
18
+ * other publishers' — so square is not a preference here, it is the shape of
19
+ * the slot.
20
+ *
21
+ * Lived in the console's `constants/media-size-hints` until AGL-3080 moved
22
+ * the marketplace's console surfaces into this plugin. It sat there beside a
23
+ * site's favicon and a person's avatar, which are the console's own; what a
24
+ * LISTING's tile has to look like is the marketplace's, and it is the only
25
+ * hint in that file no console surface reads.
26
+ */ export const LISTING_LOGO_HINT = 'Recommended: a square PNG or SVG, at least 256×256 — listings are shown ' + 'as square tiles.';
27
+
28
+ //# sourceMappingURL=listing-media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/marketplace/src/lib/constants/listing-media.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A marketplace listing's mark, rendered in a grid of square tiles beside\n * other publishers' — so square is not a preference here, it is the shape of\n * the slot.\n *\n * Lived in the console's `constants/media-size-hints` until AGL-3080 moved\n * the marketplace's console surfaces into this plugin. It sat there beside a\n * site's favicon and a person's avatar, which are the console's own; what a\n * LISTING's tile has to look like is the marketplace's, and it is the only\n * hint in that file no console surface reads.\n */\nexport const LISTING_LOGO_HINT =\n 'Recommended: a square PNG or SVG, at least 256×256 — listings are shown ' +\n 'as square tiles.'\n"],"names":["LISTING_LOGO_HINT"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;CAUC,GACD,OAAO,MAAMA,oBACX,6EACA,mBAAkB"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { PluginRouteHead } from '@aglyn/aglyn/plugin-manager/plugin-route-metadata';
18
+ /**
19
+ * The title the route has always shipped, and still ships for a listing that
20
+ * does not exist or must not be described. The root layout's `%s · Aglyn`
21
+ * template affixes the brand.
22
+ */
23
+ export declare const LISTING_TITLE_FALLBACK = "Marketplace listing";
24
+ /**
25
+ * `og:description` budget. The listing description is a free-form textarea
26
+ * with no length cap in the editor, and consumers truncate somewhere between
27
+ * 150 and 300 characters anyway — so cut it here, where an ellipsis can be
28
+ * placed deliberately, rather than shipping a multi-kilobyte meta tag and
29
+ * letting each crawler pick its own cut.
30
+ */
31
+ export declare const LISTING_DESCRIPTION_MAX = 200;
32
+ /**
33
+ * The console's own origin — a listing image is not served by a tenant site,
34
+ * so there is no host record to derive one from.
35
+ *
36
+ * Read at call time, not module load, so a self-hosted install's
37
+ * `NEXT_PUBLIC_CONSOLE_URL` is honoured — the same variable the auth action
38
+ * links already track. Trailing slashes are trimmed: one typed into that
39
+ * variable would otherwise reach `og:image` as `https://host//api/…`.
40
+ */
41
+ export declare function consoleOrigin(): string;
42
+ /**
43
+ * The listing fields the card reads. Deliberately structural rather than the
44
+ * plugin's `MarketplaceListing`: that type lives in an `aglyn:addons` lib the
45
+ * console may not import, and the doc arrives from the Admin SDK as untyped
46
+ * data regardless.
47
+ */
48
+ export interface ListingSocialCardSource {
49
+ displayName?: string;
50
+ description?: string;
51
+ /** Publisher-uploaded or DAM-picked card art; validated https at write. */
52
+ previewImageUrl?: string;
53
+ /** The publisher's own logo — the fallback when there is no preview. */
54
+ logoUrl?: string;
55
+ artifactType?: string;
56
+ type?: string;
57
+ kind?: string;
58
+ reviewStatus?: string;
59
+ hiddenAt?: unknown;
60
+ visibility?: string;
61
+ deletedAt?: unknown;
62
+ }
63
+ /**
64
+ * The description, trimmed and cut to {@link LISTING_DESCRIPTION_MAX}.
65
+ *
66
+ * Cuts at the last word boundary inside the budget when there is one, so the
67
+ * card does not end mid-word; the ellipsis is only added when something was
68
+ * actually removed. Returns `''` for an absent or whitespace-only field —
69
+ * never `undefined` or `''` reaching a meta tag, since `strictNullChecks` is
70
+ * off repo-wide and an emitted `og:description` of "undefined" is worse than
71
+ * an absent one.
72
+ */
73
+ export declare function listingCardDescription(value: unknown): string;
74
+ /**
75
+ * What this listing says about itself, or `null` for one nothing may say
76
+ * anything about.
77
+ *
78
+ * ⚠️ `null` IS THE WHOLE FALLBACK (AGL-3080). It used to answer the route's
79
+ * own generic title, which only worked while a hand-written console route
80
+ * was the only caller. The shell keeps whatever title it built when a
81
+ * declaration answers nothing, so saying nothing is how this refuses — and
82
+ * it is also the answer for a listing that does not exist, a read that
83
+ * failed, and one that must not be described, none of which the caller
84
+ * distinguishes.
85
+ *
86
+ * Pure, and separated from the read so the policy above is testable without
87
+ * firebase-admin. The tags themselves are the console shell's
88
+ * (`pluginRouteMetadataOver`): how a title, a description and an image
89
+ * become `openGraph` and `twitter` is the same for every plugin's route and
90
+ * is not this plugin's to decide.
91
+ */
92
+ export declare function listingSocialCard(listing: ListingSocialCardSource | null | undefined, options?: {
93
+ origin?: string;
94
+ }): PluginRouteHead | null;
@@ -0,0 +1,177 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ /**
18
+ * The social card for a marketplace listing (AGL-876).
19
+ *
20
+ * ## Why a gated page gets a card at all
21
+ *
22
+ * The issue was filed as "needs a public marketplace surface", on the premise
23
+ * that a crawler cannot fetch a page behind console auth. It can: the auth
24
+ * gate is `AuthenticatedLayout` in `(app)/layout.tsx`, which is `'use client'`
25
+ * — an anonymous GET returns 200 with the server-rendered `<head>`, and the
26
+ * two nested title shells prove it (`/{org}/marketplace` answers "Marketplace"
27
+ * and `/{org}/marketplace/{id}` answers "Marketplace listing", so each route's
28
+ * own metadata export runs for an unauthenticated client).
29
+ *
30
+ * So the choice was never "card or no card". Every listing link ALREADY
31
+ * unfurls — as the generic console card from the root layout, identical for
32
+ * every listing in the marketplace. The recipient still lands on a sign-in
33
+ * wall either way, and `continueParam` returns them to this listing once they
34
+ * are through it, which is the org-internal Slack/Teams share this is for.
35
+ * A correct name, description and image is strictly better than one wrong
36
+ * card repeated; it is not a substitute for a public listing page.
37
+ *
38
+ * ## Why the visibility gate is the interesting half
39
+ *
40
+ * The read runs through the Admin SDK, which bypasses Firestore rules
41
+ * entirely — so `allow read: if true` on `marketplaceListings/{listingId}` is
42
+ * not the control here, this module is. And the audience is unauthenticated
43
+ * by construction: there is no viewer to exempt, so the owner exemption that
44
+ * `marketplace-browse` applies (a publisher may watch their own submission
45
+ * move through review) has no analogue and must NOT be reproduced.
46
+ *
47
+ * A listing that is soft-deleted, private, staff-hidden, or a plugin still
48
+ * awaiting review — or rejected — therefore falls back to the generic shell:
49
+ * same `<title>` it has today, and the root layout's `openGraph` inherited
50
+ * untouched, because a metadata export that omits a field inherits the
51
+ * parent's. Nothing about it is disclosed that was not already public.
52
+ *
53
+ * The rule itself is `isListingBrowsable`/`isListingDeleted`, imported from
54
+ * core rather than restated — they are the same predicates browse and install
55
+ * apply, and a third reading that drifted from them would be a disclosure
56
+ * bug. They were moved into core for this (`scope:app` may not depend on
57
+ * `aglyn:addons`); the marketplace plugin re-exports them unchanged.
58
+ */ import { resolveSeoTitle } from "@aglyn/aglyn/app-utils/seo-title";
59
+ import { resolveSocialImage } from "@aglyn/aglyn/app-utils/social-image";
60
+ import { isListingBrowsable, isListingDeleted } from "@aglyn/aglyn/app-utils/marketplace-listing-visibility";
61
+ /**
62
+ * The title the route has always shipped, and still ships for a listing that
63
+ * does not exist or must not be described. The root layout's `%s · Aglyn`
64
+ * template affixes the brand.
65
+ */ export const LISTING_TITLE_FALLBACK = 'Marketplace listing';
66
+ /**
67
+ * `og:description` budget. The listing description is a free-form textarea
68
+ * with no length cap in the editor, and consumers truncate somewhere between
69
+ * 150 and 300 characters anyway — so cut it here, where an ellipsis can be
70
+ * placed deliberately, rather than shipping a multi-kilobyte meta tag and
71
+ * letting each crawler pick its own cut.
72
+ */ export const LISTING_DESCRIPTION_MAX = 200;
73
+ /**
74
+ * The console's own origin — a listing image is not served by a tenant site,
75
+ * so there is no host record to derive one from.
76
+ *
77
+ * Read at call time, not module load, so a self-hosted install's
78
+ * `NEXT_PUBLIC_CONSOLE_URL` is honoured — the same variable the auth action
79
+ * links already track. Trailing slashes are trimmed: one typed into that
80
+ * variable would otherwise reach `og:image` as `https://host//api/…`.
81
+ */ export function consoleOrigin() {
82
+ var _process_env_NEXT_PUBLIC_CONSOLE_URL;
83
+ const origin = (_process_env_NEXT_PUBLIC_CONSOLE_URL = process.env.NEXT_PUBLIC_CONSOLE_URL) != null ? _process_env_NEXT_PUBLIC_CONSOLE_URL : 'https://app.aglyn.com';
84
+ return origin.replace(/\/+$/, '');
85
+ }
86
+ /** Trimmed, or `''` for anything that is not a live string. */ function clean(value) {
87
+ return typeof value === 'string' ? value.trim() : '';
88
+ }
89
+ /**
90
+ * The description, trimmed and cut to {@link LISTING_DESCRIPTION_MAX}.
91
+ *
92
+ * Cuts at the last word boundary inside the budget when there is one, so the
93
+ * card does not end mid-word; the ellipsis is only added when something was
94
+ * actually removed. Returns `''` for an absent or whitespace-only field —
95
+ * never `undefined` or `''` reaching a meta tag, since `strictNullChecks` is
96
+ * off repo-wide and an emitted `og:description` of "undefined" is worse than
97
+ * an absent one.
98
+ */ export function listingCardDescription(value) {
99
+ const text = clean(value).replace(/\s+/g, ' ');
100
+ if (text.length <= LISTING_DESCRIPTION_MAX) return text;
101
+ const cut = text.slice(0, LISTING_DESCRIPTION_MAX);
102
+ const lastSpace = cut.lastIndexOf(' ');
103
+ return `${(lastSpace > LISTING_DESCRIPTION_MAX / 2 ? cut.slice(0, lastSpace) : cut).trimEnd()}…`;
104
+ }
105
+ /**
106
+ * What this listing says about itself, or `null` for one nothing may say
107
+ * anything about.
108
+ *
109
+ * ⚠️ `null` IS THE WHOLE FALLBACK (AGL-3080). It used to answer the route's
110
+ * own generic title, which only worked while a hand-written console route
111
+ * was the only caller. The shell keeps whatever title it built when a
112
+ * declaration answers nothing, so saying nothing is how this refuses — and
113
+ * it is also the answer for a listing that does not exist, a read that
114
+ * failed, and one that must not be described, none of which the caller
115
+ * distinguishes.
116
+ *
117
+ * Pure, and separated from the read so the policy above is testable without
118
+ * firebase-admin. The tags themselves are the console shell's
119
+ * (`pluginRouteMetadataOver`): how a title, a description and an image
120
+ * become `openGraph` and `twitter` is the same for every plugin's route and
121
+ * is not this plugin's to decide.
122
+ */ export function listingSocialCard(listing, options) {
123
+ var _ref;
124
+ if (!listing) return null;
125
+ // The one gate. Deleted has no owner exemption anywhere; browsable has one
126
+ // in the UI, and deliberately none here — see the module docblock.
127
+ if (isListingDeleted(listing) || !isListingBrowsable(listing)) return null;
128
+ const name = clean(listing.displayName);
129
+ if (!name) return null;
130
+ const description = listingCardDescription(listing.description);
131
+ // Precedence, not `??`: `previewImageUrl` is the card art a publisher chose
132
+ // for exactly this purpose, and `logoUrl` is the mark that identifies them.
133
+ // An empty string is a cleared field, which is why this is the resolver's
134
+ // source LIST rather than a coalesce — `''` must fall through to the logo.
135
+ //
136
+ // Neither field carries dimensions (nothing records them at write time), so
137
+ // no `og:image:width/height` is emitted. Stated rather than silent: adding
138
+ // them means capturing the pair when the image is set, not guessing here.
139
+ //
140
+ // `og:image:alt` (AGL-2417) is DERIVED here rather than stored, and that is
141
+ // the exception to AGL-1896's "never fabricate an alt" rule rather than a
142
+ // breach of it. That rule refuses a FILE NAME — "IMG_4021.jpg" read aloud
143
+ // is worse than silence — because a file name says nothing about the
144
+ // picture. This says something true and useful: which listing the image
145
+ // belongs to and which of the two roles it is playing. Neither field has
146
+ // anywhere to store an authored alt (a publisher supplies a URL, not a DAM
147
+ // pick), so the alternative is the undescribed card we had.
148
+ //
149
+ // Per SOURCE, so the description matches whichever image actually won —
150
+ // the same discipline the dimensions follow everywhere else.
151
+ const image = resolveSocialImage({
152
+ sources: [
153
+ {
154
+ image: listing.previewImageUrl,
155
+ imageAlt: `Preview image for ${name}`
156
+ },
157
+ {
158
+ image: listing.logoUrl,
159
+ imageAlt: `${name} logo`
160
+ }
161
+ ],
162
+ origin: (_ref = options == null ? void 0 : options.origin) != null ? _ref : consoleOrigin()
163
+ });
164
+ const title = resolveSeoTitle({
165
+ name,
166
+ fallback: LISTING_TITLE_FALLBACK
167
+ });
168
+ return _extends({
169
+ title
170
+ }, description ? {
171
+ description
172
+ } : {}, image ? {
173
+ image
174
+ } : {});
175
+ }
176
+
177
+ //# sourceMappingURL=listing-social-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/marketplace/src/lib/model/listing-social-card.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The social card for a marketplace listing (AGL-876).\n *\n * ## Why a gated page gets a card at all\n *\n * The issue was filed as \"needs a public marketplace surface\", on the premise\n * that a crawler cannot fetch a page behind console auth. It can: the auth\n * gate is `AuthenticatedLayout` in `(app)/layout.tsx`, which is `'use client'`\n * — an anonymous GET returns 200 with the server-rendered `<head>`, and the\n * two nested title shells prove it (`/{org}/marketplace` answers \"Marketplace\"\n * and `/{org}/marketplace/{id}` answers \"Marketplace listing\", so each route's\n * own metadata export runs for an unauthenticated client).\n *\n * So the choice was never \"card or no card\". Every listing link ALREADY\n * unfurls — as the generic console card from the root layout, identical for\n * every listing in the marketplace. The recipient still lands on a sign-in\n * wall either way, and `continueParam` returns them to this listing once they\n * are through it, which is the org-internal Slack/Teams share this is for.\n * A correct name, description and image is strictly better than one wrong\n * card repeated; it is not a substitute for a public listing page.\n *\n * ## Why the visibility gate is the interesting half\n *\n * The read runs through the Admin SDK, which bypasses Firestore rules\n * entirely — so `allow read: if true` on `marketplaceListings/{listingId}` is\n * not the control here, this module is. And the audience is unauthenticated\n * by construction: there is no viewer to exempt, so the owner exemption that\n * `marketplace-browse` applies (a publisher may watch their own submission\n * move through review) has no analogue and must NOT be reproduced.\n *\n * A listing that is soft-deleted, private, staff-hidden, or a plugin still\n * awaiting review — or rejected — therefore falls back to the generic shell:\n * same `<title>` it has today, and the root layout's `openGraph` inherited\n * untouched, because a metadata export that omits a field inherits the\n * parent's. Nothing about it is disclosed that was not already public.\n *\n * The rule itself is `isListingBrowsable`/`isListingDeleted`, imported from\n * core rather than restated — they are the same predicates browse and install\n * apply, and a third reading that drifted from them would be a disclosure\n * bug. They were moved into core for this (`scope:app` may not depend on\n * `aglyn:addons`); the marketplace plugin re-exports them unchanged.\n */\n\nimport { resolveSeoTitle } from '@aglyn/aglyn/app-utils/seo-title'\nimport { resolveSocialImage } from '@aglyn/aglyn/app-utils/social-image'\nimport {\n isListingBrowsable,\n isListingDeleted,\n} from '@aglyn/aglyn/app-utils/marketplace-listing-visibility'\nimport type { PluginRouteHead } from '@aglyn/aglyn/plugin-manager/plugin-route-metadata'\n\n/**\n * The title the route has always shipped, and still ships for a listing that\n * does not exist or must not be described. The root layout's `%s · Aglyn`\n * template affixes the brand.\n */\nexport const LISTING_TITLE_FALLBACK = 'Marketplace listing'\n\n/**\n * `og:description` budget. The listing description is a free-form textarea\n * with no length cap in the editor, and consumers truncate somewhere between\n * 150 and 300 characters anyway — so cut it here, where an ellipsis can be\n * placed deliberately, rather than shipping a multi-kilobyte meta tag and\n * letting each crawler pick its own cut.\n */\nexport const LISTING_DESCRIPTION_MAX = 200\n\n/**\n * The console's own origin — a listing image is not served by a tenant site,\n * so there is no host record to derive one from.\n *\n * Read at call time, not module load, so a self-hosted install's\n * `NEXT_PUBLIC_CONSOLE_URL` is honoured — the same variable the auth action\n * links already track. Trailing slashes are trimmed: one typed into that\n * variable would otherwise reach `og:image` as `https://host//api/…`.\n */\nexport function consoleOrigin(): string {\n const origin = process.env.NEXT_PUBLIC_CONSOLE_URL ?? 'https://app.aglyn.com'\n return origin.replace(/\\/+$/, '')\n}\n\n/**\n * The listing fields the card reads. Deliberately structural rather than the\n * plugin's `MarketplaceListing`: that type lives in an `aglyn:addons` lib the\n * console may not import, and the doc arrives from the Admin SDK as untyped\n * data regardless.\n */\nexport interface ListingSocialCardSource {\n displayName?: string\n description?: string\n /** Publisher-uploaded or DAM-picked card art; validated https at write. */\n previewImageUrl?: string\n /** The publisher's own logo — the fallback when there is no preview. */\n logoUrl?: string\n artifactType?: string\n type?: string\n kind?: string\n reviewStatus?: string\n hiddenAt?: unknown\n visibility?: string\n deletedAt?: unknown\n}\n\n/** Trimmed, or `''` for anything that is not a live string. */\nfunction clean(value: unknown): string {\n return typeof value === 'string' ? value.trim() : ''\n}\n\n/**\n * The description, trimmed and cut to {@link LISTING_DESCRIPTION_MAX}.\n *\n * Cuts at the last word boundary inside the budget when there is one, so the\n * card does not end mid-word; the ellipsis is only added when something was\n * actually removed. Returns `''` for an absent or whitespace-only field —\n * never `undefined` or `''` reaching a meta tag, since `strictNullChecks` is\n * off repo-wide and an emitted `og:description` of \"undefined\" is worse than\n * an absent one.\n */\nexport function listingCardDescription(value: unknown): string {\n const text = clean(value).replace(/\\s+/g, ' ')\n if (text.length <= LISTING_DESCRIPTION_MAX) return text\n const cut = text.slice(0, LISTING_DESCRIPTION_MAX)\n const lastSpace = cut.lastIndexOf(' ')\n return `${(lastSpace > LISTING_DESCRIPTION_MAX / 2 ? cut.slice(0, lastSpace) : cut).trimEnd()}…`\n}\n\n/**\n * What this listing says about itself, or `null` for one nothing may say\n * anything about.\n *\n * ⚠️ `null` IS THE WHOLE FALLBACK (AGL-3080). It used to answer the route's\n * own generic title, which only worked while a hand-written console route\n * was the only caller. The shell keeps whatever title it built when a\n * declaration answers nothing, so saying nothing is how this refuses — and\n * it is also the answer for a listing that does not exist, a read that\n * failed, and one that must not be described, none of which the caller\n * distinguishes.\n *\n * Pure, and separated from the read so the policy above is testable without\n * firebase-admin. The tags themselves are the console shell's\n * (`pluginRouteMetadataOver`): how a title, a description and an image\n * become `openGraph` and `twitter` is the same for every plugin's route and\n * is not this plugin's to decide.\n */\nexport function listingSocialCard(\n listing: ListingSocialCardSource | null | undefined,\n options?: { origin?: string },\n): PluginRouteHead | null {\n if (!listing) return null\n // The one gate. Deleted has no owner exemption anywhere; browsable has one\n // in the UI, and deliberately none here — see the module docblock.\n if (isListingDeleted(listing) || !isListingBrowsable(listing)) return null\n\n const name = clean(listing.displayName)\n if (!name) return null\n\n const description = listingCardDescription(listing.description)\n // Precedence, not `??`: `previewImageUrl` is the card art a publisher chose\n // for exactly this purpose, and `logoUrl` is the mark that identifies them.\n // An empty string is a cleared field, which is why this is the resolver's\n // source LIST rather than a coalesce — `''` must fall through to the logo.\n //\n // Neither field carries dimensions (nothing records them at write time), so\n // no `og:image:width/height` is emitted. Stated rather than silent: adding\n // them means capturing the pair when the image is set, not guessing here.\n //\n // `og:image:alt` (AGL-2417) is DERIVED here rather than stored, and that is\n // the exception to AGL-1896's \"never fabricate an alt\" rule rather than a\n // breach of it. That rule refuses a FILE NAME — \"IMG_4021.jpg\" read aloud\n // is worse than silence — because a file name says nothing about the\n // picture. This says something true and useful: which listing the image\n // belongs to and which of the two roles it is playing. Neither field has\n // anywhere to store an authored alt (a publisher supplies a URL, not a DAM\n // pick), so the alternative is the undescribed card we had.\n //\n // Per SOURCE, so the description matches whichever image actually won —\n // the same discipline the dimensions follow everywhere else.\n const image = resolveSocialImage({\n sources: [\n {\n image: listing.previewImageUrl,\n imageAlt: `Preview image for ${name}`,\n },\n { image: listing.logoUrl, imageAlt: `${name} logo` },\n ],\n origin: options?.origin ?? consoleOrigin(),\n })\n const title = resolveSeoTitle({ name, fallback: LISTING_TITLE_FALLBACK })\n\n return {\n title,\n ...(description ? { description } : {}),\n ...(image ? { image } : {}),\n }\n}\n"],"names":["resolveSeoTitle","resolveSocialImage","isListingBrowsable","isListingDeleted","LISTING_TITLE_FALLBACK","LISTING_DESCRIPTION_MAX","consoleOrigin","process","origin","env","NEXT_PUBLIC_CONSOLE_URL","replace","clean","value","trim","listingCardDescription","text","length","cut","slice","lastSpace","lastIndexOf","trimEnd","listingSocialCard","listing","options","name","displayName","description","image","sources","previewImageUrl","imageAlt","logoUrl","title","fallback"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCC,GAED,SAASA,eAAe,QAAQ,mCAAkC;AAClE,SAASC,kBAAkB,QAAQ,sCAAqC;AACxE,SACEC,kBAAkB,EAClBC,gBAAgB,QACX,wDAAuD;AAG9D;;;;CAIC,GACD,OAAO,MAAMC,yBAAyB,sBAAqB;AAE3D;;;;;;CAMC,GACD,OAAO,MAAMC,0BAA0B,IAAG;AAE1C;;;;;;;;CAQC,GACD,OAAO,SAASC;QACCC;IAAf,MAAMC,UAASD,uCAAAA,QAAQE,GAAG,CAACC,uBAAuB,YAAnCH,uCAAuC;IACtD,OAAOC,OAAOG,OAAO,CAAC,QAAQ;AAChC;AAwBA,6DAA6D,GAC7D,SAASC,MAAMC,KAAc;IAC3B,OAAO,OAAOA,UAAU,WAAWA,MAAMC,IAAI,KAAK;AACpD;AAEA;;;;;;;;;CASC,GACD,OAAO,SAASC,uBAAuBF,KAAc;IACnD,MAAMG,OAAOJ,MAAMC,OAAOF,OAAO,CAAC,QAAQ;IAC1C,IAAIK,KAAKC,MAAM,IAAIZ,yBAAyB,OAAOW;IACnD,MAAME,MAAMF,KAAKG,KAAK,CAAC,GAAGd;IAC1B,MAAMe,YAAYF,IAAIG,WAAW,CAAC;IAClC,OAAO,GAAG,AAACD,CAAAA,YAAYf,0BAA0B,IAAIa,IAAIC,KAAK,CAAC,GAAGC,aAAaF,GAAE,EAAGI,OAAO,GAAG,CAAC,CAAC;AAClG;AAEA;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASC,kBACdC,OAAmD,EACnDC,OAA6B;;IAE7B,IAAI,CAACD,SAAS,OAAO;IACrB,2EAA2E;IAC3E,mEAAmE;IACnE,IAAIrB,iBAAiBqB,YAAY,CAACtB,mBAAmBsB,UAAU,OAAO;IAEtE,MAAME,OAAOd,MAAMY,QAAQG,WAAW;IACtC,IAAI,CAACD,MAAM,OAAO;IAElB,MAAME,cAAcb,uBAAuBS,QAAQI,WAAW;IAC9D,4EAA4E;IAC5E,4EAA4E;IAC5E,0EAA0E;IAC1E,2EAA2E;IAC3E,EAAE;IACF,4EAA4E;IAC5E,2EAA2E;IAC3E,0EAA0E;IAC1E,EAAE;IACF,4EAA4E;IAC5E,0EAA0E;IAC1E,0EAA0E;IAC1E,qEAAqE;IACrE,wEAAwE;IACxE,yEAAyE;IACzE,2EAA2E;IAC3E,4DAA4D;IAC5D,EAAE;IACF,wEAAwE;IACxE,6DAA6D;IAC7D,MAAMC,QAAQ5B,mBAAmB;QAC/B6B,SAAS;YACP;gBACED,OAAOL,QAAQO,eAAe;gBAC9BC,UAAU,CAAC,kBAAkB,EAAEN,MAAM;YACvC;YACA;gBAAEG,OAAOL,QAAQS,OAAO;gBAAED,UAAU,GAAGN,KAAK,KAAK,CAAC;YAAC;SACpD;QACDlB,MAAM,UAAEiB,2BAAAA,QAASjB,MAAM,mBAAIF;IAC7B;IACA,MAAM4B,QAAQlC,gBAAgB;QAAE0B;QAAMS,UAAU/B;IAAuB;IAEvE,OAAO;QACL8B;OACIN,cAAc;QAAEA;IAAY,IAAI,CAAC,GACjCC,QAAQ;QAAEA;IAAM,IAAI,CAAC;AAE7B"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * The marketplace hub's own URLs, built from the path the shell mounted it at
19
+ * (AGL-3080).
20
+ *
21
+ * These were `buildRoute(Route.ORG_MARKETPLACE_LISTING, …)` against the
22
+ * console's route table while the hub was a set of hand-written console
23
+ * routes. A plugin cannot import that table, and should not want to: the hub
24
+ * is served by the generic org plugin route, which hands every page its
25
+ * `basePath` — the absolute path this surface is mounted at under the
26
+ * current organization. Everything beneath it is this plugin's to name.
27
+ *
28
+ * That is also what makes the surface MOVABLE. The addresses below are the
29
+ * ones the console has always served, because `basePath` resolves to
30
+ * `/{orgSlug}/marketplace` today; a workspace that mounted the hub somewhere
31
+ * else would get consistent links rather than links into the old place.
32
+ *
33
+ * ⚠️ These segments appear in links people keep — a bookmark, a docs link, an
34
+ * email the console itself sent. Treat them as persisted.
35
+ */
36
+ /**
37
+ * Where this plugin's hub is mounted under one organization, by slug.
38
+ *
39
+ * For a surface that is NOT the hub and has no `basePath` of its own — the
40
+ * staff review queue links a reviewer at the publisher's own listing, in the
41
+ * publisher's workspace, which is somebody else's org entirely. The mount
42
+ * segment is this plugin's `orgNavItems` href, so naming it here is the
43
+ * plugin naming its own surface rather than guessing at the console's.
44
+ */
45
+ export declare function orgMarketplacePath(orgSlug: string): string;
46
+ /** One listing's detail page. */
47
+ export declare function listingPath(basePath: string, listingId: string): string;
48
+ /**
49
+ * The publish-a-plugin form. `listingId` binds it to an existing listing, so
50
+ * the same form ships a new version instead of creating a second listing.
51
+ */
52
+ export declare function publishPluginPath(basePath: string, listingId?: string): string;
53
+ /** A publisher's public profile, by handle. */
54
+ export declare function publisherPath(basePath: string, handle: string): string;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * The marketplace hub's own URLs, built from the path the shell mounted it at
18
+ * (AGL-3080).
19
+ *
20
+ * These were `buildRoute(Route.ORG_MARKETPLACE_LISTING, …)` against the
21
+ * console's route table while the hub was a set of hand-written console
22
+ * routes. A plugin cannot import that table, and should not want to: the hub
23
+ * is served by the generic org plugin route, which hands every page its
24
+ * `basePath` — the absolute path this surface is mounted at under the
25
+ * current organization. Everything beneath it is this plugin's to name.
26
+ *
27
+ * That is also what makes the surface MOVABLE. The addresses below are the
28
+ * ones the console has always served, because `basePath` resolves to
29
+ * `/{orgSlug}/marketplace` today; a workspace that mounted the hub somewhere
30
+ * else would get consistent links rather than links into the old place.
31
+ *
32
+ * ⚠️ These segments appear in links people keep — a bookmark, a docs link, an
33
+ * email the console itself sent. Treat them as persisted.
34
+ */ /**
35
+ * Where this plugin's hub is mounted under one organization, by slug.
36
+ *
37
+ * For a surface that is NOT the hub and has no `basePath` of its own — the
38
+ * staff review queue links a reviewer at the publisher's own listing, in the
39
+ * publisher's workspace, which is somebody else's org entirely. The mount
40
+ * segment is this plugin's `orgNavItems` href, so naming it here is the
41
+ * plugin naming its own surface rather than guessing at the console's.
42
+ */ export function orgMarketplacePath(orgSlug) {
43
+ return `/${encodeURIComponent(orgSlug)}/marketplace`;
44
+ }
45
+ /** One listing's detail page. */ export function listingPath(basePath, listingId) {
46
+ return `${basePath}/${encodeURIComponent(listingId)}`;
47
+ }
48
+ /**
49
+ * The publish-a-plugin form. `listingId` binds it to an existing listing, so
50
+ * the same form ships a new version instead of creating a second listing.
51
+ */ export function publishPluginPath(basePath, listingId) {
52
+ const path = `${basePath}/publish/plugin`;
53
+ return listingId ? `${path}?listing=${encodeURIComponent(listingId)}` : path;
54
+ }
55
+ /** A publisher's public profile, by handle. */ export function publisherPath(basePath, handle) {
56
+ return `${basePath}/publisher/${encodeURIComponent(handle)}`;
57
+ }
58
+
59
+ //# sourceMappingURL=marketplace-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/marketplace/src/lib/model/marketplace-paths.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * The marketplace hub's own URLs, built from the path the shell mounted it at\n * (AGL-3080).\n *\n * These were `buildRoute(Route.ORG_MARKETPLACE_LISTING, …)` against the\n * console's route table while the hub was a set of hand-written console\n * routes. A plugin cannot import that table, and should not want to: the hub\n * is served by the generic org plugin route, which hands every page its\n * `basePath` — the absolute path this surface is mounted at under the\n * current organization. Everything beneath it is this plugin's to name.\n *\n * That is also what makes the surface MOVABLE. The addresses below are the\n * ones the console has always served, because `basePath` resolves to\n * `/{orgSlug}/marketplace` today; a workspace that mounted the hub somewhere\n * else would get consistent links rather than links into the old place.\n *\n * ⚠️ These segments appear in links people keep — a bookmark, a docs link, an\n * email the console itself sent. Treat them as persisted.\n */\n\n/**\n * Where this plugin's hub is mounted under one organization, by slug.\n *\n * For a surface that is NOT the hub and has no `basePath` of its own — the\n * staff review queue links a reviewer at the publisher's own listing, in the\n * publisher's workspace, which is somebody else's org entirely. The mount\n * segment is this plugin's `orgNavItems` href, so naming it here is the\n * plugin naming its own surface rather than guessing at the console's.\n */\nexport function orgMarketplacePath(orgSlug: string): string {\n return `/${encodeURIComponent(orgSlug)}/marketplace`\n}\n\n/** One listing's detail page. */\nexport function listingPath(basePath: string, listingId: string): string {\n return `${basePath}/${encodeURIComponent(listingId)}`\n}\n\n/**\n * The publish-a-plugin form. `listingId` binds it to an existing listing, so\n * the same form ships a new version instead of creating a second listing.\n */\nexport function publishPluginPath(\n basePath: string,\n listingId?: string,\n): string {\n const path = `${basePath}/publish/plugin`\n return listingId ? `${path}?listing=${encodeURIComponent(listingId)}` : path\n}\n\n/** A publisher's public profile, by handle. */\nexport function publisherPath(basePath: string, handle: string): string {\n return `${basePath}/publisher/${encodeURIComponent(handle)}`\n}\n"],"names":["orgMarketplacePath","orgSlug","encodeURIComponent","listingPath","basePath","listingId","publishPluginPath","path","publisherPath","handle"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;CAkBC,GAED;;;;;;;;CAQC,GACD,OAAO,SAASA,mBAAmBC,OAAe;IAChD,OAAO,CAAC,CAAC,EAAEC,mBAAmBD,SAAS,YAAY,CAAC;AACtD;AAEA,+BAA+B,GAC/B,OAAO,SAASE,YAAYC,QAAgB,EAAEC,SAAiB;IAC7D,OAAO,GAAGD,SAAS,CAAC,EAAEF,mBAAmBG,YAAY;AACvD;AAEA;;;CAGC,GACD,OAAO,SAASC,kBACdF,QAAgB,EAChBC,SAAkB;IAElB,MAAME,OAAO,GAAGH,SAAS,eAAe,CAAC;IACzC,OAAOC,YAAY,GAAGE,KAAK,SAAS,EAAEL,mBAAmBG,YAAY,GAAGE;AAC1E;AAEA,6CAA6C,GAC7C,OAAO,SAASC,cAAcJ,QAAgB,EAAEK,MAAc;IAC5D,OAAO,GAAGL,SAAS,WAAW,EAAEF,mBAAmBO,SAAS;AAC9D"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * What a payout card is allowed to say (AGL-1997).
19
+ *
20
+ * The seller panel decided this inline, from ONE flag:
21
+ *
22
+ * payoutsEnabled = loaded && Boolean(profile.stripeChargesEnabled)
23
+ *
24
+ * and rendered "Payouts are enabled" from it. `stripeChargesEnabled` answers
25
+ * whether Stripe will let the account take MONEY; whether the money can LEAVE
26
+ * is `stripePayoutsEnabled`, added by AGL-1547 for this exact panel and never
27
+ * read by any UI. Charges-yes/payouts-no is an ordinary Stripe state —
28
+ * verification pending or lapsed, no payout method — and it is precisely
29
+ * where the old sentence was false, in the direction that costs the seller:
30
+ * they sell believing they are paid, and the funds sit.
31
+ *
32
+ * Extracted as a pure function so every state can be asserted without
33
+ * mounting the card. The card's job is wording; this one's is the decision.
34
+ */
35
+ export type PayoutReadiness =
36
+ /** Still reading the profile. Say nothing about payouts. */
37
+ 'pending'
38
+ /** The read failed. Say nothing about payouts — this is not "off". */
39
+ | 'error'
40
+ /** No Stripe account can take charges yet: the onboarding call to action. */
41
+ | 'disconnected'
42
+ /**
43
+ * Charges on, payout readiness never recorded. NOT a problem report: the
44
+ * field postdates AGL-1547 and is written only by the connect route and the
45
+ * `account.updated` sync, so an absent value means unasked, not off.
46
+ */
47
+ | 'unknown'
48
+ /** Charges on, payouts explicitly NOT enabled — the stranded-funds state. */
49
+ | 'blocked'
50
+ /**
51
+ * Charges on, but which Stripe world the account belongs to was never
52
+ * recorded (AGL-2471) — so no money door will actually charge against it.
53
+ * Ranked ABOVE the payout question because it is the more fundamental
54
+ * failure: an unverified linkage cannot take a payment at all, and saying
55
+ * "payouts are enabled" about it is the sentence that shipped three
56
+ * storefronts presenting as ready and unable to sell.
57
+ */
58
+ | 'unverified'
59
+ /** Charges on and payouts on. The only state that may claim success. */
60
+ | 'ready';
61
+ export interface PayoutReadinessInput {
62
+ /** Profile load state, as the card already computes it. */
63
+ state: 'pending' | 'error' | 'loaded';
64
+ /** `profile.stripeChargesEnabled`, whatever shape it is on the document. */
65
+ chargesEnabled?: unknown;
66
+ /** `profile.stripePayoutsEnabled` — absent on pre-AGL-1547 profiles. */
67
+ payoutsEnabled?: unknown;
68
+ /**
69
+ * `profile.stripeAccountLivemode` (AGL-2471) — absent on every linkage
70
+ * written before it, including all three that existed in production.
71
+ */
72
+ accountLivemode?: unknown;
73
+ }
74
+ /**
75
+ * Decides which of the six statements a payout card may make.
76
+ *
77
+ * `payoutsEnabled` is read three-valued on purpose: only a literal `false`
78
+ * from Stripe produces `'blocked'`. Any other absent-or-odd value produces
79
+ * `'unknown'`, which reports uncertainty instead of inventing either answer.
80
+ */
81
+ export declare function payoutReadiness(input: PayoutReadinessInput): PayoutReadiness;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ /**
17
+ * What a payout card is allowed to say (AGL-1997).
18
+ *
19
+ * The seller panel decided this inline, from ONE flag:
20
+ *
21
+ * payoutsEnabled = loaded && Boolean(profile.stripeChargesEnabled)
22
+ *
23
+ * and rendered "Payouts are enabled" from it. `stripeChargesEnabled` answers
24
+ * whether Stripe will let the account take MONEY; whether the money can LEAVE
25
+ * is `stripePayoutsEnabled`, added by AGL-1547 for this exact panel and never
26
+ * read by any UI. Charges-yes/payouts-no is an ordinary Stripe state —
27
+ * verification pending or lapsed, no payout method — and it is precisely
28
+ * where the old sentence was false, in the direction that costs the seller:
29
+ * they sell believing they are paid, and the funds sit.
30
+ *
31
+ * Extracted as a pure function so every state can be asserted without
32
+ * mounting the card. The card's job is wording; this one's is the decision.
33
+ */ /**
34
+ * Decides which of the six statements a payout card may make.
35
+ *
36
+ * `payoutsEnabled` is read three-valued on purpose: only a literal `false`
37
+ * from Stripe produces `'blocked'`. Any other absent-or-odd value produces
38
+ * `'unknown'`, which reports uncertainty instead of inventing either answer.
39
+ */ export function payoutReadiness(input) {
40
+ if (input.state !== 'loaded') return input.state;
41
+ if (input.chargesEnabled !== true) return 'disconnected';
42
+ // AGL-2471, asked before the payout question: `stripeChargesEnabled` alone
43
+ // is what made a test-mode account read as a working merchant. Only a
44
+ // literal boolean counts as recorded — the same three-valued reading the
45
+ // server gate uses, so the card and the checkout agree.
46
+ if (typeof input.accountLivemode !== 'boolean') return 'unverified';
47
+ if (input.payoutsEnabled === true) return 'ready';
48
+ if (input.payoutsEnabled === false) return 'blocked';
49
+ return 'unknown';
50
+ }
51
+
52
+ //# sourceMappingURL=payout-readiness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/marketplace/src/lib/model/payout-readiness.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * What a payout card is allowed to say (AGL-1997).\n *\n * The seller panel decided this inline, from ONE flag:\n *\n * payoutsEnabled = loaded && Boolean(profile.stripeChargesEnabled)\n *\n * and rendered \"Payouts are enabled\" from it. `stripeChargesEnabled` answers\n * whether Stripe will let the account take MONEY; whether the money can LEAVE\n * is `stripePayoutsEnabled`, added by AGL-1547 for this exact panel and never\n * read by any UI. Charges-yes/payouts-no is an ordinary Stripe state —\n * verification pending or lapsed, no payout method — and it is precisely\n * where the old sentence was false, in the direction that costs the seller:\n * they sell believing they are paid, and the funds sit.\n *\n * Extracted as a pure function so every state can be asserted without\n * mounting the card. The card's job is wording; this one's is the decision.\n */\nexport type PayoutReadiness =\n /** Still reading the profile. Say nothing about payouts. */\n | 'pending'\n /** The read failed. Say nothing about payouts — this is not \"off\". */\n | 'error'\n /** No Stripe account can take charges yet: the onboarding call to action. */\n | 'disconnected'\n /**\n * Charges on, payout readiness never recorded. NOT a problem report: the\n * field postdates AGL-1547 and is written only by the connect route and the\n * `account.updated` sync, so an absent value means unasked, not off.\n */\n | 'unknown'\n /** Charges on, payouts explicitly NOT enabled — the stranded-funds state. */\n | 'blocked'\n /**\n * Charges on, but which Stripe world the account belongs to was never\n * recorded (AGL-2471) — so no money door will actually charge against it.\n * Ranked ABOVE the payout question because it is the more fundamental\n * failure: an unverified linkage cannot take a payment at all, and saying\n * \"payouts are enabled\" about it is the sentence that shipped three\n * storefronts presenting as ready and unable to sell.\n */\n | 'unverified'\n /** Charges on and payouts on. The only state that may claim success. */\n | 'ready'\n\nexport interface PayoutReadinessInput {\n /** Profile load state, as the card already computes it. */\n state: 'pending' | 'error' | 'loaded'\n /** `profile.stripeChargesEnabled`, whatever shape it is on the document. */\n chargesEnabled?: unknown\n /** `profile.stripePayoutsEnabled` — absent on pre-AGL-1547 profiles. */\n payoutsEnabled?: unknown\n /**\n * `profile.stripeAccountLivemode` (AGL-2471) — absent on every linkage\n * written before it, including all three that existed in production.\n */\n accountLivemode?: unknown\n}\n\n/**\n * Decides which of the six statements a payout card may make.\n *\n * `payoutsEnabled` is read three-valued on purpose: only a literal `false`\n * from Stripe produces `'blocked'`. Any other absent-or-odd value produces\n * `'unknown'`, which reports uncertainty instead of inventing either answer.\n */\nexport function payoutReadiness(input: PayoutReadinessInput): PayoutReadiness {\n if (input.state !== 'loaded') return input.state\n if (input.chargesEnabled !== true) return 'disconnected'\n // AGL-2471, asked before the payout question: `stripeChargesEnabled` alone\n // is what made a test-mode account read as a working merchant. Only a\n // literal boolean counts as recorded — the same three-valued reading the\n // server gate uses, so the card and the checkout agree.\n if (typeof input.accountLivemode !== 'boolean') return 'unverified'\n if (input.payoutsEnabled === true) return 'ready'\n if (input.payoutsEnabled === false) return 'blocked'\n return 'unknown'\n}\n"],"names":["payoutReadiness","input","state","chargesEnabled","accountLivemode","payoutsEnabled"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;CAiBC,GA0CD;;;;;;CAMC,GACD,OAAO,SAASA,gBAAgBC,KAA2B;IACzD,IAAIA,MAAMC,KAAK,KAAK,UAAU,OAAOD,MAAMC,KAAK;IAChD,IAAID,MAAME,cAAc,KAAK,MAAM,OAAO;IAC1C,2EAA2E;IAC3E,sEAAsE;IACtE,yEAAyE;IACzE,wDAAwD;IACxD,IAAI,OAAOF,MAAMG,eAAe,KAAK,WAAW,OAAO;IACvD,IAAIH,MAAMI,cAAc,KAAK,MAAM,OAAO;IAC1C,IAAIJ,MAAMI,cAAc,KAAK,OAAO,OAAO;IAC3C,OAAO;AACT"}