astro-tractstack 2.3.0 → 2.3.2

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 (95) hide show
  1. package/README.md +1 -1
  2. package/bin/create-tractstack.js +2 -2
  3. package/dist/index.js +130 -19
  4. package/package.json +2 -2
  5. package/templates/custom/minimal/CodeHook.astro +10 -2
  6. package/templates/custom/shopify/Cart.tsx +115 -77
  7. package/templates/custom/shopify/CheckoutModal.tsx +509 -120
  8. package/templates/custom/shopify/NativeBookingCalendar.tsx +375 -0
  9. package/templates/custom/shopify/ShopifyCartManager.tsx +91 -45
  10. package/templates/custom/shopify/ShopifyCheckout.tsx +4 -33
  11. package/templates/custom/shopify/ShopifyProductGrid.tsx +170 -176
  12. package/templates/custom/shopify/ShopifyServiceList.tsx +112 -51
  13. package/templates/custom/with-examples/CodeHook.astro +10 -2
  14. package/templates/src/components/Footer.astro +6 -6
  15. package/templates/src/components/Header.astro +23 -11
  16. package/templates/src/components/Menu.tsx +157 -135
  17. package/templates/src/components/codehooks/BunnyVideoSetup.tsx +2 -2
  18. package/templates/src/components/codehooks/EpinetDurationSelector.tsx +27 -6
  19. package/templates/src/components/codehooks/EpinetTableView.tsx +153 -112
  20. package/templates/src/components/codehooks/EpinetWrapper.tsx +4 -1
  21. package/templates/src/components/codehooks/FeaturedArticleSetup.tsx +8 -1
  22. package/templates/src/components/codehooks/ProductCardSetup.tsx +9 -1
  23. package/templates/src/components/codehooks/ProductGridSetup.tsx +9 -1
  24. package/templates/src/components/compositor/nodes/BgPaneWrapper.tsx +2 -1
  25. package/templates/src/components/compositor/nodes/GhostInsertBlock.tsx +1 -1
  26. package/templates/src/components/edit/ToolBar.tsx +2 -1
  27. package/templates/src/components/edit/context/ContextPaneConfig_slug.tsx +2 -2
  28. package/templates/src/components/edit/pane/AddPanePanel_codehook.tsx +13 -0
  29. package/templates/src/components/edit/pane/AddPanePanel_new.tsx +3 -3
  30. package/templates/src/components/edit/pane/AddPanePanel_newCustomCopy.tsx +2 -2
  31. package/templates/src/components/edit/pane/AiRestylePaneModal.tsx +2 -2
  32. package/templates/src/components/edit/pane/ConfigPanePanel.tsx +1 -1
  33. package/templates/src/components/edit/pane/steps/AiCreativeDesignStep.tsx +2 -2
  34. package/templates/src/components/edit/pane/steps/AiLibraryCopyStep.tsx +3 -3
  35. package/templates/src/components/edit/pane/steps/AiRefineDesignStep.tsx +2 -2
  36. package/templates/src/components/edit/pane/steps/AiStandardDesignStep.tsx +7 -7
  37. package/templates/src/components/edit/state/SaveModal.tsx +1 -1
  38. package/templates/src/components/edit/widgets/InteractiveDisclosureWidget.tsx +8 -3
  39. package/templates/src/components/form/DateTimeInput.tsx +10 -3
  40. package/templates/src/components/form/FileUpload.tsx +11 -5
  41. package/templates/src/components/form/NumberInput.tsx +2 -2
  42. package/templates/src/components/form/advanced/APIConfigSection.tsx +208 -2
  43. package/templates/src/components/form/brand/SiteConfigSection.tsx +10 -0
  44. package/templates/src/components/form/shopify/SchedulingSection.tsx +354 -0
  45. package/templates/src/components/storykeep/Dashboard.tsx +1 -1
  46. package/templates/src/components/storykeep/Dashboard_Shopify.tsx +252 -110
  47. package/templates/src/components/storykeep/controls/content/BeliefForm.tsx +2 -2
  48. package/templates/src/components/storykeep/controls/content/BeliefTable.tsx +14 -5
  49. package/templates/src/components/storykeep/controls/content/KnownResourceTable.tsx +5 -2
  50. package/templates/src/components/storykeep/controls/content/MenuTable.tsx +14 -5
  51. package/templates/src/components/storykeep/controls/content/ProductTable.tsx +180 -101
  52. package/templates/src/components/storykeep/controls/content/ResourceBulkIngest.tsx +88 -56
  53. package/templates/src/components/storykeep/controls/content/ResourceTable.tsx +14 -4
  54. package/templates/src/components/storykeep/controls/content/StoryFragmentTable.tsx +14 -5
  55. package/templates/src/components/storykeep/email-builder/Blocks.tsx +169 -0
  56. package/templates/src/components/storykeep/email-builder/EmailBuilder.tsx +223 -0
  57. package/templates/src/components/storykeep/email-builder/PreviewModal.tsx +136 -0
  58. package/templates/src/components/storykeep/email-builder/PropertyPanel.tsx +154 -0
  59. package/templates/src/components/storykeep/shopify/ShopifyDashboard.tsx +104 -0
  60. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Bookings.tsx +419 -0
  61. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Emails.tsx +105 -0
  62. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Products.tsx +46 -0
  63. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Schedule.tsx +78 -0
  64. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Search.tsx +55 -0
  65. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Services.tsx +47 -0
  66. package/templates/src/layouts/Layout.astro +8 -5
  67. package/templates/src/pages/api/auth/lookup-lead.ts +72 -0
  68. package/templates/src/pages/api/booking/availability.ts +72 -0
  69. package/templates/src/pages/api/booking/cancel.ts +73 -0
  70. package/templates/src/pages/api/booking/confirm.ts +82 -0
  71. package/templates/src/pages/api/booking/hold.ts +75 -0
  72. package/templates/src/pages/api/booking/list.ts +66 -0
  73. package/templates/src/pages/api/booking/metrics.ts +60 -0
  74. package/templates/src/pages/api/booking/release.ts +76 -0
  75. package/templates/src/pages/api/sandbox.ts +2 -2
  76. package/templates/src/pages/api/shopify/createCart.ts +4 -8
  77. package/templates/src/pages/api/shopify/getProducts.ts +15 -15
  78. package/templates/src/pages/storykeep/login.astro +21 -14
  79. package/templates/src/stores/shopify.ts +97 -25
  80. package/templates/src/types/formTypes.ts +4 -2
  81. package/templates/src/types/tractstack.ts +59 -2
  82. package/templates/src/utils/api/advancedConfig.ts +2 -0
  83. package/templates/src/utils/api/advancedHelpers.ts +40 -3
  84. package/templates/src/utils/api/bookingHelpers.ts +125 -0
  85. package/templates/src/utils/api/brandConfig.ts +2 -0
  86. package/templates/src/utils/api/brandHelpers.ts +26 -0
  87. package/templates/src/utils/api/emailHelpers.ts +105 -0
  88. package/templates/src/utils/auth.ts +29 -9
  89. package/templates/src/utils/compositor/aiGeneration.ts +3 -3
  90. package/templates/src/utils/compositor/aiPaneParser.ts +2 -2
  91. package/templates/src/utils/customHelpers.ts +0 -21
  92. package/templates/src/utils/profileStorage.ts +5 -0
  93. package/templates/src/utils/tenantResolver.ts +3 -2
  94. package/utils/inject-files.ts +116 -5
  95. package/templates/custom/shopify/CalDotComBooking.tsx +0 -44
