@velastack/patterns 0.8.0 → 0.9.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.
- package/dist/chunks/{collections-BrEA7a62.js → collections-DZOuRpvS.js} +6 -1
- package/dist/chunks/collections-DZOuRpvS.js.map +1 -0
- package/dist/chunks/{generate-BZ741GPx.js → currency.server-Bb2Ndutg.js} +6 -3
- package/dist/chunks/{generate-BZ741GPx.js.map → currency.server-Bb2Ndutg.js.map} +1 -1
- package/dist/chunks/{generate-6JS05dWK.js → generate-B-cqjI-U.js} +62 -55
- package/dist/chunks/generate-B-cqjI-U.js.map +1 -0
- package/dist/chunks/{generate.runtime-BOl3LpPB.js → generate.runtime-BnqS_Zq8.js} +84 -158
- package/dist/chunks/generate.runtime-BnqS_Zq8.js.map +1 -0
- package/dist/chunks/{generate.runtime-KrQk7mqG.js → generate.runtime-DG9Lp3vR.js} +39 -37
- package/dist/chunks/generate.runtime-DG9Lp3vR.js.map +1 -0
- package/dist/chunks/{generate.runtime-Dt3Edp8-.js → generate.runtime-X-uAteso.js} +123 -104
- package/dist/chunks/generate.runtime-X-uAteso.js.map +1 -0
- package/dist/chunks/load-function-Dmkhg1pQ.js +79 -0
- package/dist/chunks/load-function-Dmkhg1pQ.js.map +1 -0
- package/dist/chunks/root-layout.svelte-CUVbnlX-.js +302 -0
- package/dist/chunks/root-layout.svelte-CUVbnlX-.js.map +1 -0
- package/dist/index.js +15 -15
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/collections-BrEA7a62.js.map +0 -1
- package/dist/chunks/generate-6JS05dWK.js.map +0 -1
- package/dist/chunks/generate.runtime-BOl3LpPB.js.map +0 -1
- package/dist/chunks/generate.runtime-Dt3Edp8-.js.map +0 -1
- package/dist/chunks/generate.runtime-KrQk7mqG.js.map +0 -1
- package/dist/chunks/root-layout.svelte-CsJ2QJYi.js +0 -93
- package/dist/chunks/root-layout.svelte-CsJ2QJYi.js.map +0 -1
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { t as e } from "./lib-specifier-Cngo1zF_.js";
|
|
2
2
|
import { n as t } from "./logger-CQONztPm.js";
|
|
3
|
-
import {
|
|
3
|
+
import { a as n } from "./currency.server-Bb2Ndutg.js";
|
|
4
4
|
import { t as r } from "./shared-BbxLil4g.js";
|
|
5
|
-
import { n as i } from "./generate-
|
|
5
|
+
import { n as i } from "./generate-B-cqjI-U.js";
|
|
6
6
|
import { n as a } from "./env-BugddEjd.js";
|
|
7
7
|
import { f as o, m as s, n as c, o as l } from "./ts-morph-helpers-CHI9wAil.js";
|
|
8
8
|
import { r as u } from "./modify-file-B4uJzOEj.js";
|
|
9
9
|
import { unmodifyEnvVarsFiles as d } from "./env-vars-0hvKe55u.js";
|
|
10
10
|
import { t as f } from "./svelte-file-Dv5-bl79.js";
|
|
11
|
-
import {
|
|
12
|
-
import { n as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import { Project as
|
|
11
|
+
import { c as p, i as m, n as h, o as g } from "./root-layout.svelte-CUVbnlX-.js";
|
|
12
|
+
import { n as _, t as v } from "./wuchale-config-c3Q4JVSF.js";
|
|
13
|
+
import y from "node:fs";
|
|
14
|
+
import b from "node:path";
|
|
15
|
+
import { Project as x, QuoteKind as S, SyntaxKind as C } from "ts-morph";
|
|
16
16
|
//#region src/patterns/disable/payments/modifies/modify-nav-user.ts
|
|
17
|
-
function
|
|
18
|
-
if (!
|
|
17
|
+
function w(e) {
|
|
18
|
+
if (!y.existsSync(e)) return {
|
|
19
19
|
status: "success",
|
|
20
20
|
changed: !1
|
|
21
21
|
};
|
|
22
|
-
let t =
|
|
22
|
+
let t = y.readFileSync(e, "utf8");
|
|
23
23
|
if (!t.includes("/billing")) return {
|
|
24
24
|
status: "success",
|
|
25
25
|
changed: !1
|
|
@@ -30,7 +30,7 @@ function x(e) {
|
|
|
30
30
|
return t.wasRemoved && (r = !0), t.source;
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
|
-
return i((e) => n.modifyModuleScript(e)), r || i((e) => n.modifyScript(e)), r ? (
|
|
33
|
+
return i((e) => n.modifyModuleScript(e)), r || i((e) => n.modifyScript(e)), r ? (y.writeFileSync(e, n.toString(), "utf8"), {
|
|
34
34
|
status: "success",
|
|
35
35
|
changed: !0
|
|
36
36
|
}) : {
|
|
@@ -40,27 +40,27 @@ function x(e) {
|
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
//#region src/patterns/disable/payments/modifies/modify-user-signup.ts
|
|
43
|
-
var
|
|
44
|
-
function
|
|
45
|
-
if (!
|
|
43
|
+
var T = /* @__PURE__ */ new Set(["linkStripeCustomer.run", "linkStripeCustomer"]);
|
|
44
|
+
function E(t) {
|
|
45
|
+
if (!y.existsSync(t)) return {
|
|
46
46
|
status: "success",
|
|
47
47
|
changed: !1
|
|
48
48
|
};
|
|
49
|
-
let n =
|
|
49
|
+
let n = y.readFileSync(t, "utf8");
|
|
50
50
|
if (!n.includes("linkStripeCustomer")) return {
|
|
51
51
|
status: "success",
|
|
52
52
|
changed: !1
|
|
53
53
|
};
|
|
54
|
-
let r = new
|
|
54
|
+
let r = new x({ manipulationSettings: { quoteKind: S.Single } }).addSourceFileAtPath(t);
|
|
55
55
|
for (let t of ["workflows/link-stripe-customer", "stripe"]) {
|
|
56
56
|
let n = r.getImportDeclarations().find((n) => e(n.getModuleSpecifierValue(), t));
|
|
57
57
|
n && n.remove();
|
|
58
58
|
}
|
|
59
59
|
let i = r.getVariableStatement((e) => e.getDeclarations().some((e) => e.getName() === "linkStripeCustomer"));
|
|
60
60
|
i && i.remove();
|
|
61
|
-
let a = r.getDescendantsOfKind(
|
|
61
|
+
let a = r.getDescendantsOfKind(C.CallExpression).filter((e) => T.has(e.getExpression().getText()));
|
|
62
62
|
for (let e of a) {
|
|
63
|
-
let t = e.getFirstAncestorByKind(
|
|
63
|
+
let t = e.getFirstAncestorByKind(C.ExpressionStatement);
|
|
64
64
|
t && s(r, t);
|
|
65
65
|
}
|
|
66
66
|
return l(r), c(r), r.saveSync(), {
|
|
@@ -70,43 +70,45 @@ function C(t) {
|
|
|
70
70
|
}
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/patterns/disable/payments/generate.runtime.ts
|
|
73
|
-
var
|
|
73
|
+
var D = [
|
|
74
74
|
"transactions",
|
|
75
75
|
"stripe_customers",
|
|
76
76
|
"stripe_payment_methods",
|
|
77
77
|
"stripe_prices",
|
|
78
78
|
"stripe_products"
|
|
79
79
|
];
|
|
80
|
-
async function
|
|
81
|
-
let o = e.features.auth, s = t(e), c = i(e), l = c.some((e) => e.id === "stripe"), f = [],
|
|
80
|
+
async function O(e) {
|
|
81
|
+
let o = e.features.auth, s = t(e), c = i(e), l = c.some((e) => e.id === "stripe"), f = [], x = [], S = (e) => {
|
|
82
82
|
e && f.push(e);
|
|
83
|
-
},
|
|
84
|
-
for (let e of c) s.info(`Stripping ${e.label} credentials from .env`),
|
|
83
|
+
}, C = b.join(e.root, ".env");
|
|
84
|
+
for (let e of c) s.info(`Stripping ${e.label} credentials from .env`), S(u(C, a(C, n(e))));
|
|
85
85
|
s.info("Removing the currency select from the navbar");
|
|
86
|
-
let
|
|
87
|
-
|
|
88
|
-
let
|
|
89
|
-
y(
|
|
90
|
-
let
|
|
91
|
-
|
|
86
|
+
let T = b.join(e.root, "src", "routes", "(public)", "root-layout.svelte");
|
|
87
|
+
S(u(T, h(T)));
|
|
88
|
+
let O = b.join(e.root, "src", "hooks.server.ts"), k = b.join(e.root, "src", "routes", "+layout.server.ts"), A = b.join(e.root, "src", "routes", "+layout.svelte");
|
|
89
|
+
y.existsSync(k) && (s.info("Removing the visitor's currency from the server"), S(u(A, m(A))), S(u(k, g(k))), S(u(O, p(O)))), s.info("Removing payment variables from src/env.ts");
|
|
90
|
+
let j = d(e.root, c.flatMap((e) => (e.env ?? []).map((e) => e.key)));
|
|
91
|
+
S(j.modify), j.delete && x.push(j.delete);
|
|
92
|
+
let M = b.join(e.root, "wuchale.config.js");
|
|
93
|
+
if (c.some((e) => e.id === "whatsapp") && y.existsSync(M) && (s.info("Removing src/lib/order.ts from wuchale's js adapter"), S(u(M, _(M, v, "remove")))), l && o) {
|
|
92
94
|
s.info("Reverting nav-user.svelte");
|
|
93
|
-
let t =
|
|
94
|
-
|
|
95
|
-
let n =
|
|
96
|
-
|
|
95
|
+
let t = b.join(e.root, "src", "lib", "components", "nav-user.svelte");
|
|
96
|
+
S(u(t, w(t))), s.info("Reverting signup +page.server.ts");
|
|
97
|
+
let n = b.join(e.root, "src", "routes", "(public)", "(auth)", "signup", "+page.server.ts");
|
|
98
|
+
S(u(n, E(n)));
|
|
97
99
|
}
|
|
98
100
|
return {
|
|
99
101
|
creates: [],
|
|
100
102
|
modifies: f,
|
|
101
|
-
deletes:
|
|
103
|
+
deletes: x,
|
|
102
104
|
components: [],
|
|
103
105
|
packages: [],
|
|
104
106
|
collections: [],
|
|
105
107
|
collectionPatches: [],
|
|
106
|
-
collectionDrops: l && e.features.backend ? await r(
|
|
108
|
+
collectionDrops: l && e.features.backend ? await r(D, e) : []
|
|
107
109
|
};
|
|
108
110
|
}
|
|
109
111
|
//#endregion
|
|
110
|
-
export {
|
|
112
|
+
export { O as generate };
|
|
111
113
|
|
|
112
|
-
//# sourceMappingURL=generate.runtime-
|
|
114
|
+
//# sourceMappingURL=generate.runtime-DG9Lp3vR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.runtime-DG9Lp3vR.js","names":["isLibSpecifier","getLogger","envEditsFor","planDropsForCollections","providersToRemove","modifyEnvRemove","removeNavItemFromScript","removeStatementWithComments","ensureBlankLineAfterImports","formatLikeSource","modifyOutcomeToFile","SvelteFile","unmodifyHooksServerCurrency","unmodifyLayoutSvelteCurrency","unmodifyRootLayoutCurrencySelect","unmodifyLayoutServerCurrency","modifyWuchaleJsFiles","TRANSLATED_LIB_FILES","fs","path","unmodifyNavUser","navUserPath","source","file","wasRemoved","tryRemove","run","result","src","fn","CALL_EXPRESSIONS","unmodifyUserSignup","userSignupPath","originalSource","sourceFile","Project","QuoteKind","module","decl","d","linkFn","s","callStatements","SyntaxKind","ce","call","stmt","STRIPE_COLLECTIONS","generate","isAppMode","options","logger","providers","isStripe","provider","modifies","deletes","pushResult","envPath","layoutPath","hooksServerPath","layoutServerPath","rootLayoutPath","envVars","unmodifyEnvVarsFiles","variable","wuchaleConfig"],"sources":["../../src/patterns/disable/payments/modifies/modify-nav-user.ts","../../src/patterns/disable/payments/modifies/modify-user-signup.ts","../../src/patterns/disable/payments/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport { removeNavItemFromScript } from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nexport function unmodifyNavUser(navUserPath: string): ModifyOutcome {\n if (!fs.existsSync(navUserPath)) {\n return { status: \"success\", changed: false };\n }\n\n const source = fs.readFileSync(navUserPath, \"utf8\");\n if (!source.includes(\"/billing\")) {\n return { status: \"success\", changed: false };\n }\n\n const file = new SvelteFile(source);\n let wasRemoved = false;\n\n const tryRemove = (run: (fn: (s: string) => string) => boolean) => {\n if (wasRemoved) return;\n run((src) => {\n const result = removeNavItemFromScript(\n src,\n \"Billing\",\n \"@lucide/svelte/icons/credit-card\",\n );\n if (result.wasRemoved) wasRemoved = true;\n return result.source;\n });\n };\n\n tryRemove((fn) => file.modifyModuleScript(fn));\n if (!wasRemoved) tryRemove((fn) => file.modifyScript(fn));\n\n if (!wasRemoved) {\n return { status: \"success\", changed: false };\n }\n\n fs.writeFileSync(navUserPath, file.toString(), \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureBlankLineAfterImports,\n formatLikeSource,\n removeStatementWithComments,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport { isLibSpecifier } from \"../../../../runtime/lib-specifier\";\n\nconst CALL_EXPRESSIONS = new Set([\n \"linkStripeCustomer.run\",\n // Projects from before the workflow: an inline helper called directly.\n \"linkStripeCustomer\",\n]);\n\nexport function unmodifyUserSignup(userSignupPath: string): ModifyOutcome {\n if (!fs.existsSync(userSignupPath)) {\n return { status: \"success\", changed: false };\n }\n\n const originalSource = fs.readFileSync(userSignupPath, \"utf8\");\n if (!originalSource.includes(\"linkStripeCustomer\")) {\n return { status: \"success\", changed: false };\n }\n\n const project = new Project({\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sourceFile = project.addSourceFileAtPath(userSignupPath);\n\n for (const module of [\"workflows/link-stripe-customer\", \"stripe\"]) {\n const decl = sourceFile\n .getImportDeclarations()\n .find((d) => isLibSpecifier(d.getModuleSpecifierValue(), module));\n if (decl) decl.remove();\n }\n\n const linkFn = sourceFile.getVariableStatement((s) =>\n s.getDeclarations().some((d) => d.getName() === \"linkStripeCustomer\"),\n );\n if (linkFn) linkFn.remove();\n\n const callStatements = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .filter((ce) => CALL_EXPRESSIONS.has(ce.getExpression().getText()));\n for (const call of callStatements) {\n const stmt = call.getFirstAncestorByKind(SyntaxKind.ExpressionStatement);\n // With the two comment lines enable-payments put above it: left behind,\n // they keep the file from matching the stock signup, and enable-whatsapp\n // then refuses to swap it.\n if (stmt) removeStatementWithComments(sourceFile, stmt);\n }\n\n formatLikeSource(sourceFile);\n ensureBlankLineAfterImports(sourceFile);\n sourceFile.saveSync();\n\n return {\n status: \"success\",\n changed: sourceFile.getFullText() !== originalSource,\n };\n}\n","import path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyEnvRemove } from \"../../../runtime/env\";\nimport { unmodifyEnvVarsFiles } from \"../../../runtime/env-vars\";\nimport { envEditsFor } from \"../../enable/payments/generate\";\nimport { providersToRemove } from \"./generate\";\nimport { unmodifyNavUser } from \"./modifies/modify-nav-user\";\nimport { unmodifyHooksServerCurrency } from \"../../enable/payments/modifies/hooks.server\";\nimport { unmodifyLayoutServerCurrency } from \"../../enable/payments/modifies/layout.server\";\nimport { unmodifyLayoutSvelteCurrency } from \"../../enable/payments/modifies/layout.svelte\";\nimport { unmodifyRootLayoutCurrencySelect } from \"../../enable/payments/modifies/root-layout.svelte\";\nimport { unmodifyUserSignup } from \"./modifies/modify-user-signup\";\nimport { planDropsForCollections } from \"../../destroy/shared\";\nimport fs from \"node:fs\";\nimport {\n modifyWuchaleJsFiles,\n TRANSLATED_LIB_FILES,\n} from \"../../../runtime/wuchale-config\";\n\n/** Everything enable-payments creates in PocketBase for Stripe. */\nconst STRIPE_COLLECTIONS = [\n \"transactions\",\n \"stripe_customers\",\n \"stripe_payment_methods\",\n \"stripe_prices\",\n \"stripe_products\",\n];\n\nexport async function generate(options: Options) {\n const isAppMode = options.features.auth;\n const logger = getLogger(options);\n const providers = providersToRemove(options);\n const isStripe = providers.some((provider) => provider.id === \"stripe\");\n const modifies: File[] = [];\n const deletes: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n const envPath = path.join(options.root, \".env\");\n for (const provider of providers) {\n logger.info(`Stripping ${provider.label} credentials from .env`);\n pushResult(\n modifyOutcomeToFile(\n envPath,\n modifyEnvRemove(envPath, envEditsFor(provider)),\n ),\n );\n }\n\n logger.info(\"Removing the currency select from the navbar\");\n const layoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"root-layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n layoutPath,\n unmodifyRootLayoutCurrencySelect(layoutPath),\n ),\n );\n\n // The server half of the store, where enable-payments added it.\n const hooksServerPath = path.join(options.root, \"src\", \"hooks.server.ts\");\n const layoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.server.ts\",\n );\n const rootLayoutPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"+layout.svelte\",\n );\n if (fs.existsSync(layoutServerPath)) {\n logger.info(\"Removing the visitor's currency from the server\");\n pushResult(\n modifyOutcomeToFile(\n rootLayoutPath,\n unmodifyLayoutSvelteCurrency(rootLayoutPath),\n ),\n );\n pushResult(\n modifyOutcomeToFile(\n layoutServerPath,\n unmodifyLayoutServerCurrency(layoutServerPath),\n ),\n );\n pushResult(\n modifyOutcomeToFile(\n hooksServerPath,\n unmodifyHooksServerCurrency(hooksServerPath),\n ),\n );\n }\n\n logger.info(\"Removing payment variables from src/env.ts\");\n const envVars = unmodifyEnvVarsFiles(\n options.root,\n providers.flatMap((provider) =>\n (provider.env ?? []).map((variable) => variable.key),\n ),\n );\n pushResult(envVars.modify);\n if (envVars.delete) deletes.push(envVars.delete);\n\n // WhatsApp's order message was listed for wuchale; the module goes, so the\n // entry does too.\n const wuchaleConfig = path.join(options.root, \"wuchale.config.js\");\n if (\n providers.some((provider) => provider.id === \"whatsapp\") &&\n fs.existsSync(wuchaleConfig)\n ) {\n logger.info(\"Removing src/lib/order.ts from wuchale's js adapter\");\n pushResult(\n modifyOutcomeToFile(\n wuchaleConfig,\n modifyWuchaleJsFiles(wuchaleConfig, TRANSLATED_LIB_FILES, \"remove\"),\n ),\n );\n }\n\n // The nav item and the signup link exist only in auth's files, which\n // enable-payments edits for Stripe alone.\n if (isStripe && isAppMode) {\n logger.info(\"Reverting nav-user.svelte\");\n const navUserPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"nav-user.svelte\",\n );\n pushResult(modifyOutcomeToFile(navUserPath, unmodifyNavUser(navUserPath)));\n\n logger.info(\"Reverting signup +page.server.ts\");\n const userSignupPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(public)\",\n \"(auth)\",\n \"signup\",\n \"+page.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(userSignupPath, unmodifyUserSignup(userSignupPath)),\n );\n }\n\n // Every Stripe collection is planned, whatever auth is now; one that was\n // never created is planned as missing and left alone. Without a backend\n // (no provider detected, on a Shopify project) there is nothing to drop.\n const collectionDrops =\n isStripe && options.features.backend\n ? await planDropsForCollections(STRIPE_COLLECTIONS, options)\n : [];\n\n return {\n creates: [],\n modifies,\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n } satisfies Result;\n}\n"],"mappings":"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"}
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { t as e } from "./errors-DR3gF_7a.js";
|
|
2
|
-
import { a as t, o as n } from "./util-BLYliuUK.js";
|
|
3
|
-
import { a as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
6
|
-
import { n as
|
|
7
|
-
import { r as
|
|
8
|
-
import { a as
|
|
9
|
-
import { i as
|
|
10
|
-
import { a as
|
|
11
|
-
import { t as
|
|
12
|
-
import { t as
|
|
13
|
-
import { r as
|
|
14
|
-
import { modifyEnvVarsFiles as
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as
|
|
17
|
-
import { n as
|
|
18
|
-
import { t as
|
|
19
|
-
import { i as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
2
|
+
import { a as t, o as n, r } from "./util-BLYliuUK.js";
|
|
3
|
+
import { a as i, c as a, l as o } from "./providers-CL9kQ4hp.js";
|
|
4
|
+
import { t as s } from "./dedent-Gq6Krl4n.js";
|
|
5
|
+
import { t as c } from "./taggedTemplateLiteral-KSUnuvOk.js";
|
|
6
|
+
import { n as l } from "./logger-CQONztPm.js";
|
|
7
|
+
import { a as u, n as d, r as f, t as p } from "./currency.server-Bb2Ndutg.js";
|
|
8
|
+
import { a as m, i as h, r as g } from "./collections-DZOuRpvS.js";
|
|
9
|
+
import { i as _, n as v, t as y } from "./pocketbase-BtN-wL8f.js";
|
|
10
|
+
import { a as b, i as x, r as S, s as C, t as w } from "./site-VrqOvuiU.js";
|
|
11
|
+
import { t as T } from "./env-BugddEjd.js";
|
|
12
|
+
import { t as E } from "./ts-morph-helpers-CHI9wAil.js";
|
|
13
|
+
import { r as D } from "./modify-file-B4uJzOEj.js";
|
|
14
|
+
import { modifyEnvVarsFiles as O } from "./env-vars-0hvKe55u.js";
|
|
15
|
+
import { t as k } from "./svelte-file-Dv5-bl79.js";
|
|
16
|
+
import { a as A, r as j, s as M, t as ee } from "./root-layout.svelte-CUVbnlX-.js";
|
|
17
|
+
import { n as N, t as P } from "./wuchale-config-c3Q4JVSF.js";
|
|
18
|
+
import { t as F } from "./modify-user-signup-DLtopazD.js";
|
|
19
|
+
import { i as I, r as L } from "./collections-BYcVyY9O.js";
|
|
20
|
+
import R from "node:fs";
|
|
21
|
+
import z from "node:path";
|
|
22
|
+
import B from "stripe";
|
|
23
23
|
//#region src/patterns/enable/payments/runtime/setup-shopify.ts
|
|
24
|
-
async function
|
|
25
|
-
let t =
|
|
24
|
+
async function V(e) {
|
|
25
|
+
let t = l(e), n = typeof e.input.demoId == "string" ? e.input.demoId.trim() : "", r = [];
|
|
26
26
|
return n && (t.info("Creating payment +page.svelte"), r.push({
|
|
27
27
|
path: "src/routes/(public)/payment/+page.svelte",
|
|
28
28
|
language: "svelte",
|
|
29
|
-
content:
|
|
29
|
+
content: m(n),
|
|
30
30
|
status: "success"
|
|
31
31
|
})), {
|
|
32
32
|
creates: r,
|
|
@@ -41,24 +41,24 @@ async function I(e) {
|
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
43
|
//#region src/patterns/enable/payments/modifies/modify-nav-user.ts
|
|
44
|
-
var
|
|
44
|
+
var H = [
|
|
45
45
|
"import CreditCardIcon from '@lucide/svelte/icons/credit-card';",
|
|
46
46
|
"",
|
|
47
47
|
"// Add to your navUser array:",
|
|
48
48
|
"{ title: 'Billing', url: '/billing', icon: CreditCardIcon }"
|
|
49
|
-
].join("\n"),
|
|
49
|
+
].join("\n"), U = [
|
|
50
50
|
"Add a Billing nav item to nav-user.svelte:",
|
|
51
51
|
"",
|
|
52
|
-
|
|
53
|
-
].join("\n"),
|
|
52
|
+
H
|
|
53
|
+
].join("\n"), W = [
|
|
54
54
|
"Create nav-user.svelte with a Billing entry:",
|
|
55
55
|
"",
|
|
56
|
-
|
|
56
|
+
H
|
|
57
57
|
].join("\n");
|
|
58
|
-
function
|
|
59
|
-
let a = new
|
|
58
|
+
function G(e, t, n, r, i) {
|
|
59
|
+
let a = new k(e), o = !1, s = (e) => {
|
|
60
60
|
o || e((e) => {
|
|
61
|
-
let a =
|
|
61
|
+
let a = E(e, t, n, r, i);
|
|
62
62
|
return a.wasAdded && (o = !0), a.source;
|
|
63
63
|
});
|
|
64
64
|
};
|
|
@@ -67,29 +67,29 @@ function B(e, t, n, r, i) {
|
|
|
67
67
|
wasAdded: o
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
if (!
|
|
70
|
+
function K(e) {
|
|
71
|
+
if (!R.existsSync(e)) return {
|
|
72
72
|
status: "not-found",
|
|
73
|
-
message:
|
|
73
|
+
message: W
|
|
74
74
|
};
|
|
75
|
-
let t =
|
|
75
|
+
let t = R.readFileSync(e, "utf8");
|
|
76
76
|
if (t.includes("/billing")) return {
|
|
77
77
|
status: "success",
|
|
78
78
|
changed: !1
|
|
79
79
|
};
|
|
80
|
-
let { newNavUserSnippet: n, wasAdded: r } =
|
|
81
|
-
return r ? (
|
|
80
|
+
let { newNavUserSnippet: n, wasAdded: r } = G(t, "Billing", "/billing", "CreditCardIcon", "@lucide/svelte/icons/credit-card");
|
|
81
|
+
return r ? (R.writeFileSync(e, n, "utf8"), {
|
|
82
82
|
status: "success",
|
|
83
83
|
changed: !0
|
|
84
84
|
}) : {
|
|
85
85
|
status: "failed",
|
|
86
|
-
message:
|
|
86
|
+
message: U
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
//#endregion
|
|
90
90
|
//#region src/patterns/enable/payments/runtime/stripe.ts
|
|
91
|
-
async function
|
|
92
|
-
let r = new
|
|
91
|
+
async function q(e, t, n) {
|
|
92
|
+
let r = new B(t), i = await e.collection("users").getFullList(), a = await e.collection("stripe_customers").getFullList(), o = new Set(a.map((e) => e.user)), s = {
|
|
93
93
|
total: i.length,
|
|
94
94
|
linked: o.size,
|
|
95
95
|
created: 0,
|
|
@@ -141,8 +141,8 @@ async function H(e, t, n) {
|
|
|
141
141
|
}
|
|
142
142
|
return s;
|
|
143
143
|
}
|
|
144
|
-
async function
|
|
145
|
-
let t = new
|
|
144
|
+
async function J(e) {
|
|
145
|
+
let t = new B(e), n = await t.products.search({
|
|
146
146
|
query: "name:\"Test Product\" AND metadata[\"test\"]:\"true\"",
|
|
147
147
|
limit: 1
|
|
148
148
|
});
|
|
@@ -172,8 +172,8 @@ async function U(e) {
|
|
|
172
172
|
existing: !1
|
|
173
173
|
};
|
|
174
174
|
}
|
|
175
|
-
async function
|
|
176
|
-
let n = new
|
|
175
|
+
async function Y(e, t) {
|
|
176
|
+
let n = new B(e), r = await n.prices.retrieve(t, { expand: ["product"] }), i = typeof r.product == "string" ? await n.products.retrieve(r.product) : r.product;
|
|
177
177
|
return r.product = i.id, {
|
|
178
178
|
product: i,
|
|
179
179
|
price: r,
|
|
@@ -182,35 +182,35 @@ async function W(e, t) {
|
|
|
182
182
|
}
|
|
183
183
|
//#endregion
|
|
184
184
|
//#region src/patterns/enable/payments/runtime/setup-stripe.ts
|
|
185
|
-
var
|
|
186
|
-
async function
|
|
185
|
+
var X;
|
|
186
|
+
async function Z(e, n, r, i, a = !0) {
|
|
187
187
|
if (!a) return;
|
|
188
|
-
await
|
|
189
|
-
let o =
|
|
188
|
+
await v();
|
|
189
|
+
let o = y(n, r, i);
|
|
190
190
|
o && e.push({
|
|
191
191
|
path: o,
|
|
192
192
|
language: t(o),
|
|
193
|
-
content:
|
|
193
|
+
content: R.readFileSync(o, "utf8"),
|
|
194
194
|
status: "success"
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
return
|
|
197
|
+
function Q(e) {
|
|
198
|
+
return s(X ||= c(["\n <script lang=\"ts\">\n import PaymentButton from '#lib/components/payments/payment-button.svelte';\n <\/script>\n\n <section data-role=\"content\">\n <PaymentButton priceId=\"", "\" />\n </section>\n "]), e);
|
|
199
199
|
}
|
|
200
|
-
async function
|
|
201
|
-
let t =
|
|
200
|
+
async function te(e) {
|
|
201
|
+
let t = o(e).STRIPE_SECRET_KEY ?? "", n = typeof e.input.demoId == "string" && e.input.demoId !== "" ? e.input.demoId : void 0, r = e.features.auth, i = l(e), a = [], s = [], c = (e) => {
|
|
202
202
|
e && s.push(e);
|
|
203
203
|
};
|
|
204
|
-
await
|
|
205
|
-
let
|
|
206
|
-
for (let t of [
|
|
204
|
+
await _(e.root, async (n) => {
|
|
205
|
+
let o = (e) => L(n, e, i);
|
|
206
|
+
for (let t of [h, g]) {
|
|
207
207
|
i.info(`Creating ${t.name} collection`);
|
|
208
|
-
let r = await
|
|
209
|
-
await
|
|
208
|
+
let r = await o(t);
|
|
209
|
+
await Z(a, t.name, "created", e, r.created), r.created || a.push(...await I(n, t, e, i));
|
|
210
210
|
}
|
|
211
211
|
if (r) {
|
|
212
212
|
i.info("Creating stripe_customers collection");
|
|
213
|
-
let r = await
|
|
213
|
+
let r = await o({
|
|
214
214
|
name: "stripe_customers",
|
|
215
215
|
type: "base",
|
|
216
216
|
fields: [
|
|
@@ -244,8 +244,8 @@ async function J(e) {
|
|
|
244
244
|
}
|
|
245
245
|
]
|
|
246
246
|
}), s = r.collection;
|
|
247
|
-
await
|
|
248
|
-
let c = await
|
|
247
|
+
await Z(a, "stripe_customers", "created", e, r.created), i.info("Creating stripe_payment_methods collection");
|
|
248
|
+
let c = await o({
|
|
249
249
|
name: "stripe_payment_methods",
|
|
250
250
|
type: "base",
|
|
251
251
|
fields: [
|
|
@@ -300,7 +300,7 @@ async function J(e) {
|
|
|
300
300
|
}
|
|
301
301
|
]
|
|
302
302
|
}), l = c.collection;
|
|
303
|
-
await
|
|
303
|
+
await Z(a, "stripe_payment_methods", "created", e, c.created), i.info("Linking default_payment_method on stripe_customers"), await n.collections.update("stripe_customers", { fields: [
|
|
304
304
|
{
|
|
305
305
|
name: "id",
|
|
306
306
|
pattern: "^[a-zA-Z0-9_]+$",
|
|
@@ -337,8 +337,8 @@ async function J(e) {
|
|
|
337
337
|
onUpdate: !0,
|
|
338
338
|
type: "autodate"
|
|
339
339
|
}
|
|
340
|
-
] }), await
|
|
341
|
-
let u = await
|
|
340
|
+
] }), await Z(a, "stripe_customers", "updated", e), i.info("Creating transactions collection");
|
|
341
|
+
let u = await o({
|
|
342
342
|
name: "transactions",
|
|
343
343
|
type: "base",
|
|
344
344
|
fields: [
|
|
@@ -408,13 +408,13 @@ async function J(e) {
|
|
|
408
408
|
}
|
|
409
409
|
]
|
|
410
410
|
});
|
|
411
|
-
await
|
|
412
|
-
let d = await
|
|
411
|
+
await Z(a, "transactions", "created", e, u.created), i.info("Syncing existing PocketBase users to Stripe customers");
|
|
412
|
+
let d = await q(n, t, i);
|
|
413
413
|
i.info(`Synced ${d.total} users (created ${d.created}, reused ${d.reused}, skipped ${d.skipped})`);
|
|
414
414
|
}
|
|
415
415
|
}), n ? i.info(`Fetching Stripe product/price ${n}`) : i.info("Creating test Stripe product and price");
|
|
416
|
-
let { product: u, price: d, existing:
|
|
417
|
-
if (
|
|
416
|
+
let { product: u, price: d, existing: f } = n ? await Y(t, n) : await J(t);
|
|
417
|
+
if (f && i.info("Stripe product/price already exists, skipping creation"), i.info("Seeding Stripe product/price records"), await _(e.root, async (e) => {
|
|
418
418
|
try {
|
|
419
419
|
await e.collection("stripe_products").getOne(u.id);
|
|
420
420
|
} catch {
|
|
@@ -439,20 +439,20 @@ async function J(e) {
|
|
|
439
439
|
active: d.active
|
|
440
440
|
});
|
|
441
441
|
}
|
|
442
|
-
}), i.info("Creating payment +page.svelte"),
|
|
442
|
+
}), i.info("Creating payment +page.svelte"), a.push({
|
|
443
443
|
path: "src/routes/(public)/payment/+page.svelte",
|
|
444
444
|
language: "svelte",
|
|
445
|
-
content:
|
|
445
|
+
content: Q(d.id),
|
|
446
446
|
status: "success"
|
|
447
447
|
}), r) {
|
|
448
448
|
i.info("Modifying nav-user.svelte");
|
|
449
|
-
let t =
|
|
450
|
-
|
|
451
|
-
let n =
|
|
452
|
-
|
|
449
|
+
let t = z.join(e.root, "src", "lib", "components", "nav-user.svelte");
|
|
450
|
+
c(D(t, K(t))), i.info("Modifying signup +page.server.ts");
|
|
451
|
+
let n = z.join(e.root, "src", "routes", "(public)", "(auth)", "signup", "+page.server.ts");
|
|
452
|
+
c(D(n, F(n)));
|
|
453
453
|
}
|
|
454
454
|
return {
|
|
455
|
-
creates:
|
|
455
|
+
creates: a,
|
|
456
456
|
modifies: s,
|
|
457
457
|
deletes: [],
|
|
458
458
|
components: [],
|
|
@@ -464,15 +464,15 @@ async function J(e) {
|
|
|
464
464
|
}
|
|
465
465
|
//#endregion
|
|
466
466
|
//#region src/patterns/enable/payments/runtime/setup-whatsapp.ts
|
|
467
|
-
async function
|
|
467
|
+
async function ne(t, n) {
|
|
468
468
|
if (!n.currency) {
|
|
469
469
|
let n = t.input.currency;
|
|
470
470
|
throw new e(n === void 0 || n === "" ? "Payments on WhatsApp need the business's currency, the one it prices in (an ISO 4217 code such as MXN or EUR). Pass --currency, or set `currency` in src/lib/site.ts." : `${String(n)} is not an ISO 4217 currency code, such as MXN or EUR.`);
|
|
471
471
|
}
|
|
472
|
-
let r = [], i =
|
|
473
|
-
if (
|
|
474
|
-
|
|
475
|
-
let e =
|
|
472
|
+
let r = [], i = z.join(t.root, "wuchale.config.js");
|
|
473
|
+
if (R.existsSync(i)) {
|
|
474
|
+
l(t).info("Adding src/lib/order.ts to wuchale's js adapter");
|
|
475
|
+
let e = D(i, N(i, P));
|
|
476
476
|
e && r.push(e);
|
|
477
477
|
}
|
|
478
478
|
return {
|
|
@@ -488,44 +488,63 @@ async function Y(t, n) {
|
|
|
488
488
|
}
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/patterns/enable/payments/generate.runtime.ts
|
|
491
|
-
|
|
491
|
+
var re = /* #__PURE__ */ Object.assign({
|
|
492
|
+
"./creates-server/src/lib/currency.server.test.ts": d,
|
|
493
|
+
"./creates-server/src/lib/currency.server.ts": p
|
|
494
|
+
});
|
|
495
|
+
function ie(e) {
|
|
496
|
+
return Object.values(r(re, "./creates-server/")).filter((t) => e || !t.path.endsWith(".test.ts")).sort((e, t) => e.path.localeCompare(t.path));
|
|
497
|
+
}
|
|
498
|
+
function $(e) {
|
|
492
499
|
try {
|
|
493
|
-
let t = JSON.parse(
|
|
500
|
+
let t = JSON.parse(R.readFileSync(z.join(e, "package.json"), "utf8"));
|
|
494
501
|
return !!(t.devDependencies?.vitest || t.dependencies?.vitest);
|
|
495
502
|
} catch {
|
|
496
503
|
return !1;
|
|
497
504
|
}
|
|
498
505
|
}
|
|
499
|
-
async function
|
|
500
|
-
let t =
|
|
501
|
-
e &&
|
|
506
|
+
async function ae(e) {
|
|
507
|
+
let t = l(e), r = a(f, e), s = [], c = [], d = (e) => {
|
|
508
|
+
e && c.push(e);
|
|
502
509
|
};
|
|
503
|
-
t.info(`Writing ${
|
|
504
|
-
let p =
|
|
505
|
-
|
|
506
|
-
let m =
|
|
507
|
-
m.create && s.push(m.create),
|
|
508
|
-
let { currency: h, country: g, currencies:
|
|
509
|
-
currency:
|
|
510
|
-
country:
|
|
511
|
-
currencies:
|
|
510
|
+
t.info(`Writing ${r.label} credentials to .env`);
|
|
511
|
+
let p = z.join(e.root, ".env");
|
|
512
|
+
d(D(p, T(p, u(r, o(e))))), t.info(`Declaring ${r.label} variables in src/env.ts`);
|
|
513
|
+
let m = O(e.root, i(r));
|
|
514
|
+
m.create && s.push(m.create), d(m.modify);
|
|
515
|
+
let { currency: h, country: g, currencies: _ } = e.input, v = R.existsSync(C(e.root)), { file: y, business: E } = await w(e, {
|
|
516
|
+
currency: b(h) ?? void 0,
|
|
517
|
+
country: S(g) ?? void 0,
|
|
518
|
+
currencies: x(_, b(h) ?? void 0) ?? void 0
|
|
512
519
|
});
|
|
513
|
-
|
|
514
|
-
let
|
|
515
|
-
|
|
516
|
-
let
|
|
520
|
+
y && (v ? c : s).push(y), t.info("Adding the currency select to the navbar");
|
|
521
|
+
let k = z.join(e.root, "src", "routes", "(public)", "root-layout.svelte");
|
|
522
|
+
d(D(k, ee(k)));
|
|
523
|
+
let N = z.join(e.root, "src", "routes", "+layout.server.ts");
|
|
524
|
+
if (R.existsSync(N)) {
|
|
525
|
+
t.info("Resolving the visitor's currency on the server");
|
|
526
|
+
let n = A(N);
|
|
527
|
+
if (d(D(N, n)), n.status === "success") {
|
|
528
|
+
let t = z.join(e.root, "src", "hooks.server.ts");
|
|
529
|
+
d(D(t, M(t)));
|
|
530
|
+
let n = z.join(e.root, "src", "routes", "+layout.svelte");
|
|
531
|
+
d(D(n, j(n)));
|
|
532
|
+
for (let t of ie($(e.root))) s.push(t);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
let P = {
|
|
517
536
|
creates: s,
|
|
518
|
-
modifies:
|
|
537
|
+
modifies: c,
|
|
519
538
|
deletes: [],
|
|
520
539
|
components: [],
|
|
521
540
|
packages: [],
|
|
522
541
|
collections: [],
|
|
523
542
|
collectionPatches: [],
|
|
524
543
|
collectionDrops: []
|
|
525
|
-
},
|
|
526
|
-
return n([
|
|
544
|
+
}, F = r.id === "stripe" ? await te(e) : r.id === "shopify" ? await V(e) : await ne(e, E);
|
|
545
|
+
return n([P, F]);
|
|
527
546
|
}
|
|
528
547
|
//#endregion
|
|
529
|
-
export {
|
|
548
|
+
export { ae as generate, $ as hasVitest };
|
|
530
549
|
|
|
531
|
-
//# sourceMappingURL=generate.runtime-
|
|
550
|
+
//# sourceMappingURL=generate.runtime-X-uAteso.js.map
|