@stacksjs/defaults 0.70.379 → 0.71.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 (50) hide show
  1. package/app/Actions/Auth/MagicLinkConsumeAction.ts +53 -0
  2. package/app/Actions/Auth/MagicLinkSendAction.ts +35 -0
  3. package/app/Actions/Cms/SitemapAction.ts +23 -2
  4. package/app/Jobs/PublishScheduledPagesJob.ts +26 -0
  5. package/app/Middleware/Site.ts +14 -0
  6. package/app/Middleware.ts +1 -0
  7. package/app/Models/Automation.ts +23 -0
  8. package/app/Models/AutomationRun.ts +26 -0
  9. package/app/Models/Campaign.ts +67 -3
  10. package/app/Models/CampaignSend.ts +90 -6
  11. package/app/Models/CampaignVariant.ts +25 -0
  12. package/app/Models/CommunicationSuppression.ts +22 -0
  13. package/app/Models/ConsentEvent.ts +26 -0
  14. package/app/Models/Content/Menu.ts +56 -0
  15. package/app/Models/Content/MenuItem.ts +91 -0
  16. package/app/Models/Content/Page.ts +111 -14
  17. package/app/Models/Content/PageRevision.ts +86 -0
  18. package/app/Models/Content/Post.ts +24 -9
  19. package/app/Models/Content/Redirect.ts +80 -0
  20. package/app/Models/Forms/Form.ts +91 -0
  21. package/app/Models/Forms/FormField.ts +127 -0
  22. package/app/Models/Forms/FormSubmission.ts +114 -0
  23. package/app/Models/MagicLinkToken.ts +97 -0
  24. package/app/Models/SenderDomain.ts +22 -0
  25. package/app/Models/Site.ts +112 -0
  26. package/app/Models/SiteDomain.ts +74 -0
  27. package/app/Models/SmsOptOut.ts +65 -0
  28. package/app/Models/UsageEvent.ts +24 -0
  29. package/app/Models/commerce/Auction.ts +173 -0
  30. package/app/Models/commerce/AuctionItem.ts +204 -0
  31. package/app/Models/commerce/Bid.ts +129 -0
  32. package/app/Models/commerce/Pledge.ts +112 -0
  33. package/bootstrap.ts +7 -0
  34. package/functions/public-application-url.ts +1 -1
  35. package/ide/vscode/package.json +1 -1
  36. package/package.json +2 -2
  37. package/resources/functions/dashboard/sidebar.ts +109 -3
  38. package/resources/functions/dashboard/toggles.ts +90 -2
  39. package/resources/views/cms/blocks/columns.stx +10 -0
  40. package/resources/views/cms/blocks/cta.stx +8 -0
  41. package/resources/views/cms/blocks/embed.stx +14 -0
  42. package/resources/views/cms/blocks/form.stx +132 -0
  43. package/resources/views/cms/blocks/hero.stx +16 -0
  44. package/resources/views/cms/blocks/image.stx +7 -0
  45. package/resources/views/cms/blocks/rich-text.stx +4 -0
  46. package/resources/views/cms/page.stx +28 -0
  47. package/routes/auth.ts +7 -0
  48. package/routes/forms.ts +110 -0
  49. package/views/auth/magic/[token].stx +88 -0
  50. package/views/dashboard/.discovered-models.json +46 -1
