astro-tractstack 2.3.0 → 2.3.1

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 (63) hide show
  1. package/README.md +1 -1
  2. package/bin/create-tractstack.js +2 -2
  3. package/dist/index.js +94 -16
  4. package/package.json +2 -2
  5. package/templates/custom/minimal/CodeHook.astro +10 -2
  6. package/templates/custom/shopify/Cart.tsx +100 -73
  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 +92 -37
  10. package/templates/custom/shopify/ShopifyProductGrid.tsx +139 -173
  11. package/templates/custom/shopify/ShopifyServiceList.tsx +20 -3
  12. package/templates/custom/with-examples/CodeHook.astro +10 -2
  13. package/templates/src/components/Footer.astro +4 -4
  14. package/templates/src/components/Header.astro +9 -3
  15. package/templates/src/components/edit/pane/AddPanePanel_new.tsx +3 -3
  16. package/templates/src/components/edit/pane/AiRestylePaneModal.tsx +2 -2
  17. package/templates/src/components/edit/pane/steps/AiCreativeDesignStep.tsx +2 -2
  18. package/templates/src/components/edit/pane/steps/AiLibraryCopyStep.tsx +3 -3
  19. package/templates/src/components/edit/pane/steps/AiRefineDesignStep.tsx +2 -2
  20. package/templates/src/components/edit/pane/steps/AiStandardDesignStep.tsx +7 -7
  21. package/templates/src/components/form/advanced/APIConfigSection.tsx +244 -2
  22. package/templates/src/components/form/shopify/SchedulingSection.tsx +354 -0
  23. package/templates/src/components/storykeep/Dashboard.tsx +1 -1
  24. package/templates/src/components/storykeep/Dashboard_Shopify.tsx +253 -110
  25. package/templates/src/components/storykeep/controls/content/BeliefTable.tsx +14 -5
  26. package/templates/src/components/storykeep/controls/content/KnownResourceTable.tsx +5 -2
  27. package/templates/src/components/storykeep/controls/content/MenuTable.tsx +14 -5
  28. package/templates/src/components/storykeep/controls/content/ProductTable.tsx +180 -101
  29. package/templates/src/components/storykeep/controls/content/ResourceBulkIngest.tsx +9 -5
  30. package/templates/src/components/storykeep/controls/content/ResourceTable.tsx +13 -4
  31. package/templates/src/components/storykeep/controls/content/StoryFragmentTable.tsx +14 -5
  32. package/templates/src/components/storykeep/shopify/ShopifyDashboard.tsx +111 -0
  33. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Bookings.tsx +393 -0
  34. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Products.tsx +46 -0
  35. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Schedule.tsx +78 -0
  36. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Search.tsx +55 -0
  37. package/templates/src/components/storykeep/shopify/ShopifyDashboard_Services.tsx +47 -0
  38. package/templates/src/pages/api/auth/lookup-lead.ts +72 -0
  39. package/templates/src/pages/api/booking/availability.ts +72 -0
  40. package/templates/src/pages/api/booking/cancel.ts +73 -0
  41. package/templates/src/pages/api/booking/confirm.ts +82 -0
  42. package/templates/src/pages/api/booking/hold.ts +75 -0
  43. package/templates/src/pages/api/booking/list.ts +66 -0
  44. package/templates/src/pages/api/booking/metrics.ts +60 -0
  45. package/templates/src/pages/api/booking/release.ts +76 -0
  46. package/templates/src/pages/api/sandbox.ts +2 -2
  47. package/templates/src/pages/api/shopify/createCart.ts +4 -8
  48. package/templates/src/pages/api/shopify/getProducts.ts +15 -15
  49. package/templates/src/pages/storykeep/login.astro +21 -14
  50. package/templates/src/stores/shopify.ts +81 -25
  51. package/templates/src/types/tractstack.ts +54 -0
  52. package/templates/src/utils/api/advancedConfig.ts +2 -0
  53. package/templates/src/utils/api/advancedHelpers.ts +40 -3
  54. package/templates/src/utils/api/bookingHelpers.ts +125 -0
  55. package/templates/src/utils/api/brandHelpers.ts +10 -0
  56. package/templates/src/utils/auth.ts +29 -9
  57. package/templates/src/utils/compositor/aiGeneration.ts +3 -3
  58. package/templates/src/utils/compositor/aiPaneParser.ts +2 -2
  59. package/templates/src/utils/customHelpers.ts +0 -21
  60. package/templates/src/utils/profileStorage.ts +5 -0
  61. package/templates/src/utils/tenantResolver.ts +2 -1
  62. package/utils/inject-files.ts +82 -4
  63. 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
  /**
@@ -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,42 @@ 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_Search.tsx'
1264
+ ),
1265
+ dest: 'src/components/storykeep/shopify/ShopifyDashboard_Search.tsx',
1266
+ },
1189
1267
  {
1190
1268
  src: resolve(
1191
1269
  '../templates/src/components/storykeep/Dashboard_Analytics.tsx'
@@ -2275,13 +2353,13 @@ export async function injectTemplateFiles(
2275
2353
  protected: true,
2276
2354
  },
2277
2355
  {
2278
- src: resolve('../templates/custom/shopify/CalDotComBooking.tsx'),
2279
- dest: 'src/custom/shopify/CalDotComBooking.tsx',
2356
+ src: resolve('../templates/custom/shopify/ShopifyCheckout.tsx'),
2357
+ dest: 'src/custom/shopify/ShopifyCheckout.tsx',
2280
2358
  protected: true,
2281
2359
  },
2282
2360
  {
2283
- src: resolve('../templates/custom/shopify/ShopifyCheckout.tsx'),
2284
- dest: 'src/custom/shopify/ShopifyCheckout.tsx',
2361
+ src: resolve('../templates/custom/shopify/NativeBookingCalendar.tsx'),
2362
+ dest: 'src/custom/shopify/NativeBookingCalendar.tsx',
2285
2363
  protected: true,
2286
2364
  },
2287
2365
 
@@ -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
- }