@redeemid/emdash 0.0.11 → 0.0.12
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/README.md +3 -1
- package/package.json +1 -1
- package/src/agents.ts +2 -1
- package/src/config.ts +13 -0
- package/src/plugin.ts +2 -1
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Shopify customer accounts, member levels and paywalls for [EmDash](https://github.com/emdash-cms/emdash) sites. Shopify runs the store and the customer account; EmDash runs the content.
|
|
4
4
|
|
|
5
|
-
**Status: 0.0.
|
|
5
|
+
**Status: 0.0.12, early.** Runs on Node and Cloudflare Workers. Sign-in, the member mirror, webhooks, levels, rules, the meter and drip, teasers, badges, the page gate, the Shopify cart and checkout, the staff tools, preferences, protected files, privacy requests, AI agent tools, the command line, replacement text and outbound events are covered by an end-to-end test against a fake store.
|
|
6
6
|
|
|
7
7
|
## What it does
|
|
8
8
|
|
|
@@ -89,6 +89,8 @@ Set these secrets in the environment (`.env` locally, `wrangler secret put` on W
|
|
|
89
89
|
| `REDEEMID_SHOPIFY_STOREFRONT_PRIVATE_TOKEN` | Storefront API | Private access token, for the plan cards and checkout (server-side). |
|
|
90
90
|
| `REDEEMID_SHOPIFY_STOREFRONT_PUBLIC_TOKEN` | Storefront API | Public access token. Only used when the private token isn't set. |
|
|
91
91
|
|
|
92
|
+
Set them as runtime variables or secrets of the site itself, not as build-time variables. If a value shows as Missing on the Status page, check its name: the Status page also lists any `REDEEMID_` variable that is set but that RedeemID doesn't read, by name only.
|
|
93
|
+
|
|
92
94
|
RedeemID finds the authorization, token and logout endpoints itself from the store's discovery documents, so they need no setting.
|
|
93
95
|
|
|
94
96
|
In Shopify, give the Customer Account API client these settings:
|
package/package.json
CHANGED
package/src/agents.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import { adminConfigured } from "./admin-api.js";
|
|
13
13
|
import { describe as describeRequirement, dripDays, levelsFor, membership, passes, requirement, termTree, type Requirement, type Terms } from "./access.js";
|
|
14
|
-
import { ENV, env, storeDomain, type RedeemIDConfig } from "./config.js";
|
|
14
|
+
import { ENV, env, storeDomain, unknownEnvNames, type RedeemIDConfig } from "./config.js";
|
|
15
15
|
import { featuresFor } from "./features.js";
|
|
16
16
|
import { bodyClauses } from "./files.js";
|
|
17
17
|
import { holdsItem, soldItem, type SoldItem } from "./blocks-names.js";
|
|
@@ -155,6 +155,7 @@ export async function siteHealth(config: RedeemIDConfig, s: Stores): Promise<Rec
|
|
|
155
155
|
lastWebhook: items[0]?.data ?? null,
|
|
156
156
|
openPrivacyRequests: open.items.length,
|
|
157
157
|
ignoredTextReplacements: textProblems(config).length,
|
|
158
|
+
unusedSettings: unknownEnvNames(),
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
161
|
|
package/src/config.ts
CHANGED
|
@@ -192,6 +192,19 @@ export function env(name: string): string {
|
|
|
192
192
|
return typeof value === "string" ? value.trim() : "";
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Names of REDEEMID_ variables that are set but that RedeemID doesn't read,
|
|
197
|
+
* such as a misspelled secret or a WordPress plugin constant. Names only,
|
|
198
|
+
* never values.
|
|
199
|
+
*/
|
|
200
|
+
export function unknownEnvNames(): string[] {
|
|
201
|
+
if (typeof process === "undefined" || !process.env) return [];
|
|
202
|
+
const known = new Set<string>(Object.values(ENV));
|
|
203
|
+
return Object.keys(process.env)
|
|
204
|
+
.filter((k) => k.startsWith("REDEEMID_") && !known.has(k))
|
|
205
|
+
.sort();
|
|
206
|
+
}
|
|
207
|
+
|
|
195
208
|
/** The store origin, e.g. https://shop.example.com. */
|
|
196
209
|
export function shopOrigin(config: RedeemIDConfig): string {
|
|
197
210
|
const raw = storeDomain(config).replace(/\/+$/, "");
|
package/src/plugin.ts
CHANGED
|
@@ -28,7 +28,7 @@ import type { ResolvedPlugin, RouteContext } from "emdash";
|
|
|
28
28
|
import { definePlugin } from "emdash";
|
|
29
29
|
|
|
30
30
|
import { describe, levelsFor, SIGNED_IN } from "./access.js";
|
|
31
|
-
import { env, ENV, storeDomain, type RedeemIDConfig } from "./config.js";
|
|
31
|
+
import { env, ENV, storeDomain, unknownEnvNames, type RedeemIDConfig } from "./config.js";
|
|
32
32
|
import { discover } from "./shopify.js";
|
|
33
33
|
import { stores, type MemberRecord, type Stores } from "./storage.js";
|
|
34
34
|
import { PAGES, WIDGETS } from "./descriptor.js";
|
|
@@ -544,6 +544,7 @@ async function statusPage(config: RedeemIDConfig, request: Request) {
|
|
|
544
544
|
{ label: "Storefront API access", value: c.storefront },
|
|
545
545
|
{ label: "Last webhook", value: delivery ?? "None received yet" },
|
|
546
546
|
{ label: "Replacement text", value: textSummary(config) },
|
|
547
|
+
...(unknownEnvNames().length ? [{ label: "Set but not used (check the name)", value: unknownEnvNames().join(", ") }] : []),
|
|
547
548
|
],
|
|
548
549
|
},
|
|
549
550
|
...(textProblems(config).length
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.0.
|
|
1
|
+
export const VERSION = "0.0.12";
|