@redeemid/emdash 0.0.9 → 0.0.11
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 +138 -2
- package/bin/redeemid-emdash.mjs +144 -0
- package/docs/shopify-setup.md +4 -2
- package/package.json +8 -2
- package/src/access.ts +2 -2
- package/src/agents.ts +179 -0
- package/src/blocks/ContributionBlock.astro +1 -1
- package/src/blocks/PlanBlock.astro +1 -1
- package/src/blocks/PreferencesBlock.astro +12 -0
- package/src/blocks/index.ts +3 -0
- package/src/blocks-names.ts +27 -0
- package/src/components/AccessBadge.astro +10 -6
- package/src/components/Account.astro +5 -4
- package/src/components/Cart.astro +4 -1
- package/src/components/CartView.astro +14 -13
- package/src/components/Collection.astro +2 -1
- package/src/components/Content.astro +25 -10
- package/src/components/Contribution.astro +4 -3
- package/src/components/LockedPanel.astro +35 -9
- package/src/components/MemberCard.astro +15 -14
- package/src/components/Notices.astro +12 -2
- package/src/components/Plan.astro +3 -2
- package/src/components/Preferences.astro +102 -0
- package/src/components/Product.astro +6 -5
- package/src/components/YourData.astro +42 -0
- package/src/config.ts +38 -1
- package/src/descriptor.ts +1 -0
- package/src/events.ts +3 -2
- package/src/files.ts +196 -0
- package/src/guard.ts +43 -2
- package/src/index.ts +2 -0
- package/src/plugin.ts +169 -4
- package/src/preferences.ts +298 -0
- package/src/privacy.ts +148 -0
- package/src/routes/preferences.ts +82 -0
- package/src/routes/privacy.ts +59 -0
- package/src/routes/webhook.ts +1 -1
- package/src/staff.ts +92 -0
- package/src/storage.ts +17 -0
- package/src/text.ts +185 -0
- package/src/version.ts +1 -1
- package/src/webhooks.ts +17 -4
package/src/webhooks.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { cleanTags, emptyMember, numericId, stampTags, type MemberRecord, type Stores } from "./storage.js";
|
|
10
|
+
import type { RedeemIDConfig } from "./config.js";
|
|
11
|
+
import { eraseAll, eraseMember, shopifyDataRequest } from "./privacy.js";
|
|
10
12
|
|
|
11
13
|
export type Kind = "profile" | "delete" | "status" | "tags" | "merge" | "compliance" | "ignored";
|
|
12
14
|
|
|
@@ -94,16 +96,27 @@ export async function apply(
|
|
|
94
96
|
payload: Record<string, unknown>,
|
|
95
97
|
/** Called after a member is written, with their tags before (null when new). */
|
|
96
98
|
onWrite?: (beforeTags: string[] | null, after: MemberRecord) => Promise<void> | void,
|
|
99
|
+
/** For the member.erased event on customers/redact. */
|
|
100
|
+
config?: RedeemIDConfig | null,
|
|
97
101
|
): Promise<Outcome> {
|
|
98
102
|
const kind = kindOf(topic);
|
|
99
103
|
if (!kind || kind === "ignored") return "ignored";
|
|
100
104
|
|
|
101
105
|
if (kind === "compliance") {
|
|
102
|
-
//
|
|
103
|
-
|
|
106
|
+
// Every compliance topic is logged as a privacy request (see privacy.ts).
|
|
107
|
+
const id = customerOf(payload);
|
|
104
108
|
if (topic === "customers/redact") {
|
|
105
|
-
|
|
106
|
-
|
|
109
|
+
if (id) await eraseMember(config ?? null, s, id, "shopify");
|
|
110
|
+
return id ? "processed" : "skipped";
|
|
111
|
+
}
|
|
112
|
+
if (topic === "customers/data_request") {
|
|
113
|
+
if (!id) return "skipped";
|
|
114
|
+
const req = (payload.data_request as { id?: unknown } | undefined)?.id;
|
|
115
|
+
await shopifyDataRequest(s, id, req === undefined || req === null ? null : String(req));
|
|
116
|
+
return "processed";
|
|
117
|
+
}
|
|
118
|
+
if (topic === "shop/redact") {
|
|
119
|
+
await eraseAll(config ?? null, s);
|
|
107
120
|
return "processed";
|
|
108
121
|
}
|
|
109
122
|
return "skipped";
|