@@ -73,27 +73,6 @@ export function checkRestrictions(resource: ResourceNode): boolean {
73
73
  return false;
74
74
  }
75
75
 
76
- export const MAX_LENGTH_MINUTES = 180;
77
-
78
- export const BOOKING_LINK_INCREMENTS = [30, 60, 90, 120, 150, 180];
79
-
80
- export const BOOKING_LINKS: Record<number, string> = {
81
- 30: '30min',
82
- 60: '60min',
83
- 90: '90min',
84
- 120: '120min',
85
- 150: '150min',
86
- 180: '180min',
87
- };
88
-
89
- export function getBookingBucket(minutes: number): string | null {
90
- if (minutes <= 0) return null;
91
- if (minutes > MAX_LENGTH_MINUTES) return null;
92
-
93
- const bucket = BOOKING_LINK_INCREMENTS.find((inc) => minutes <= inc);
94
- return bucket ? BOOKING_LINKS[bucket] : null;
95
- }
96
-
97
76
  export function calculateCartDuration(
98
77
  cart: Record<string, CartItemState>,
99
78
  resources: ResourceNode[]
@@ -1,3 +1,5 @@
1
+ import { clearCommerceState } from '@/stores/shopify';
2
+
1
3
  export interface ProfileData {
2
4
  firstname?: string;
3
5
  contactPersona?: string;
@@ -148,6 +150,7 @@ export class ProfileStorage {
148
150
  StorageManager.set(this.STORAGE_KEYS.profileToken, token);
149
151
  StorageManager.set(this.STORAGE_KEYS.hasProfile, '1');
150
152
  StorageManager.set(this.STORAGE_KEYS.unlockedProfile, '1');
153
+ StorageManager.remove('shopify_customer');
151
154
 
152
155
  try {
153
156
  const maxAge = 60 * 60 * 24;
@@ -205,6 +208,7 @@ export class ProfileStorage {
205
208
  }
206
209
 
207
210
  console.log('TractStack: Session cleared completely including session ID');
211
+ clearCommerceState();
208
212
  }
209
213
 
210
214
  /**
@@ -218,6 +222,7 @@ export class ProfileStorage {
218
222
  StorageManager.remove(this.STORAGE_KEYS.contactPersona);
219
223
  StorageManager.remove(this.STORAGE_KEYS.email);
220
224
  StorageManager.remove(this.STORAGE_KEYS.shortBio);
225
+ clearCommerceState();
221
226
  }
222
227
 
223
228
  /**
@@ -1,4 +1,4 @@
1
- const VERBOSE = false;
1
+ const VERBOSE = true;
2
2
 
3
3
  interface TenantResolution {
4
4
  id: string;
@@ -65,13 +65,14 @@ export async function resolveTenantId(
65
65
  // Strategy 3: Backend Lookup (Fallback - Network Request)
66
66
  try {
67
67
  const backendUrl =
68
- import.meta.env.PUBLIC_GO_BACKEND || 'http://localhost:10000';
68
+ import.meta.env.PUBLIC_GO_BACKEND || 'http://localhost:8080';
69
69
  const urlObj = new URL(backendUrl);
70
70
  // Force localhost to avoid Hairpin NAT / Loopback firewall blocks
71
71
  const localBackend = `${urlObj.protocol}//127.0.0.1:${urlObj.port}`;
72
72
 
73
73
  if (VERBOSE) console.log(`[TenantResolver] Fetching from: ${localBackend}`);
74
74
 
75
+ console.log(`[TenantResolver] Activating local bypass`);
75
76
  // Temporarily disable TLS validation because 127.0.0.1 won't match the cert
76
77
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
77
78
 
@@ -822,6 +822,10 @@ export async function injectTemplateFiles(
822
822
  src: resolve('../templates/src/utils/api/resourceHelpers.ts'),
823
823
  dest: 'src/utils/api/resourceHelpers.ts',
824
824
  },
825
+ {
826
+ src: resolve('../templates/src/utils/api/bookingHelpers.ts'),
827
+ dest: 'src/utils/api/bookingHelpers.ts',
828
+ },
825
829
  {
826
830
  src: resolve('../templates/src/utils/api/menuHelpers.ts'),
827
831
  dest: 'src/utils/api/menuHelpers.ts',
@@ -948,6 +952,38 @@ export async function injectTemplateFiles(
948
952
  },
949
953
 
950
954
  // API Routes
955
+ {
956
+ src: resolve('../templates/src/pages/api/booking/list.ts'),
957
+ dest: 'src/pages/api/booking/list.ts',
958
+ },
959
+ {
960
+ src: resolve('../templates/src/pages/api/booking/metrics.ts'),
961
+ dest: 'src/pages/api/booking/metrics.ts',
962
+ },
963
+ {
964
+ src: resolve('../templates/src/pages/api/booking/cancel.ts'),
965
+ dest: 'src/pages/api/booking/cancel.ts',
966
+ },
967
+ {
968
+ src: resolve('../templates/src/pages/api/booking/confirm.ts'),
969
+ dest: 'src/pages/api/booking/confirm.ts',
970
+ },
971
+ {
972
+ src: resolve('../templates/src/pages/api/booking/release.ts'),
973
+ dest: 'src/pages/api/booking/release.ts',
974
+ },
975
+ {
976
+ src: resolve('../templates/src/pages/api/booking/availability.ts'),
977
+ dest: 'src/pages/api/booking/availability.ts',
978
+ },
979
+ {
980
+ src: resolve('../templates/src/pages/api/booking/hold.ts'),
981
+ dest: 'src/pages/api/booking/hold.ts',
982
+ },
983
+ {
984
+ src: resolve('../templates/src/pages/api/auth/lookup-lead.ts'),
985
+ dest: 'src/pages/api/auth/lookup-lead.ts',
986
+ },
951
987
  {
952
988
  src: resolve('../templates/src/pages/api/auth/profile.ts'),
953
989
  dest: 'src/pages/api/auth/profile.ts',
@@ -1132,6 +1168,12 @@ export async function injectTemplateFiles(
1132
1168
  src: resolve('../templates/src/components/form/brand/SEOSection.tsx'),
1133
1169
  dest: 'src/components/form/brand/SEOSection.tsx',
1134
1170
  },
1171
+ {
1172
+ src: resolve(
1173
+ '../templates/src/components/form/shopify/SchedulingSection.tsx'
1174
+ ),
1175
+ dest: 'src/components/form/shopify/SchedulingSection.tsx',
1176
+ },
1135
1177
 
1136
1178
  // Advanced Configuration Components
1137
1179
  {
@@ -1186,6 +1228,72 @@ export async function injectTemplateFiles(
1186
1228
  ),
1187
1229
  dest: 'src/components/storykeep/Dashboard_Shopify.tsx',
1188
1230
  },
1231
+ {
1232
+ src: resolve(
1233
+ '../templates/src/components/storykeep/shopify/ShopifyDashboard.tsx'
1234
+ ),
1235
+ dest: 'src/components/storykeep/shopify/ShopifyDashboard.tsx',
1236
+ },
1237
+ {
1238
+ src: resolve(
1239
+ '../templates/src/components/storykeep/shopify/ShopifyDashboard_Bookings.tsx'
1240
+ ),
1241
+ dest: 'src/components/storykeep/shopify/ShopifyDashboard_Bookings.tsx',
1242
+ },
1243
+ {
1244
+ src: resolve(
1245
+ '../templates/src/components/storykeep/shopify/ShopifyDashboard_Schedule.tsx'
1246
+ ),
1247
+ dest: 'src/components/storykeep/shopify/ShopifyDashboard_Schedule.tsx',
1248
+ },
1249
+ {
1250
+ src: resolve(
1251
+ '../templates/src/components/storykeep/shopify/ShopifyDashboard_Products.tsx'
1252
+ ),
1253
+ dest: 'src/components/storykeep/shopify/ShopifyDashboard_Products.tsx',
1254
+ },
1255
+ {
1256
+ src: resolve(
1257
+ '../templates/src/components/storykeep/shopify/ShopifyDashboard_Services.tsx'
1258
+ ),
1259
+ dest: 'src/components/storykeep/shopify/ShopifyDashboard_Services.tsx',
1260
+ },
1261
+ {
1262
+ src: resolve(
1263
+ '../templates/src/components/storykeep/shopify/ShopifyDashboard_Emails.tsx'
1264
+ ),
1265
+ dest: 'src/components/storykeep/shopify/ShopifyDashboard_Emails.tsx',
1266
+ },
1267
+ {
1268
+ src: resolve(
1269
+ '../templates/src/components/storykeep/email-builder/EmailBuilder.tsx'
1270
+ ),
1271
+ dest: 'src/components/storykeep/email-builder/EmailBuilder.tsx',
1272
+ },
1273
+ {
1274
+ src: resolve(
1275
+ '../templates/src/components/storykeep/email-builder/Blocks.tsx'
1276
+ ),
1277
+ dest: 'src/components/storykeep/email-builder/Blocks.tsx',
1278
+ },
1279
+ {
1280
+ src: resolve(
1281
+ '../templates/src/components/storykeep/email-builder/PropertyPanel.tsx'
1282
+ ),
1283
+ dest: 'src/components/storykeep/email-builder/PropertyPanel.tsx',
1284
+ },
1285
+ {
1286
+ src: resolve(
1287
+ '../templates/src/components/storykeep/email-builder/PreviewModal.tsx'
1288
+ ),
1289
+ dest: 'src/components/storykeep/email-builder/PreviewModal.tsx',
1290
+ },
1291
+ {
1292
+ src: resolve(
1293
+ '../templates/src/components/storykeep/shopify/ShopifyDashboard_Search.tsx'
1294
+ ),
1295
+ dest: 'src/components/storykeep/shopify/ShopifyDashboard_Search.tsx',
1296
+ },
1189
1297
  {
1190
1298
  src: resolve(
1191
1299
  '../templates/src/components/storykeep/Dashboard_Analytics.tsx'
@@ -2189,6 +2297,10 @@ export async function injectTemplateFiles(
2189
2297
  src: resolve('../templates/src/utils/api/setupHelpers.ts'),
2190
2298
  dest: 'src/utils/api/setupHelpers.ts',
2191
2299
  },
2300
+ {
2301
+ src: resolve('../templates/src/utils/api/emailHelpers.ts'),
2302
+ dest: 'src/utils/api/emailHelpers.ts',
2303
+ },
2192
2304
  {
2193
2305
  src: resolve(
2194
2306
  '../templates/src/components/storykeep/widgets/HydrateWizard.tsx'
@@ -2275,13 +2387,13 @@ export async function injectTemplateFiles(
2275
2387
  protected: true,
2276
2388
  },
2277
2389
  {
2278
- src: resolve('../templates/custom/shopify/CalDotComBooking.tsx'),
2279
- dest: 'src/custom/shopify/CalDotComBooking.tsx',
2390
+ src: resolve('../templates/custom/shopify/ShopifyCheckout.tsx'),
2391
+ dest: 'src/custom/shopify/ShopifyCheckout.tsx',
2280
2392
  protected: true,
2281
2393
  },
2282
2394
  {
2283
- src: resolve('../templates/custom/shopify/ShopifyCheckout.tsx'),
2284
- dest: 'src/custom/shopify/ShopifyCheckout.tsx',
2395
+ src: resolve('../templates/custom/shopify/NativeBookingCalendar.tsx'),
2396
+ dest: 'src/custom/shopify/NativeBookingCalendar.tsx',
2285
2397
  protected: true,
2286
2398
  },
2287
2399
 
@@ -2387,7 +2499,6 @@ function createPlaceholder(filePath: string): string {
2387
2499
 
2388
2500
  if (filePath.endsWith('.tsx')) {
2389
2501
  return `// TractStack placeholder component
2390
- import React from 'react';
2391
2502
  export default function Placeholder() {
2392
2503
  return <div>TractStack placeholder: ${filePath}</div>;
2393
2504
  }`;
@@ -1,44 +0,0 @@
1
- import { useEffect } from 'react';
2
- import Cal, { getCalApi } from '@calcom/embed-react';
3
-
4
- interface CalDotComBookingProps {
5
- calSlug: string;
6
- traceId: string;
7
- name: string;
8
- email: string;
9
- onSuccess: () => void;
10
- }
11
-
12
- export default function CalDotComBooking({
13
- calSlug,
14
- traceId,
15
- name,
16
- email,
17
- onSuccess,
18
- }: CalDotComBookingProps) {
19
- useEffect(() => {
20
- (async function () {
21
- const cal = await getCalApi();
22
- cal('on', {
23
- action: 'bookingSuccessful',
24
- callback: () => {
25
- onSuccess();
26
- },
27
- });
28
- })();
29
- }, [onSuccess]);
30
-
31
- return (
32
- <Cal
33
- calLink={calSlug}
34
- style={{ width: '100%', height: '100%', overflow: 'hidden' }}
35
- config={{
36
- name,
37
- email,
38
- metadata: {
39
- traceId,
40
- },
41
- }}
42
- />
43
- );
44
- }