@@ -0,0 +1,88 @@
1
+ <script server>
2
+ import { config } from '@stacksjs/config'
3
+
4
+ /**
5
+ * The magic-link interstitial. The email's GET lands here and this page
6
+ * POSTs the token to the consume endpoint - a GET must never consume,
7
+ * because mail-security scanners prefetch links and would burn the
8
+ * single-use token before the person ever taps it.
9
+ *
10
+ * `confirmInteraction` renders a button instead of auto-submitting, for
11
+ * environments whose scanners execute page scripts too.
12
+ */
13
+ const autoConsume = config.auth.magicLink?.confirmInteraction !== true
14
+ </script>
15
+
16
+ <script client>
17
+ const route = useRoute()
18
+ const status = state('ready') // ready | working | done | failed
19
+ const message = state('')
20
+ const shell = useRef('shell')
21
+
22
+ async function consume() {
23
+ if (status() === 'working' || status() === 'done')
24
+ return
25
+
26
+ status.set('working')
27
+ try {
28
+ const reply = await fetch('/auth/magic-link/consume', {
29
+ method: 'POST',
30
+ headers: { 'Content-Type': 'application/json' },
31
+ credentials: 'same-origin',
32
+ body: JSON.stringify({ token: String(route.params.token || '') }),
33
+ })
34
+ const body = await reply.json().catch(() => ({}))
35
+
36
+ if (!reply.ok) {
37
+ status.set('failed')
38
+ message.set(body.message || body.error || 'That sign-in link is not valid.')
39
+ return
40
+ }
41
+
42
+ status.set('done')
43
+ const redirect = String(body.redirect_to || '/')
44
+ navigate(redirect.startsWith('/') && !redirect.startsWith('//') ? redirect : '/')
45
+ }
46
+ catch {
47
+ status.set('failed')
48
+ message.set('Something went wrong. Request a new link and try again.')
49
+ }
50
+ }
51
+
52
+ effect(() => {
53
+ // Auto-consume only when the server said so - the flag rides a data
54
+ // attribute because client scripts cannot read server config directly.
55
+ if (shell() && shell().dataset.autoConsume === 'true')
56
+ consume()
57
+ })
58
+ </script>
59
+
60
+ <template>
61
+ <main ref="shell" data-auto-consume="{{ autoConsume }}" class="min-h-[100dvh] flex items-center justify-center px-6">
62
+ <div class="w-full max-w-sm text-center">
63
+ <div :if="status() === 'failed'">
64
+ <div class="mx-auto h-12 w-12 rounded-full bg-red-50 flex items-center justify-center">
65
+ <span class="h-6 w-6 text-red-500 i-hugeicons-alert-02"></span>
66
+ </div>
67
+ <h1 class="mt-5 text-xl font-semibold tracking-tight">Sign-in link problem</h1>
68
+ <p class="mt-2 text-[15px] text-gray-600">{{ message() }}</p>
69
+ <a href="/login" class="mt-6 inline-block rounded-lg px-5 py-2.5 font-medium bg-gray-900 text-white">Back to sign in</a>
70
+ </div>
71
+ <div :else-if="status() === 'working' || status() === 'done'">
72
+ <div class="mx-auto h-12 w-12 rounded-full bg-gray-100 flex items-center justify-center">
73
+ <span class="h-6 w-6 text-gray-500 animate-spin i-hugeicons-loading-03"></span>
74
+ </div>
75
+ <h1 class="mt-5 text-xl font-semibold tracking-tight">Signing you in</h1>
76
+ <p class="mt-2 text-[15px] text-gray-600">One moment.</p>
77
+ </div>
78
+ <div :else>
79
+ <div class="mx-auto h-12 w-12 rounded-full bg-gray-100 flex items-center justify-center">
80
+ <span class="h-6 w-6 text-gray-600 i-hugeicons-mail-open-01"></span>
81
+ </div>
82
+ <h1 class="mt-5 text-xl font-semibold tracking-tight">Continue to sign in</h1>
83
+ <p class="mt-2 text-[15px] text-gray-600">Tap below to finish signing in with your emailed link.</p>
84
+ <button type="button" @click="consume" class="mt-6 rounded-lg px-6 py-3 font-medium bg-gray-900 text-white transition-transform active:scale-[0.98]">Continue</button>
85
+ </div>
86
+ </div>
87
+ </main>
88
+ </template>
@@ -7,6 +7,28 @@
7
7
  "hasDedicatedPage": false,
8
8
  "category": "data"
9
9
  },
10
+ {
11
+ "id": "auction",
12
+ "name": "Auction",
13
+ "icon": "i-hugeicons-auction",
14
+ "hasDedicatedPage": false,
15
+ "category": "commerce",
16
+ "dashboard": {
17
+ "icon": "i-hugeicons-auction",
18
+ "label": "Auctions"
19
+ }
20
+ },
21
+ {
22
+ "id": "auction-item",
23
+ "name": "AuctionItem",
24
+ "icon": "i-hugeicons-package",
25
+ "hasDedicatedPage": false,
26
+ "category": "commerce",
27
+ "dashboard": {
28
+ "icon": "i-hugeicons-package",
29
+ "label": "Lots"
30
+ }
31
+ },
10
32
  {
11
33
  "id": "author",
12
34
  "name": "Author",
@@ -17,6 +39,17 @@
17
39
  "highlight": true
18
40
  }
19
41
  },
42
+ {
43
+ "id": "bid",
44
+ "name": "Bid",
45
+ "icon": "i-hugeicons-hand-pointing-right-01",
46
+ "hasDedicatedPage": false,
47
+ "category": "commerce",
48
+ "dashboard": {
49
+ "icon": "i-hugeicons-hand-pointing-right-01",
50
+ "label": "Bids"
51
+ }
52
+ },
20
53
  {
21
54
  "id": "board",
22
55
  "name": "Board",
@@ -389,6 +422,17 @@
389
422
  "hasDedicatedPage": false,
390
423
  "category": "commerce"
391
424
  },
425
+ {
426
+ "id": "pledge",
427
+ "name": "Pledge",
428
+ "icon": "i-hugeicons-give-blood",
429
+ "hasDedicatedPage": false,
430
+ "category": "commerce",
431
+ "dashboard": {
432
+ "icon": "i-hugeicons-give-blood",
433
+ "label": "Pledges"
434
+ }
435
+ },
392
436
  {
393
437
  "id": "post",
394
438
  "name": "Post",
@@ -650,5 +694,6 @@
650
694
  "subscribers": true,
651
695
  "allModels": true
652
696
  }
653
- }
697
+ },
698
+ "nav": []
654
699
  }