astro-tractstack 2.0.31 → 2.0.33

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/index.js CHANGED
@@ -10,7 +10,7 @@ function b(t) {
10
10
  }
11
11
  function g(t, e) {
12
12
  e.info("TractStack configuration applied"), t.enableMultiTenant && e.info("Multi-tenant mode enabled"), t.includeExamples && e.info("Example components will be included");
13
- const c = process.env.PUBLIC_GO_BACKEND, r = process.env.PUBLIC_TENANTID;
13
+ const c = process.env.PUBLIC_GO_BACKEND, o = process.env.PUBLIC_TENANTID;
14
14
  if (!c)
15
15
  e.warn("PUBLIC_GO_BACKEND not set - this will be required at runtime");
16
16
  else
@@ -19,11 +19,11 @@ function g(t, e) {
19
19
  } catch {
20
20
  e.error(`PUBLIC_GO_BACKEND is not a valid URL: ${c}`);
21
21
  }
22
- return r ? /^[a-zA-Z0-9_-]+$/.test(r) ? e.info(`Tenant ID validated: ${r}`) : e.error(`PUBLIC_TENANTID contains invalid characters: ${r}`) : e.warn("PUBLIC_TENANTID not set - this will be required at runtime"), t;
22
+ return o ? /^[a-zA-Z0-9_-]+$/.test(o) ? e.info(`Tenant ID validated: ${o}`) : e.error(`PUBLIC_TENANTID contains invalid characters: ${o}`) : e.warn("PUBLIC_TENANTID not set - this will be required at runtime"), t;
23
23
  }
