@koehler8/cms-ext-crypto 1.0.0-beta.4

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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +198 -0
  3. package/components/CommunityStrip.vue +655 -0
  4. package/components/CuriosityTeaser.vue +842 -0
  5. package/components/HeaderWalletAction.vue +398 -0
  6. package/components/HeroPresale.vue +778 -0
  7. package/components/PercentDoughnut.vue +249 -0
  8. package/components/Presale.vue +507 -0
  9. package/components/PresaleAdmin.vue +1259 -0
  10. package/components/PresaleFaq.vue +95 -0
  11. package/components/ProgressFomo.vue +766 -0
  12. package/components/SocialProofFeed.vue +585 -0
  13. package/components/Tokenomics.vue +617 -0
  14. package/components/Trust.vue +123 -0
  15. package/components/TrustBar.vue +619 -0
  16. package/components/presale/BonusIncentive.vue +476 -0
  17. package/components/presale/Buy.vue +5388 -0
  18. package/components/presale/CountdownTimer.vue +326 -0
  19. package/components/presale/FirstTimeOnboarding.vue +443 -0
  20. package/components/presale/FuseMeter.vue +276 -0
  21. package/components/presale/HoldersBenefits.vue +135 -0
  22. package/components/presale/MomentumCard.vue +163 -0
  23. package/components/presale/PresaleFaqContent.vue +393 -0
  24. package/components/presale/PriceTimeline.vue +143 -0
  25. package/components/presale/Stake.vue +1415 -0
  26. package/components/presale/Status.vue +1113 -0
  27. package/components/presale/StatusMetric.vue +336 -0
  28. package/components/presale/StatusProgressBar.vue +98 -0
  29. package/components/presale/TrustSignals.vue +595 -0
  30. package/components/presale/buyAnalytics.js +58 -0
  31. package/components/presale/buyAssets.js +75 -0
  32. package/components/presale/buyTextHelpers.js +582 -0
  33. package/components/presale/priceSnapshotCache.js +72 -0
  34. package/components/presale/useBuyContentConfig.js +643 -0
  35. package/components/presale/useBuyOnboarding.js +338 -0
  36. package/components/presale/useBuyTransaction.js +464 -0
  37. package/components/presale/useBuyWallet.js +509 -0
  38. package/components/presale/useFomoProgress.js +578 -0
  39. package/components/presale/walletBalanceHelper.js +47 -0
  40. package/composables/usePresaleContext.js +24 -0
  41. package/content.defaults.json +171 -0
  42. package/extension.config.json +116 -0
  43. package/index.js +8 -0
  44. package/package.json +47 -0
  45. package/plugins/appKit.js +261 -0
  46. package/setup.js +29 -0
  47. package/stores/presale.js +70 -0
  48. package/utils/presaleContracts.js +69 -0
  49. package/utils/scrollToPresale.js +21 -0
  50. package/utils/tokenFormat.js +21 -0
  51. package/utils/walletTracking.js +175 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-present Chris Koehler
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,198 @@
1
+ # Presale Extension
2
+
3
+ Composable presale deck that powers the Status/Buy/Stake surface, social proof, curiosity teaser, and admin console for on-chain launches. The bundle keeps every presale-focused component, schema, and helper code under `extensions/presale` so marketing-only sites can omit it entirely while token launches only update a single folder.
4
+
5
+ ## Requirements
6
+ - `VITE_TOKEN`, `VITE_REGISTRY_ADDRESS`, `VITE_RPC_READ` – required for contract discovery and read-only widgets.
7
+ - `VITE_REOWN_PROJECT_ID` – enables Reown AppKit (wallet connect banner, modal, admin panel). When missing, wallet CTAs stay hidden and presale cards short-circuit.
8
+ - Shared ABIs live in `abis/Presale.abi.json` and `abis/TokenStandard.abi.json`; update them when the on-chain interface changes.
9
+
10
+ ## Usage
11
+ Add the bundle to a page via the object syntax:
12
+
13
+ ```json
14
+ "components": [
15
+ "Header",
16
+ { "name": "Presale", "source": "presale" },
17
+ "Footer"
18
+ ]
19
+ ```
20
+
21
+ Individual modules (Hero, Momentum card, Curiosity teaser, etc.) can be referenced the same way if you only need a subset:
22
+
23
+ ```json
24
+ { "name": "HeroPresale", "source": "presale" }
25
+ ```
26
+
27
+ ## Component Catalog
28
+
29
+ | Component | Module | Config Key | Allowed Pages | Purpose |
30
+ |-----------|--------|------------|---------------|---------|
31
+ | `Presale` | `components/Presale.vue` | `presale` | `home` | Wrapper that mounts `Status`, `Buy`, and `Stake` cards plus FAQ inside the standard `.ui-section` container. |
32
+ | `PresaleFaq` | `components/PresaleFaq.vue` | `presale` | `home` | Accordion that renders `presale.faq` entries with analytics instrumentation. |
33
+ | `MomentumCard` | `components/presale/MomentumCard.vue` | `presale` | `home` | Standalone progress/momentum card that mirrors the live presale pulse stats (`progressFomo`). |
34
+ | `HeroPresale` | `components/HeroPresale.vue` | `heroPresale` | Any | Presale hero variant with badge, CTA pair, optional secondary list, and smooth scroll into the buy widget. |
35
+ | `ProgressFomo` | `components/ProgressFomo.vue` | `progressFomo` | Any | Edge-to-edge card with allocation progress, animated fuse meter, and price schedule sidebar. |
36
+ | `CuriosityTeaser` | `components/CuriosityTeaser.vue` | `curiosityTeaser` | `home` | Secret-drop teaser with modal CTA, highlights, and community links. |
37
+ | `SocialProofFeed` | `components/SocialProofFeed.vue` | `socialProof` | Any | Carousel of curated posts/testimonials plus share CTA and optional live community counter. |
38
+ | `Tokenomics` | `components/Tokenomics.vue` | `tokenomics` | Any | Doughnut chart + allocation table driven by Chart.js, respecting `tokenomicsHeading` / `tokenomicsIntro`. |
39
+ | `Trust` | `components/Trust.vue` | `trust` | Any | Trust signals grid with partners, audits, and highlight badges. |
40
+ | `TrustBar` | `components/TrustBar.vue` | `trustBar` | Any | Sticky contract strip with copy-to-clipboard, audit links, and verification CTAs. |
41
+ | `CommunityStrip` | `components/CommunityStrip.vue` | `communityStrip` | Any | Social proof rail with social badges and optional email capture endpoint. |
42
+ | `PresaleAdmin` | `components/PresaleAdmin.vue` | `presaleAdmin` | `admin` | Operator console for price overrides, APY, treasury actions, and maintenance flags. |
43
+
44
+ The `Presale` wrapper auto-registers sub-components via `import.meta.glob`, so adding new cards only requires creating the Vue file and referencing it in site config.
45
+
46
+ ## Configuration Reference
47
+
48
+ ### Core `presale` Block
49
+ Defines strings for `Status.vue`, `Buy.vue`, `Stake.vue`, FAQ entries, helper cards, onboarding overlays, and celebration modals. All keys live under `pages.<slug>.content.presale` (or `shared.content.presale`) and support locale overrides.
50
+
51
+ - `panelTitles.buy|stake|status` – card headings.
52
+ - `statusCopy.priceContext`, `countdownPendingLabel`, `timeEndingLabel`, `timeEndedLabel` – countdown and KPI copy for `Status.vue`.
53
+ - `personalPurchasedLabel`, `personalStakedLabel`, `personalStakeableLabel`, `personalRewardsLabel` – wallet-connected summary cards.
54
+ - `helperSurfaces.howItWorks` / `helperSurfaces.needEth` – toggles plus titles/links for the helper cards beside the buy widget.
55
+ - `benefits` (`presaleBenefits`) – eyebrow/title/items[]/cta object rendered in `HoldersBenefits`.
56
+ - `bonusIncentive` – early-buyer badge (enabled flag, copy, counts, CTA, countdown).
57
+ - `onboarding` – controls first-time overlay (delay, skip mobile, steps[], CTA copy, storage key).
58
+ - `secondaryCtas.links[]`, `secondaryCtas.emailSignup.*` – link stack and optional email capture below the buy card.
59
+ - `needEth.*` – modal copy plus resource links for acquiring ETH.
60
+ - `successCelebration.*` – post-purchase modal headline/body/cta strings with `{tokens}`, `{tokenSymbol}`, `{amount}`, `{asset}` substitutions.
61
+ - `faq[]` – entries with `id`, `question`, `answer`, optional analytics label (used by `PresaleFaq`).
62
+ - `presaleAdmin.*` – localized titles, CTA labels, and helper copy for the `/admin` console.
63
+
64
+ ### Hero & Sticky CTA
65
+ - `heroPresale` – badge/headline/subheadline, `primaryCta`, `secondaryActions[]`, optional `connectLabel`, `backgroundImage`, `backgroundWidths`.
66
+ - `promo.actions[].style` shares the same palette tokens so marketing and presale CTAs stay aligned (`dark`/`primary`, `light`/`secondary`, `link`).
67
+ - `stickyCta` – label/target for the mobile-only CTA bar (use `#centerPresale` / `#rightPresale` to focus tabs).
68
+
69
+ ### Progress & Momentum
70
+ - `progressFomo.enabled`, `totalAllocation`, `soldAmount`, `uniqueBuyers`, `nextPhaseTimestamp`, `showFuse`, `animates`.
71
+ - `progressFomo.title`, `caption`, `priceSchedule[]`, `priceScheduleTitle`, `priceScheduleSubtitle`.
72
+ - `presale.priceTimeline.entries[]` feeds `PriceTimeline.vue` when you need a text-only schedule.
73
+
74
+ ### Social & Community Surfaces
75
+ - `socialProof` – badge/title/subtitle, `share` payload (`tweetText`, `url`, `hashtags`, `utm`), optional `community` counter with `endpoint`, `refreshMinutes`, `label`, `count`, `daily`, and `posts[]`.
76
+ - `communityStrip` – `title`, `subtitle`, `socials[]` (`label`, `href`, `count`, `icon?`, `cta?`) plus optional `email` form config (endpoint/method/fields/success/error copy).
77
+ - `curiosityTeaser` – `enabled`, `eyebrow`, `headline`, `description`, `disclaimer`, `cta` (link vs modal), `modal` block (title, lead, highlights[], reward code, CTA), and `community` link list.
78
+
79
+ ### Tokenomics & Trust
80
+ - `tokenomicsHeading`, `tokenomicsIntro`, `tokenomics.sections[]` – drive the donut chart/table.
81
+ - `trust` – heading, description, `items[]` (icon, title, description, CTA, badges).
82
+ - `trustBar` – contract address, network label, CTA list, audit metadata.
83
+
84
+ ### Admin & Routing
85
+ - `/admin` automatically mounts `PresaleAdmin` when `{ "name": "PresaleAdmin", "source": "presale" }` appears in `pages.admin.components`.
86
+ - Ensure `vite.config.js` loads the same site slug so the registry resolves the correct on-chain addresses.
87
+
88
+ ## Architecture Notes
89
+ - `Status.vue`, `Buy.vue`, and `Stake.vue` share the same presale pulse object; updates to one surface propagate to the others without duplicate RPC calls.
90
+ - `Buy.vue` caches price snapshots, auto-renders a connect banner backed by AppKit, persists pending tx hashes in `sessionStorage`, and resumes the spinner after reloads.
91
+ - `Stake.vue` clears personal metrics on disconnect to avoid stale balances.
92
+ - Layout utilities (`.ui-card`, `.ui-section--stacked`, `.brand-card`) live in `src/styles/base.css` and keep presale cards aligned with the rest of the marketing grid.
93
+ - Skeleton loaders and motion-heavy surfaces (`ProgressFomo`, `FuseMeter`, `HeroPresale`) respect `prefers-reduced-motion`.
94
+
95
+ ## Analytics
96
+
97
+ ### Presale Funnel (`trackFunnelEvent`)
98
+
99
+ #### Wallet Connection
100
+
101
+ | Event | Fired From | Key Parameters |
102
+ |-------|------------|----------------|
103
+ | `wallet_connect_initiated` | Primary connect CTA and quick connector chips in `presale/Buy.vue` | `wallet_provider` (`appkit`, `metamask`, `walletconnect`, `coinbase`), `source` (`primary_button`, `quick_connect`). A matching `trackEvent('wallet_connect_initiated')` also records `token` and `connector`. |
104
+ | `wallet_connect_clicked` | Same surfaces as above (immediately after the CTA is pressed) | `wallet_provider`, `source` |
105
+ | `wallet_connected` | When the wallet resolves accounts successfully (header wallet CTA or `presale/Buy.vue`) | `wallet_provider`, `accounts_connected`, `chain_id` (when resolved), `source` (`header`, `buy_widget`) |
106
+ | `wallet_connected_success` | Helper emission after `wallet_connected` for downstream funnels | Same payload as `wallet_connected` |
107
+
108
+ #### Purchase Lifecycle
109
+
110
+ All purchase events extend `buildPurchaseAnalyticsPayload(flow, ethAmount, tokenAmount)` which includes: `flow` (`buy`, `buy_and_stake`), `token_symbol`, `buy_mode` (`buy_only`, `buy_stake`), `stake_included` (boolean), `purchase_amount_eth`, `purchase_amount_usd` (when price available), `purchase_amount_token`, `tokens_bought`, `value`, `currency`.
111
+
112
+ | Event | Fired From | Key Parameters |
113
+ |-------|------------|----------------|
114
+ | `purchase_initiated` | Immediately before `buyTokens` or `buyAndStakeTokens` submits a transaction | Purchase payload |
115
+ | `purchase_attempt` | Same moment as `purchase_initiated` (pre-flight marker) | Purchase payload |
116
+ | `purchase_success` | After the receipt resolves (buy or buy+stake) | Purchase payload plus `transaction_hash` |
117
+ | `purchase_completed` | Mirrors `purchase_success` for GA funnels | Purchase payload plus `transaction_hash` |
118
+ | `purchase_failed` | When the flow is blocked or rejected | Purchase payload plus `reason` (`rejected_by_user`, `insufficient_funds`, `wrong_network`, `error`), optional `error_code`, `error_name` |
119
+ | `purchase_error` | When a contract call throws | Purchase payload plus `error_code`, `error_name` |
120
+
121
+ #### Stake Lifecycle
122
+
123
+ | Event | Fired From | Key Parameters |
124
+ |-------|------------|----------------|
125
+ | `stake_initiated` | Auto stake branch inside `buyAndStakeTokens` and manual stake CTA in `presale/Stake.vue` | `stake_type` (`auto_buy_and_stake`, `manual`), `token_symbol`, optional `stake_amount_token` |
126
+ | `stake_attempt` | Same moment as `stake_initiated` | Stake payload |
127
+ | `stake_success` | When staking succeeds | Stake payload plus `transaction_hash` |
128
+ | `stake_completed` | Mirrors `stake_success` for GA funnels | Stake payload plus `transaction_hash` |
129
+ | `stake_failed` | When staking fails | Stake payload plus `reason` (`error`), optional `error_code`, `error_name` |
130
+ | `stake_error` | Error helper for stake failures | Stake payload plus `error_code`, `error_name` |
131
+
132
+ ### Presale UI Events (`trackEvent`)
133
+
134
+ #### Buy & Buy+Stake Attempts
135
+
136
+ | Event | Fired From | Key Parameters |
137
+ |-------|------------|----------------|
138
+ | `wallet_connect_initiated` | Connect CTA / quick connectors in `presale/Buy.vue` (standard GA event that mirrors the funnel emission) | `token`, `connector`, `source` |
139
+ | `presale_buy_blocked` | Validation guard inside `buyTokens` | `token`, `reason` (`invalid_amount`) |
140
+ | `presale_buy_attempt` | Right before `buyTokens` writes to the presale contract | `token`, `amount_eth` |
141
+ | `presale_buy_success` | After a buy transaction confirms | `token`, `amount_eth`, `tx_hash` |
142
+ | `presale_buy_error` | Buy catch block | `token`, `amount_eth`, `error_code`, `error_name` |
143
+ | `presale_buy_and_stake_blocked` | Validation guard in `buyAndStakeTokens` | `token`, `reason` (`invalid_amount`) |
144
+ | `presale_buy_and_stake_attempt` | Before the combined buy+stake transaction | `token`, `amount_eth` |
145
+ | `presale_buy_and_stake_success` | After the combined transaction confirms | `token`, `amount_eth`, `tx_hash` |
146
+ | `presale_buy_and_stake_error` | Buy+stake catch block | `token`, `amount_eth`, `error_code`, `error_name` |
147
+ | `presale_transaction_submitted` | Emitted after every contract submission (`buy`, `buy_and_stake`, `stake`, `claim`, `claim_all`) | `token`, `type`, `tx_hash`, `amount_eth` (when applicable), `scope` for claim flows |
148
+ | `presale_max_eth_clicked` | “Max” helper that pre-fills the form with wallet balance minus gas buffer | `token`, `wallet_balance_eth`, `spend_eth`, `outcome: 'prefill'` |
149
+ | `presale_stake_preference_changed` | Stake-after toggle in `Buy.vue` | `token`, `stake_after_purchase` (`enabled`, `disabled`) |
150
+
151
+ ### Curiosity, FAQ & Resource Surfaces
152
+
153
+ | Event | Fired From | Key Parameters |
154
+ |-------|------------|----------------|
155
+ | `secret_drop_peek` | Curiosity teaser link/modal in `extensions/presale/components/CuriosityTeaser.vue` (emitted via `trackFunnelEvent`) | `source: 'curiosity_teaser'`, `trigger` (`link_click`, `modal_open`), `mode` (`link`, `modal`), `cta_text` |
156
+ | `playbook_view` | Triggered from curiosity CTA, modal CTA, presale secondary CTA | `source` (`curiosity_primary_cta`, `curiosity_modal_cta`, `presale_secondary_cta`), `href`, `label` |
157
+ | `faq_question_open` | Accordion entries inside `presale/PresaleFaqContent.vue` | `question_id`, `question`, `index`, `source: 'presale_faq'` |
158
+ | `curiosity_modal_cta_click` | Primary CTA inside the curiosity modal | `href`, `label` |
159
+ | `curiosity_teaser_community_click` | Community links rendered by `extensions/presale/components/CuriosityTeaser.vue` | `id`, `href` |
160
+
161
+ ### Community & Social
162
+
163
+ | Event | Fired From | Key Parameters |
164
+ |-------|------------|----------------|
165
+ | `community_strip_social_click` | Social badges inside `extensions/presale/components/CommunityStrip.vue` | `channel`, `href` (lowercased) |
166
+ | `community_strip_email_success` | Community strip email capture succeeds | `endpoint` |
167
+ | `community_strip_email_error` | Community strip email capture fails | `endpoint`, `error_name` |
168
+ | `social_proof_share_click` | Share CTA inside `SocialProofFeed.vue` | `token`, `share_url` |
169
+ | `social_proof_post_click` | Individual social proof card clicked | `token`, `post_id`, `source` |
170
+ | `social_telegram_click` | Emitted via `trackFunnelEvent` when Telegram links fire (community strip, curiosity teaser, success modal) | `source` (`community_strip`, `curiosity_teaser`, `purchase_success`), `href`, `label` |
171
+ | `social_twitter_click` | Same as above for X/Twitter links | `source`, `href`, `label` |
172
+
173
+ ### Trust & Compliance
174
+
175
+ | Event | Fired From | Key Parameters |
176
+ |-------|------------|----------------|
177
+ | `trustbar_copy_contract` | Contract copy button in `TrustBar.vue` | `token`, `success` (boolean) |
178
+ | `trustbar_etherscan_click` | Etherscan link in `TrustBar.vue` | `token`, `contract_address` |
179
+ | `trustsignals_audit_click` | Audit CTA in `presale/TrustSignals.vue` | `token`, `audit_name`, `audit_status` |
180
+ | `trustsignals_verification_click` | Contract verification link | `token`, `contract_address` |
181
+ | `trustsignals_partner_click` | Partner badges inside `TrustSignals.vue` | `token`, `partner` |
182
+
183
+ ## Testing
184
+ - Vitest suites under `tests/BuyComponent.spec.js`, `tests/StakeComponent.spec.js`, `tests/StatusComponent.spec.js`, and helper specs exercise the presale flow. Use them as references before altering contract calls or analytics.
185
+ - Mock env vars with `vi.stubEnv` and reuse the stubs for `getPresaleWriteContract`, `useEngagementTracking`, and storage APIs.
186
+
187
+ ## Related References
188
+ - Manifest + loader contract: `docs/extensions.md`
189
+ - Site configuration primer: `docs/configuration.md`
190
+ - Architecture overview for presale/web3 flows: `docs/architecture.md`
191
+
192
+ ## Contributing
193
+
194
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines.
195
+
196
+ ## License
197
+
198
+ [MIT](./LICENSE)