24
24
  async function w(t, e, c) {
25
25
  e.info("TractStack: Injecting template files");
26
- const r = [
26
+ const o = [
27
27
  // Core Configuration
28
28
  {
29
29
  src: t("../templates/env.example"),
@@ -2053,38 +2053,12 @@ async function w(t, e, c) {
2053
2053
  src: t("../templates/socials/youtube.svg"),
2054
2054
  dest: "public/socials/youtube.svg"
2055
2055
  },
2056
- // Multi-Tenant Features
2057
- {
2058
- src: t("../templates/src/components/tenant/RegistrationForm.tsx"),
2059
- dest: "src/components/tenant/RegistrationForm.tsx"
2060
- },
2061
- {
2062
- src: t("../templates/src/utils/api/tenantConfig.ts"),
2063
- dest: "src/utils/api/tenantConfig.ts"
2064
- },
2065
- {
2066
- src: t("../templates/src/utils/api/tenantHelpers.ts"),
2067
- dest: "src/utils/api/tenantHelpers.ts"
2068
- },
2069
2056
  // Multi-Tenant Features (Conditional)
2070
2057
  ...c?.enableMultiTenant ? [
2071
2058
  // Middleware
2072
2059
  {
2073
2060
  src: t("../templates/src/middleware.ts"),
2074
2061
  dest: "src/middleware.ts"
2075
- },
2076
- // Pages
2077
- {
2078
- src: t("../templates/src/pages/sandbox/register.astro"),
2079
- dest: "src/pages/sandbox/register.astro"
2080
- },
2081
- {
2082
- src: t("../templates/src/pages/sandbox/activate.astro"),
2083
- dest: "src/pages/sandbox/activate.astro"
2084
- },
2085
- {
2086
- src: t("../templates/src/pages/sandbox/success.astro"),
2087
- dest: "src/pages/sandbox/success.astro"
2088
2062
  }
2089
2063
  ] : [],
2090
2064
  // Multi-Tenant Types (Always included due to plan reference)
@@ -2164,12 +2138,12 @@ async function w(t, e, c) {
2164
2138
  }
2165
2139
  ] : []
2166
2140
  ];
2167
- for (const s of r)
2141
+ for (const s of o)
2168
2142
  try {
2169
2143
  const p = i(s.dest);
2170
2144
  n(p) || x(p, { recursive: !0 });
2171
- const o = !s.protected && (s.dest === "tailwind.config.cjs" || s.dest.startsWith("src/components/codehooks/") || s.dest.startsWith("src/components/widgets/") || s.dest.startsWith("src/") || s.dest.startsWith("public/client/") || s.dest === ".gitignore");
2172
- if (!n(s.dest) || o)
2145
+ const r = !s.protected && (s.dest === "tailwind.config.cjs" || s.dest.startsWith("src/components/codehooks/") || s.dest.startsWith("src/components/widgets/") || s.dest.startsWith("src/") || s.dest.startsWith("public/client/") || s.dest === ".gitignore");
2146
+ if (!n(s.dest) || r)
2173
2147
  if (n(s.src))
2174
2148
  k(s.src, s.dest), e.info(`Updated ${s.dest}`);
2175
2149
  else {
@@ -2178,8 +2152,8 @@ async function w(t, e, c) {
2178
2152
  }
2179
2153
  else s.protected ? e.info(`Protected: ${s.dest} (skipped overwrite)`) : e.info(`Skipped existing ${s.dest}`);
2180
2154
  } catch (p) {
2181
- const o = p instanceof Error ? p.message : String(p);
2182
- e.error(`Failed to create ${s.dest}: ${o}`);
2155
+ const r = p instanceof Error ? p.message : String(p);
2156
+ e.error(`Failed to create ${s.dest}: ${r}`);
2183
2157
  }
2184
2158
  }
2185
2159
  function _(t) {
@@ -2198,7 +2172,7 @@ function C(t = {}) {
2198
2172
  return {
2199
2173
  name: "astro-tractstack",
2200
2174
  hooks: {
2201
- "astro:config:setup": async ({ config: c, updateConfig: r, logger: s }) => {
2175
+ "astro:config:setup": async ({ config: c, updateConfig: o, logger: s }) => {
2202
2176
  g(t, s);
2203
2177
  const p = t.enableMultiTenant || !1;
2204
2178
  if (s.info(
@@ -2218,7 +2192,7 @@ function C(t = {}) {
2218
2192
  ), new Error(
2219
2193
  "TractStack requires an SSR adapter. Please add @astrojs/node adapter to your astro.config.mjs"
2220
2194
  );
2221
- r({
2195
+ o({
2222
2196
  vite: {
2223
2197
  define: {
2224
2198
  __TRACTSTACK_VERSION__: JSON.stringify("2.0.0-alpha.1"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-tractstack",
3
- "version": "2.0.31",
3
+ "version": "2.0.33",
4
4
  "description": "Astro integration for TractStack - redeeming the web from boring experiences",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,6 +14,7 @@ import {
14
14
  setViewportMode,
15
15
  settingsPanelStore,
16
16
  pendingHomePageSlugStore,
17
+ saasModalOpenStore,
17
18
  } from '@/stores/storykeep';
18
19
  import { getCtx, ROOT_NODE_NAME } from '@/stores/nodes';
19
20
  import SaveModal from '@/components/edit/state/SaveModal';
@@ -48,7 +49,11 @@ const StoryKeepHeader = ({
48
49
  }, [ctx.history]);
49
50
 
50
51
  const handleSave = () => {
51
- setShowSaveModal(true);
52
+ if (isSandboxMode) {
53
+ saasModalOpenStore.set(true);
54
+ } else {
55
+ setShowSaveModal(true);
56
+ }
52
57
  };
53
58
 
54
59
  const handleCloseSaveModal = () => {
@@ -167,7 +172,7 @@ const StoryKeepHeader = ({
167
172
  </div>
168
173
  )}
169
174
 
170
- {shouldShowSave && !isSandboxMode && (
175
+ {shouldShowSave && (
171
176
  <div className="flex flex-wrap items-center justify-center gap-2 text-sm">
172
177
  <button
173
178
  onClick={handleSave}
@@ -23,6 +23,7 @@ import {
23
23
  import { DirectInjectStep } from './steps/DirectInjectStep';
24
24
  import BooleanToggle from '@/components/form/BooleanToggle';
25
25
  import EnumSelect from '@/components/form/EnumSelect';
26
+ import type { StoryFragmentNode } from '@/types/compositorTypes';
26
27
 
27
28
  type Step =
28
29
  | 'initial'
@@ -306,8 +307,12 @@ const AddPaneNewPanel = ({
306
307
  first ? 'before' : 'after'
307
308
  );
308
309
  });
309
- ctx.notifyNode(`root`);
310
+ const storyFragment = cloneDeep(
311
+ ctx.allNodes.get().get(ownerId)
312
+ ) as StoryFragmentNode;
313
+ ctx.modifyNodes([{ ...storyFragment, isChanged: true }]);
310
314
  }
315
+ ctx.notifyNode(`root`);
311
316
  setParentMode(PaneAddMode.DEFAULT, false);
312
317
  } catch (err) {
313
318
  console.error('Error inserting template:', err);
@@ -1,7 +1,6 @@
1
1
  import type { APIRoute } from '@/types/astro';
2
2
 
3
3
  export const POST: APIRoute = async ({ request }) => {
4
- console.log(1);
5
4
  const goBackend =
6
5
  import.meta.env.PUBLIC_GO_BACKEND || 'http://localhost:8080';
7
6
  const sharedSecret = import.meta.env.PRIVATE_SANDBOX_SECRET;
@@ -9,9 +8,6 @@ export const POST: APIRoute = async ({ request }) => {
9
8
  request.headers.get('X-Tenant-ID') ||
10
9
  import.meta.env.PUBLIC_TENANTID ||
11
10
  'default';
12
- console.log(goBackend);
13
- console.log(sharedSecret);
14
- console.log(tenantId);
15
11
 
16
12
  if (!sharedSecret || sharedSecret === 'false' || sharedSecret === 'true') {
17
13
  return new Response(
@@ -35,12 +31,10 @@ export const POST: APIRoute = async ({ request }) => {
35
31
  { status: 403, headers: { 'Content-Type': 'application/json' } }
36
32
  );
37
33
  }
38
- console.log(profileCookie);
39
34
 
40
35
  try {
41
36
  const body = await request.json();
42
37
  const { action, payload } = body;
43
- console.log(action, payload);
44
38
 
45
39
  if (action !== 'askLemur') {
46
40
  return new Response(
@@ -4,7 +4,9 @@ import Layout from '@/layouts/Layout.astro';
4
4
  import Header from '@/components/Header.astro';
5
5
  import { getFullContentMap } from '@/stores/analytics';
6
6
  import { getBrandConfig } from '@/utils/api/brandConfig';
7
- import { components as codeHookComponents } from '@/custom/CodeHook.astro';
7
+ import CodeHook, {
8
+ components as codeHookComponents,
9
+ } from '@/custom/CodeHook.astro';
8
10
  import StoryKeepHeader from '@/components/edit/Header';
9
11
  import StoryKeepToolBar from '@/components/edit/ToolBar';
10
12
  import StoryKeepToolMode from '@/components/edit/ToolMode';
@@ -62,6 +64,16 @@ const hasProfile = Astro.request.headers
62
64
  isEditor={true}
63
65
  >
64
66
  <SandboxAuthWrapper client:load isServerSideAuthenticated={!!hasProfile} />
67
+
68
+ <CodeHook
69
+ target="get-tractstack"
70
+ options={{
71
+ params: {
72
+ options: JSON.stringify({ isEmbedded: false }),
73
+ },
74
+ }}
75
+ />
76
+
65
77
  <Header
66
78
  title={title}
67
79
  slug="sandbox"
@@ -29,6 +29,8 @@ export const codehookMapStore = atom<string[]>([]);
29
29
 
30
30
  export const pendingHomePageSlugStore = atom<string | null>(null);
31
31
 
32
+ export const saasModalOpenStore = atom<boolean>(false);
33
+
32
34
  // Tool mode types
33
35
  export type ToolModeVal =
34
36
  | 'styles'
@@ -2086,20 +2086,6 @@ export async function injectTemplateFiles(
2086
2086
  src: resolve('../templates/socials/youtube.svg'),
2087
2087
  dest: 'public/socials/youtube.svg',
2088
2088
  },
2089
-
2090
- // Multi-Tenant Features
2091
- {
2092
- src: resolve('../templates/src/components/tenant/RegistrationForm.tsx'),
2093
- dest: 'src/components/tenant/RegistrationForm.tsx',
2094
- },
2095
- {
2096
- src: resolve('../templates/src/utils/api/tenantConfig.ts'),
2097
- dest: 'src/utils/api/tenantConfig.ts',
2098
- },
2099
- {
2100
- src: resolve('../templates/src/utils/api/tenantHelpers.ts'),
2101
- dest: 'src/utils/api/tenantHelpers.ts',
2102
- },
2103
2089
  // Multi-Tenant Features (Conditional)
2104
2090
  ...(config?.enableMultiTenant
2105
2091
  ? [
@@ -2108,19 +2094,6 @@ export async function injectTemplateFiles(
2108
2094
  src: resolve('../templates/src/middleware.ts'),
2109
2095
  dest: 'src/middleware.ts',
2110
2096
  },
2111
- // Pages
2112
- {
2113
- src: resolve('../templates/src/pages/sandbox/register.astro'),
2114
- dest: 'src/pages/sandbox/register.astro',
2115
- },
2116
- {
2117
- src: resolve('../templates/src/pages/sandbox/activate.astro'),
2118
- dest: 'src/pages/sandbox/activate.astro',
2119
- },
2120
- {
2121
- src: resolve('../templates/src/pages/sandbox/success.astro'),
2122
- dest: 'src/pages/sandbox/success.astro',
2123
- },
2124
2097
  ]
2125
2098
  : []),
2126
2099
  // Multi-Tenant Types (Always included due to plan reference)