@doswiftly/cli 0.1.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.
- package/README.md +357 -0
- package/bin/doswiftly.js +2 -0
- package/dist/commands/auth-github.d.ts +6 -0
- package/dist/commands/auth-github.d.ts.map +1 -0
- package/dist/commands/auth-github.js +89 -0
- package/dist/commands/auth-github.js.map +1 -0
- package/dist/commands/auth-token.d.ts +12 -0
- package/dist/commands/auth-token.d.ts.map +1 -0
- package/dist/commands/auth-token.js +43 -0
- package/dist/commands/auth-token.js.map +1 -0
- package/dist/commands/auth.d.ts +22 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +348 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/check.d.ts +5 -0
- package/dist/commands/check.d.ts.map +1 -0
- package/dist/commands/check.js +234 -0
- package/dist/commands/check.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +104 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/deploy.d.ts +37 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +580 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/dev.d.ts +8 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +83 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +363 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/domain.d.ts +13 -0
- package/dist/commands/domain.d.ts.map +1 -0
- package/dist/commands/domain.js +128 -0
- package/dist/commands/domain.js.map +1 -0
- package/dist/commands/env.d.ts +25 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +228 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/init.d.ts +11 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +1028 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/inspect.d.ts +12 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +162 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/migrate.d.ts +18 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +355 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/preview.d.ts +29 -0
- package/dist/commands/preview.d.ts.map +1 -0
- package/dist/commands/preview.js +199 -0
- package/dist/commands/preview.js.map +1 -0
- package/dist/commands/proxy.d.ts +9 -0
- package/dist/commands/proxy.d.ts.map +1 -0
- package/dist/commands/proxy.js +37 -0
- package/dist/commands/proxy.js.map +1 -0
- package/dist/commands/sdk.d.ts +5 -0
- package/dist/commands/sdk.d.ts.map +1 -0
- package/dist/commands/sdk.js +82 -0
- package/dist/commands/sdk.js.map +1 -0
- package/dist/commands/template.d.ts +107 -0
- package/dist/commands/template.d.ts.map +1 -0
- package/dist/commands/template.js +1309 -0
- package/dist/commands/template.js.map +1 -0
- package/dist/commands/types.d.ts +5 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +82 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +103 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/upgrade.d.ts +18 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +55 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/verify.d.ts +5 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +232 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/commands/whoami.d.ts +5 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +60 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/config/types.d.ts +173 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +48 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +416 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api-url.d.ts +14 -0
- package/dist/lib/api-url.d.ts.map +1 -0
- package/dist/lib/api-url.js +24 -0
- package/dist/lib/api-url.js.map +1 -0
- package/dist/lib/api.d.ts +67 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/api.js +36 -0
- package/dist/lib/api.js.map +1 -0
- package/dist/lib/config.d.ts +39 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +195 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/env-storage.d.ts +140 -0
- package/dist/lib/env-storage.d.ts.map +1 -0
- package/dist/lib/env-storage.js +464 -0
- package/dist/lib/env-storage.js.map +1 -0
- package/dist/lib/errors.d.ts +61 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +204 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/i18n.d.ts +99 -0
- package/dist/lib/i18n.d.ts.map +1 -0
- package/dist/lib/i18n.js +184 -0
- package/dist/lib/i18n.js.map +1 -0
- package/dist/lib/logger.d.ts +95 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +168 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/package-manager.d.ts +91 -0
- package/dist/lib/package-manager.d.ts.map +1 -0
- package/dist/lib/package-manager.js +205 -0
- package/dist/lib/package-manager.js.map +1 -0
- package/dist/lib/proxy-server.d.ts +24 -0
- package/dist/lib/proxy-server.d.ts.map +1 -0
- package/dist/lib/proxy-server.js +173 -0
- package/dist/lib/proxy-server.js.map +1 -0
- package/dist/lib/select-with-back.d.ts +34 -0
- package/dist/lib/select-with-back.d.ts.map +1 -0
- package/dist/lib/select-with-back.js +94 -0
- package/dist/lib/select-with-back.js.map +1 -0
- package/dist/lib/shared-api-client.d.ts +40 -0
- package/dist/lib/shared-api-client.d.ts.map +1 -0
- package/dist/lib/shared-api-client.js +92 -0
- package/dist/lib/shared-api-client.js.map +1 -0
- package/dist/lib/wizard-engine.d.ts +128 -0
- package/dist/lib/wizard-engine.d.ts.map +1 -0
- package/dist/lib/wizard-engine.js +168 -0
- package/dist/lib/wizard-engine.js.map +1 -0
- package/package.json +85 -0
- package/templates/storefront-minimal/.env.example +10 -0
- package/templates/storefront-minimal/.github/workflows/build-template.yml +109 -0
- package/templates/storefront-minimal/app/globals.css +18 -0
- package/templates/storefront-minimal/app/layout.tsx +26 -0
- package/templates/storefront-minimal/app/page.tsx +93 -0
- package/templates/storefront-minimal/lib/graphql-client.ts +23 -0
- package/templates/storefront-minimal/next.config.ts +15 -0
- package/templates/storefront-minimal/open-next.config.ts +3 -0
- package/templates/storefront-minimal/package.json +30 -0
- package/templates/storefront-minimal/postcss.config.mjs +5 -0
- package/templates/storefront-minimal/tailwind.config.ts +14 -0
- package/templates/storefront-minimal/tsconfig.json +27 -0
- package/templates/storefront-minimal/wrangler.toml +9 -0
- package/templates/storefront-nextjs/.env.example +68 -0
- package/templates/storefront-nextjs/.github/workflows/build-template.yml +109 -0
- package/templates/storefront-nextjs/.github/workflows/deploy.yml +25 -0
- package/templates/storefront-nextjs/.github/workflows/preview.yml +22 -0
- package/templates/storefront-nextjs/README.md +520 -0
- package/templates/storefront-nextjs/app/account/orders/page.tsx +216 -0
- package/templates/storefront-nextjs/app/account/page.tsx +167 -0
- package/templates/storefront-nextjs/app/auth/login/page.tsx +135 -0
- package/templates/storefront-nextjs/app/auth/register/page.tsx +228 -0
- package/templates/storefront-nextjs/app/cart/page.tsx +263 -0
- package/templates/storefront-nextjs/app/categories/[slug]/page.tsx +200 -0
- package/templates/storefront-nextjs/app/categories/page.tsx +58 -0
- package/templates/storefront-nextjs/app/checkout/page.tsx +351 -0
- package/templates/storefront-nextjs/app/collections/[slug]/page.tsx +158 -0
- package/templates/storefront-nextjs/app/collections/page.tsx +61 -0
- package/templates/storefront-nextjs/app/globals.css +98 -0
- package/templates/storefront-nextjs/app/layout.tsx +39 -0
- package/templates/storefront-nextjs/app/page.tsx +136 -0
- package/templates/storefront-nextjs/app/products/[slug]/page.tsx +119 -0
- package/templates/storefront-nextjs/app/products/page.tsx +107 -0
- package/templates/storefront-nextjs/app/search/page.tsx +127 -0
- package/templates/storefront-nextjs/components/auth/auth-guard.tsx +94 -0
- package/templates/storefront-nextjs/components/commerce/add-to-cart-button.tsx +77 -0
- package/templates/storefront-nextjs/components/commerce/cart-icon.tsx +29 -0
- package/templates/storefront-nextjs/components/commerce/currency-selector.tsx +217 -0
- package/templates/storefront-nextjs/components/commerce/pagination.tsx +62 -0
- package/templates/storefront-nextjs/components/commerce/product-actions.tsx +135 -0
- package/templates/storefront-nextjs/components/commerce/product-filters.tsx +109 -0
- package/templates/storefront-nextjs/components/commerce/product-price.tsx +375 -0
- package/templates/storefront-nextjs/components/commerce/search-input.tsx +178 -0
- package/templates/storefront-nextjs/components/commerce/sort-select.tsx +64 -0
- package/templates/storefront-nextjs/components/commerce/variant-selector.tsx +210 -0
- package/templates/storefront-nextjs/components/layout/footer.tsx +107 -0
- package/templates/storefront-nextjs/components/layout/header.tsx +104 -0
- package/templates/storefront-nextjs/components/providers.tsx +62 -0
- package/templates/storefront-nextjs/lib/auth/routes.ts +52 -0
- package/templates/storefront-nextjs/lib/currency.tsx +140 -0
- package/templates/storefront-nextjs/lib/format.ts +159 -0
- package/templates/storefront-nextjs/lib/graphql-queries.ts +629 -0
- package/templates/storefront-nextjs/lib/hooks.ts +30 -0
- package/templates/storefront-nextjs/middleware.ts +80 -0
- package/templates/storefront-nextjs/next.config.ts +37 -0
- package/templates/storefront-nextjs/open-next.config.ts +3 -0
- package/templates/storefront-nextjs/package.dev.json +30 -0
- package/templates/storefront-nextjs/package.json +32 -0
- package/templates/storefront-nextjs/package.json.template +32 -0
- package/templates/storefront-nextjs/postcss.config.mjs +8 -0
- package/templates/storefront-nextjs/tailwind.config.ts +111 -0
- package/templates/storefront-nextjs/tsconfig.json +27 -0
- package/templates/storefront-nextjs/wrangler.toml +9 -0
- package/templates/storefront-nextjs-shadcn/.env.example +68 -0
- package/templates/storefront-nextjs-shadcn/.github/workflows/build-template.yml +109 -0
- package/templates/storefront-nextjs-shadcn/.github/workflows/deploy.yml +25 -0
- package/templates/storefront-nextjs-shadcn/.github/workflows/preview.yml +22 -0
- package/templates/storefront-nextjs-shadcn/CART_INTEGRATION.md +282 -0
- package/templates/storefront-nextjs-shadcn/CLAUDE.md +96 -0
- package/templates/storefront-nextjs-shadcn/GRAPHQL_DOCUMENT_NAMES.md +190 -0
- package/templates/storefront-nextjs-shadcn/GRAPHQL_ERROR_HANDLING.md +263 -0
- package/templates/storefront-nextjs-shadcn/GRAPHQL_FIXES_SUMMARY.md +135 -0
- package/templates/storefront-nextjs-shadcn/GRAPHQL_INTEGRATION_COMPLETE.md +142 -0
- package/templates/storefront-nextjs-shadcn/INTEGRATION_CHECKLIST.md +448 -0
- package/templates/storefront-nextjs-shadcn/PRODUCT_DETAIL_PAGE_IMPLEMENTATION.md +307 -0
- package/templates/storefront-nextjs-shadcn/README.md +195 -0
- package/templates/storefront-nextjs-shadcn/THEME_CUSTOMIZATION.md +245 -0
- package/templates/storefront-nextjs-shadcn/app/about/page.tsx +34 -0
- package/templates/storefront-nextjs-shadcn/app/account/addresses/page.tsx +215 -0
- package/templates/storefront-nextjs-shadcn/app/account/loyalty/page.tsx +484 -0
- package/templates/storefront-nextjs-shadcn/app/account/orders/[id]/page.tsx +128 -0
- package/templates/storefront-nextjs-shadcn/app/account/orders/[id]/tracking/page.tsx +206 -0
- package/templates/storefront-nextjs-shadcn/app/account/orders/page.tsx +80 -0
- package/templates/storefront-nextjs-shadcn/app/account/page.tsx +107 -0
- package/templates/storefront-nextjs-shadcn/app/account/settings/page.tsx +195 -0
- package/templates/storefront-nextjs-shadcn/app/api/auth/clear-token/route.ts +87 -0
- package/templates/storefront-nextjs-shadcn/app/api/auth/set-token/route.ts +125 -0
- package/templates/storefront-nextjs-shadcn/app/auth/forgot-password/page.tsx +131 -0
- package/templates/storefront-nextjs-shadcn/app/auth/login/page.tsx +24 -0
- package/templates/storefront-nextjs-shadcn/app/auth/register/page.tsx +20 -0
- package/templates/storefront-nextjs-shadcn/app/blog/[slug]/page.tsx +323 -0
- package/templates/storefront-nextjs-shadcn/app/blog/page.tsx +159 -0
- package/templates/storefront-nextjs-shadcn/app/brands/[slug]/page.tsx +170 -0
- package/templates/storefront-nextjs-shadcn/app/brands/page.tsx +73 -0
- package/templates/storefront-nextjs-shadcn/app/cart/page.tsx +165 -0
- package/templates/storefront-nextjs-shadcn/app/categories/[slug]/page.tsx +78 -0
- package/templates/storefront-nextjs-shadcn/app/categories/page.tsx +75 -0
- package/templates/storefront-nextjs-shadcn/app/checkout/page.tsx +1752 -0
- package/templates/storefront-nextjs-shadcn/app/checkout/success/[orderId]/page.tsx +256 -0
- package/templates/storefront-nextjs-shadcn/app/collections/[handle]/page.tsx +74 -0
- package/templates/storefront-nextjs-shadcn/app/collections/page.tsx +75 -0
- package/templates/storefront-nextjs-shadcn/app/contact/page.tsx +114 -0
- package/templates/storefront-nextjs-shadcn/app/error.tsx +90 -0
- package/templates/storefront-nextjs-shadcn/app/globals.css +125 -0
- package/templates/storefront-nextjs-shadcn/app/layout.tsx +57 -0
- package/templates/storefront-nextjs-shadcn/app/not-found.tsx +68 -0
- package/templates/storefront-nextjs-shadcn/app/page.tsx +21 -0
- package/templates/storefront-nextjs-shadcn/app/products/[slug]/page.tsx +246 -0
- package/templates/storefront-nextjs-shadcn/app/products/[slug]/product-client.tsx +343 -0
- package/templates/storefront-nextjs-shadcn/app/products/page.tsx +25 -0
- package/templates/storefront-nextjs-shadcn/app/products/products-client.tsx +192 -0
- package/templates/storefront-nextjs-shadcn/app/returns/page.tsx +77 -0
- package/templates/storefront-nextjs-shadcn/app/robots.ts +53 -0
- package/templates/storefront-nextjs-shadcn/app/search/page.tsx +16 -0
- package/templates/storefront-nextjs-shadcn/app/search/search-client.tsx +47 -0
- package/templates/storefront-nextjs-shadcn/app/shipping/page.tsx +62 -0
- package/templates/storefront-nextjs-shadcn/app/sitemap.ts +144 -0
- package/templates/storefront-nextjs-shadcn/app/wishlist/page.tsx +179 -0
- package/templates/storefront-nextjs-shadcn/codegen.ts +51 -0
- package/templates/storefront-nextjs-shadcn/components/account/address-form.tsx +348 -0
- package/templates/storefront-nextjs-shadcn/components/account/address-list.tsx +144 -0
- package/templates/storefront-nextjs-shadcn/components/account/order-details.tsx +258 -0
- package/templates/storefront-nextjs-shadcn/components/account/order-history.tsx +107 -0
- package/templates/storefront-nextjs-shadcn/components/auth/account-menu.tsx +132 -0
- package/templates/storefront-nextjs-shadcn/components/auth/login-form.tsx +188 -0
- package/templates/storefront-nextjs-shadcn/components/auth/register-form.tsx +305 -0
- package/templates/storefront-nextjs-shadcn/components/blog/blog-card.tsx +240 -0
- package/templates/storefront-nextjs-shadcn/components/blog/blog-sidebar.tsx +177 -0
- package/templates/storefront-nextjs-shadcn/components/blog/index.ts +8 -0
- package/templates/storefront-nextjs-shadcn/components/brand/brand-card.tsx +119 -0
- package/templates/storefront-nextjs-shadcn/components/brand/brand-grid.tsx +64 -0
- package/templates/storefront-nextjs-shadcn/components/cart/cart-drawer.tsx +140 -0
- package/templates/storefront-nextjs-shadcn/components/cart/cart-icon.tsx +48 -0
- package/templates/storefront-nextjs-shadcn/components/cart/cart-item.tsx +112 -0
- package/templates/storefront-nextjs-shadcn/components/cart/cart-summary.tsx +84 -0
- package/templates/storefront-nextjs-shadcn/components/cart/index.ts +17 -0
- package/templates/storefront-nextjs-shadcn/components/cart/promo-code-input.tsx +121 -0
- package/templates/storefront-nextjs-shadcn/components/cart/shipping-estimator.tsx +162 -0
- package/templates/storefront-nextjs-shadcn/components/checkout/index.ts +25 -0
- package/templates/storefront-nextjs-shadcn/components/checkout/payment-method-card.tsx +187 -0
- package/templates/storefront-nextjs-shadcn/components/checkout/payment-step.tsx +160 -0
- package/templates/storefront-nextjs-shadcn/components/checkout/tax-breakdown.tsx +154 -0
- package/templates/storefront-nextjs-shadcn/components/commerce/currency-selector.tsx +225 -0
- package/templates/storefront-nextjs-shadcn/components/commerce/pagination.tsx +62 -0
- package/templates/storefront-nextjs-shadcn/components/commerce/product-actions.tsx +158 -0
- package/templates/storefront-nextjs-shadcn/components/commerce/search-input.tsx +174 -0
- package/templates/storefront-nextjs-shadcn/components/commerce/variant-selector.tsx +210 -0
- package/templates/storefront-nextjs-shadcn/components/common/category-card.tsx +97 -0
- package/templates/storefront-nextjs-shadcn/components/common/collection-card.tsx +187 -0
- package/templates/storefront-nextjs-shadcn/components/common/price-display.tsx +151 -0
- package/templates/storefront-nextjs-shadcn/components/common/social-share.tsx +166 -0
- package/templates/storefront-nextjs-shadcn/components/discount/discount-breakdown.tsx +245 -0
- package/templates/storefront-nextjs-shadcn/components/discount/discount-code-input.tsx +246 -0
- package/templates/storefront-nextjs-shadcn/components/discount/index.ts +19 -0
- package/templates/storefront-nextjs-shadcn/components/error/error-boundary.tsx +113 -0
- package/templates/storefront-nextjs-shadcn/components/error/index.ts +7 -0
- package/templates/storefront-nextjs-shadcn/components/filters/attribute-filter.tsx +153 -0
- package/templates/storefront-nextjs-shadcn/components/filters/checkbox-group-filter.tsx +167 -0
- package/templates/storefront-nextjs-shadcn/components/filters/color-swatch-filter.tsx +176 -0
- package/templates/storefront-nextjs-shadcn/components/filters/dynamic-attribute-filters.tsx +220 -0
- package/templates/storefront-nextjs-shadcn/components/filters/index.ts +36 -0
- package/templates/storefront-nextjs-shadcn/components/filters/range-slider-filter.tsx +193 -0
- package/templates/storefront-nextjs-shadcn/components/filters/toggle-filter.tsx +132 -0
- package/templates/storefront-nextjs-shadcn/components/gift-card/gift-card-balance.tsx +321 -0
- package/templates/storefront-nextjs-shadcn/components/gift-card/gift-card-input.tsx +309 -0
- package/templates/storefront-nextjs-shadcn/components/gift-card/index.ts +24 -0
- package/templates/storefront-nextjs-shadcn/components/home/category-grid.tsx +72 -0
- package/templates/storefront-nextjs-shadcn/components/home/featured-collections.tsx +107 -0
- package/templates/storefront-nextjs-shadcn/components/home/featured-products.tsx +85 -0
- package/templates/storefront-nextjs-shadcn/components/home/hero-section.tsx +34 -0
- package/templates/storefront-nextjs-shadcn/components/home/index.ts +8 -0
- package/templates/storefront-nextjs-shadcn/components/home/newsletter-signup.tsx +108 -0
- package/templates/storefront-nextjs-shadcn/components/layout/breadcrumbs.tsx +133 -0
- package/templates/storefront-nextjs-shadcn/components/layout/currency-selector.tsx +341 -0
- package/templates/storefront-nextjs-shadcn/components/layout/footer.tsx +128 -0
- package/templates/storefront-nextjs-shadcn/components/layout/header.tsx +147 -0
- package/templates/storefront-nextjs-shadcn/components/layout/index.ts +9 -0
- package/templates/storefront-nextjs-shadcn/components/layout/mobile-menu.tsx +211 -0
- package/templates/storefront-nextjs-shadcn/components/layout/navigation.tsx +95 -0
- package/templates/storefront-nextjs-shadcn/components/layout/theme-switcher.tsx +192 -0
- package/templates/storefront-nextjs-shadcn/components/loyalty/index.ts +11 -0
- package/templates/storefront-nextjs-shadcn/components/loyalty/points-balance.tsx +93 -0
- package/templates/storefront-nextjs-shadcn/components/loyalty/points-history.tsx +177 -0
- package/templates/storefront-nextjs-shadcn/components/loyalty/referral-section.tsx +250 -0
- package/templates/storefront-nextjs-shadcn/components/loyalty/rewards-catalog.tsx +217 -0
- package/templates/storefront-nextjs-shadcn/components/loyalty/tier-badge.tsx +106 -0
- package/templates/storefront-nextjs-shadcn/components/loyalty/tier-progress.tsx +131 -0
- package/templates/storefront-nextjs-shadcn/components/order/delivery-estimate.tsx +196 -0
- package/templates/storefront-nextjs-shadcn/components/order/index.ts +11 -0
- package/templates/storefront-nextjs-shadcn/components/order/order-tracking.tsx +200 -0
- package/templates/storefront-nextjs-shadcn/components/order/shipment-card.tsx +407 -0
- package/templates/storefront-nextjs-shadcn/components/order/tracking-status.tsx +222 -0
- package/templates/storefront-nextjs-shadcn/components/order/tracking-timeline.tsx +205 -0
- package/templates/storefront-nextjs-shadcn/components/product/add-to-cart-button.tsx +161 -0
- package/templates/storefront-nextjs-shadcn/components/product/b2b-price-display.tsx +250 -0
- package/templates/storefront-nextjs-shadcn/components/product/discount-badge.tsx +196 -0
- package/templates/storefront-nextjs-shadcn/components/product/index.ts +41 -0
- package/templates/storefront-nextjs-shadcn/components/product/product-card.tsx +147 -0
- package/templates/storefront-nextjs-shadcn/components/product/product-filters.tsx +217 -0
- package/templates/storefront-nextjs-shadcn/components/product/product-gallery.tsx +143 -0
- package/templates/storefront-nextjs-shadcn/components/product/product-grid.tsx +83 -0
- package/templates/storefront-nextjs-shadcn/components/product/product-image.tsx +155 -0
- package/templates/storefront-nextjs-shadcn/components/product/product-price.tsx +158 -0
- package/templates/storefront-nextjs-shadcn/components/product/product-quantity-selector.tsx +111 -0
- package/templates/storefront-nextjs-shadcn/components/product/product-reviews.tsx +238 -0
- package/templates/storefront-nextjs-shadcn/components/product/product-sort.tsx +58 -0
- package/templates/storefront-nextjs-shadcn/components/product/product-variant-selector.tsx +169 -0
- package/templates/storefront-nextjs-shadcn/components/product/review-card.tsx +220 -0
- package/templates/storefront-nextjs-shadcn/components/product/review-form.tsx +338 -0
- package/templates/storefront-nextjs-shadcn/components/product/review-summary.tsx +143 -0
- package/templates/storefront-nextjs-shadcn/components/product/sale-countdown.tsx +166 -0
- package/templates/storefront-nextjs-shadcn/components/product/savings-display.tsx +213 -0
- package/templates/storefront-nextjs-shadcn/components/product/similar-products.tsx +57 -0
- package/templates/storefront-nextjs-shadcn/components/product/stock-indicator.tsx +91 -0
- package/templates/storefront-nextjs-shadcn/components/providers/currency-provider.tsx +103 -0
- package/templates/storefront-nextjs-shadcn/components/providers/index.ts +8 -0
- package/templates/storefront-nextjs-shadcn/components/providers/query-provider.tsx +260 -0
- package/templates/storefront-nextjs-shadcn/components/providers/theme-provider.tsx +13 -0
- package/templates/storefront-nextjs-shadcn/components/returns/index.ts +26 -0
- package/templates/storefront-nextjs-shadcn/components/returns/return-request-form.tsx +608 -0
- package/templates/storefront-nextjs-shadcn/components/returns/return-status-card.tsx +554 -0
- package/templates/storefront-nextjs-shadcn/components/search/index.ts +8 -0
- package/templates/storefront-nextjs-shadcn/components/search/search-bar.tsx +140 -0
- package/templates/storefront-nextjs-shadcn/components/search/search-results.tsx +58 -0
- package/templates/storefront-nextjs-shadcn/components/search/search-suggestions.tsx +43 -0
- package/templates/storefront-nextjs-shadcn/components/seo/index.ts +12 -0
- package/templates/storefront-nextjs-shadcn/components/seo/json-ld.tsx +56 -0
- package/templates/storefront-nextjs-shadcn/components/seo/product-json-ld.ts +167 -0
- package/templates/storefront-nextjs-shadcn/components/shipping/index.ts +16 -0
- package/templates/storefront-nextjs-shadcn/components/shipping/shipping-method-selector.tsx +337 -0
- package/templates/storefront-nextjs-shadcn/components/ui/accordion.tsx +153 -0
- package/templates/storefront-nextjs-shadcn/components/ui/alert.tsx +59 -0
- package/templates/storefront-nextjs-shadcn/components/ui/badge.tsx +34 -0
- package/templates/storefront-nextjs-shadcn/components/ui/button.tsx +51 -0
- package/templates/storefront-nextjs-shadcn/components/ui/card.tsx +77 -0
- package/templates/storefront-nextjs-shadcn/components/ui/checkbox.tsx +30 -0
- package/templates/storefront-nextjs-shadcn/components/ui/dialog.tsx +137 -0
- package/templates/storefront-nextjs-shadcn/components/ui/empty-state.tsx +207 -0
- package/templates/storefront-nextjs-shadcn/components/ui/index.ts +67 -0
- package/templates/storefront-nextjs-shadcn/components/ui/input.tsx +65 -0
- package/templates/storefront-nextjs-shadcn/components/ui/label.tsx +26 -0
- package/templates/storefront-nextjs-shadcn/components/ui/pagination.tsx +205 -0
- package/templates/storefront-nextjs-shadcn/components/ui/radio-group.tsx +44 -0
- package/templates/storefront-nextjs-shadcn/components/ui/select.tsx +160 -0
- package/templates/storefront-nextjs-shadcn/components/ui/separator.tsx +28 -0
- package/templates/storefront-nextjs-shadcn/components/ui/skeleton.tsx +20 -0
- package/templates/storefront-nextjs-shadcn/components/ui/spinner.tsx +82 -0
- package/templates/storefront-nextjs-shadcn/components/ui/tabs.tsx +119 -0
- package/templates/storefront-nextjs-shadcn/components/ui/toast.tsx +96 -0
- package/templates/storefront-nextjs-shadcn/components/wishlist/index.ts +9 -0
- package/templates/storefront-nextjs-shadcn/components/wishlist/wishlist-button.tsx +148 -0
- package/templates/storefront-nextjs-shadcn/components/wishlist/wishlist-icon.tsx +47 -0
- package/templates/storefront-nextjs-shadcn/components/wishlist/wishlist-item.tsx +165 -0
- package/templates/storefront-nextjs-shadcn/components.json +19 -0
- package/templates/storefront-nextjs-shadcn/generated/.gitkeep +2 -0
- package/templates/storefront-nextjs-shadcn/graphql/.gitkeep +31 -0
- package/templates/storefront-nextjs-shadcn/graphql/collections.example.ts +168 -0
- package/templates/storefront-nextjs-shadcn/graphql/products.example.ts +160 -0
- package/templates/storefront-nextjs-shadcn/hooks/index.ts +9 -0
- package/templates/storefront-nextjs-shadcn/hooks/use-auth.ts +310 -0
- package/templates/storefront-nextjs-shadcn/hooks/use-cart-actions.ts +286 -0
- package/templates/storefront-nextjs-shadcn/hooks/use-cart-sync.ts +110 -0
- package/templates/storefront-nextjs-shadcn/hooks/use-filter-params.test.ts +173 -0
- package/templates/storefront-nextjs-shadcn/hooks/use-filter-params.ts +298 -0
- package/templates/storefront-nextjs-shadcn/lib/auth/cookies.ts +220 -0
- package/templates/storefront-nextjs-shadcn/lib/auth/routes.ts +57 -0
- package/templates/storefront-nextjs-shadcn/lib/config.ts +46 -0
- package/templates/storefront-nextjs-shadcn/lib/currency/IMPLEMENTATION_SUMMARY.md +254 -0
- package/templates/storefront-nextjs-shadcn/lib/currency/README.md +464 -0
- package/templates/storefront-nextjs-shadcn/lib/currency/cookie-manager.test.ts +328 -0
- package/templates/storefront-nextjs-shadcn/lib/currency/cookie-manager.ts +295 -0
- package/templates/storefront-nextjs-shadcn/lib/currency/index.ts +27 -0
- package/templates/storefront-nextjs-shadcn/lib/format.test.ts +397 -0
- package/templates/storefront-nextjs-shadcn/lib/format.ts +226 -0
- package/templates/storefront-nextjs-shadcn/lib/graphql/client.ts +109 -0
- package/templates/storefront-nextjs-shadcn/lib/graphql/hooks.ts +1183 -0
- package/templates/storefront-nextjs-shadcn/lib/graphql/server.ts +267 -0
- package/templates/storefront-nextjs-shadcn/lib/hooks.ts +30 -0
- package/templates/storefront-nextjs-shadcn/lib/theme/theme-config.ts +89 -0
- package/templates/storefront-nextjs-shadcn/lib/utils.ts +6 -0
- package/templates/storefront-nextjs-shadcn/next.config.ts +47 -0
- package/templates/storefront-nextjs-shadcn/open-next.config.ts +3 -0
- package/templates/storefront-nextjs-shadcn/package.dev.json +30 -0
- package/templates/storefront-nextjs-shadcn/package.json +60 -0
- package/templates/storefront-nextjs-shadcn/package.json.template +46 -0
- package/templates/storefront-nextjs-shadcn/postcss.config.mjs +8 -0
- package/templates/storefront-nextjs-shadcn/proxy.ts +80 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/apple-pay.svg +8 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/bank-transfer.svg +10 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/blik.svg +6 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/cash-on-delivery.svg +11 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/google-pay.svg +11 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/mastercard.svg +7 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/paypal.svg +7 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/payu.svg +7 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/przelewy24.svg +7 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/stripe.svg +4 -0
- package/templates/storefront-nextjs-shadcn/public/icons/payment/visa.svg +5 -0
- package/templates/storefront-nextjs-shadcn/stores/auth-store.ts +66 -0
- package/templates/storefront-nextjs-shadcn/stores/cart-store.ts +56 -0
- package/templates/storefront-nextjs-shadcn/stores/checkout-store.ts +184 -0
- package/templates/storefront-nextjs-shadcn/stores/currency-store.ts +103 -0
- package/templates/storefront-nextjs-shadcn/stores/wishlist-store.ts +291 -0
- package/templates/storefront-nextjs-shadcn/tailwind.config.ts +111 -0
- package/templates/storefront-nextjs-shadcn/tsconfig.json +27 -0
- package/templates/storefront-nextjs-shadcn/wrangler.toml +9 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-server.js","sourceRoot":"","sources":["../../src/lib/proxy-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAmC,MAAM,MAAM,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAkBrC,MAAM,WAAW,GAAsB,EAAE,CAAC;AAE1C;;GAEG;AACH,SAAS,cAAc,CAAC,KAAsB;IAC5C,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;IACvG,MAAM,WAAW,GAAG;QAClB,GAAG,EAAE,KAAK,CAAC,IAAI;QACf,IAAI,EAAE,KAAK,CAAC,KAAK;QACjB,GAAG,EAAE,KAAK,CAAC,MAAM;QACjB,KAAK,EAAE,KAAK,CAAC,MAAM;QACnB,MAAM,EAAE,KAAK,CAAC,GAAG;KAClB,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC;IAE/B,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CA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C,CAAC;YAClE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACxC,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;QAEH,kBAAkB;QAClB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACxB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,oCAAoC,CAAC,CAAC,CAAC;YAChE,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom select prompt with left arrow back navigation
|
|
3
|
+
* Extends @clack/core to add keyboard-based back navigation
|
|
4
|
+
*/
|
|
5
|
+
export declare const BACK: unique symbol;
|
|
6
|
+
export interface SelectOption<T> {
|
|
7
|
+
value: T;
|
|
8
|
+
label: string;
|
|
9
|
+
hint?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface SelectWithBackOptions<T> {
|
|
12
|
+
message: string;
|
|
13
|
+
options: SelectOption<T>[];
|
|
14
|
+
canGoBack?: boolean;
|
|
15
|
+
initialValue?: T;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Custom select prompt that returns BACK symbol when left arrow is pressed.
|
|
19
|
+
* Provides beautiful @clack-style UI with keyboard navigation hints.
|
|
20
|
+
*/
|
|
21
|
+
export declare function selectWithBack<T>(opts: SelectWithBackOptions<T>): Promise<T | typeof BACK | symbol>;
|
|
22
|
+
/**
|
|
23
|
+
* Check if value is the BACK symbol
|
|
24
|
+
*/
|
|
25
|
+
export declare function isBack(value: unknown): value is typeof BACK;
|
|
26
|
+
/**
|
|
27
|
+
* Check if value is a cancel symbol (Ctrl+C)
|
|
28
|
+
*/
|
|
29
|
+
export declare function isCancel(value: unknown): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Check if value is either BACK or cancel
|
|
32
|
+
*/
|
|
33
|
+
export declare function isCancelOrBack(value: unknown): boolean;
|
|
34
|
+
//# sourceMappingURL=select-with-back.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-with-back.d.ts","sourceRoot":"","sources":["../../src/lib/select-with-back.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,eAAO,MAAM,IAAI,eAA2B,CAAC;AAE7C,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,CAAC;CAClB;AAID;;;GAGG;AACH,wBAAsB,cAAc,CAAC,CAAC,EACpC,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAC7B,OAAO,CAAC,CAAC,GAAG,OAAO,IAAI,GAAG,MAAM,CAAC,CAkEnC;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,IAAI,CAE3D;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEhD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEtD"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom select prompt with left arrow back navigation
|
|
3
|
+
* Extends @clack/core to add keyboard-based back navigation
|
|
4
|
+
*/
|
|
5
|
+
import { SelectPrompt, isCancel as clackIsCancel } from '@clack/core';
|
|
6
|
+
import pc from 'picocolors';
|
|
7
|
+
import { t } from './i18n.js';
|
|
8
|
+
// Special symbol returned when user presses left arrow to go back
|
|
9
|
+
export const BACK = Symbol.for('clack.back');
|
|
10
|
+
/**
|
|
11
|
+
* Custom select prompt that returns BACK symbol when left arrow is pressed.
|
|
12
|
+
* Provides beautiful @clack-style UI with keyboard navigation hints.
|
|
13
|
+
*/
|
|
14
|
+
export async function selectWithBack(opts) {
|
|
15
|
+
const { message, options, canGoBack = false, initialValue } = opts;
|
|
16
|
+
// Find initial cursor position
|
|
17
|
+
let initialCursor = 0;
|
|
18
|
+
if (initialValue !== undefined) {
|
|
19
|
+
const idx = options.findIndex((o) => o.value === initialValue);
|
|
20
|
+
if (idx >= 0)
|
|
21
|
+
initialCursor = idx;
|
|
22
|
+
}
|
|
23
|
+
return new Promise((resolve) => {
|
|
24
|
+
let backTriggered = false;
|
|
25
|
+
const prompt = new SelectPrompt({
|
|
26
|
+
options: options.map((o) => ({
|
|
27
|
+
value: o.value, // @clack/core expects string values
|
|
28
|
+
label: o.label,
|
|
29
|
+
hint: o.hint,
|
|
30
|
+
})),
|
|
31
|
+
initialValue: String(initialCursor),
|
|
32
|
+
render() {
|
|
33
|
+
// Build the prompt display
|
|
34
|
+
const title = `${pc.cyan('◆')} ${message}`;
|
|
35
|
+
// Render options
|
|
36
|
+
const optionLines = options
|
|
37
|
+
.map((opt, i) => {
|
|
38
|
+
const isSelected = i === this.cursor;
|
|
39
|
+
const bullet = isSelected ? pc.green('●') : pc.dim('○');
|
|
40
|
+
const label = isSelected ? opt.label : pc.dim(opt.label);
|
|
41
|
+
const hint = opt.hint ? pc.dim(` (${opt.hint})`) : '';
|
|
42
|
+
return `│ ${bullet} ${label}${hint}`;
|
|
43
|
+
})
|
|
44
|
+
.join('\n');
|
|
45
|
+
// Footer with navigation hints
|
|
46
|
+
const backHint = canGoBack ? `${pc.dim('←')} ${pc.dim(t().back)}` : '';
|
|
47
|
+
const cancelHint = pc.dim(t().cancelHint);
|
|
48
|
+
const separator = canGoBack ? ` ${pc.dim('·')} ` : '';
|
|
49
|
+
const footer = `│\n└ ${backHint}${separator}${cancelHint}`;
|
|
50
|
+
return `${title}\n${optionLines}\n${footer}`;
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
// Listen for cursor events - left arrow triggers back
|
|
54
|
+
prompt.on('cursor', (key) => {
|
|
55
|
+
if (key === 'left' && canGoBack && !backTriggered) {
|
|
56
|
+
backTriggered = true;
|
|
57
|
+
// Force the prompt to close by changing state
|
|
58
|
+
prompt.state = 'cancel';
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
prompt.prompt().then((value) => {
|
|
62
|
+
if (backTriggered) {
|
|
63
|
+
resolve(BACK);
|
|
64
|
+
}
|
|
65
|
+
else if (clackIsCancel(value)) {
|
|
66
|
+
resolve(value);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
// Value from @clack/core is the string value, find the actual option
|
|
70
|
+
const selectedOption = options.find((o) => String(o.value) === value) ?? options[0];
|
|
71
|
+
resolve(selectedOption.value);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Check if value is the BACK symbol
|
|
78
|
+
*/
|
|
79
|
+
export function isBack(value) {
|
|
80
|
+
return value === BACK;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Check if value is a cancel symbol (Ctrl+C)
|
|
84
|
+
*/
|
|
85
|
+
export function isCancel(value) {
|
|
86
|
+
return clackIsCancel(value);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Check if value is either BACK or cancel
|
|
90
|
+
*/
|
|
91
|
+
export function isCancelOrBack(value) {
|
|
92
|
+
return isBack(value) || isCancel(value);
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=select-with-back.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-with-back.js","sourceRoot":"","sources":["../../src/lib/select-with-back.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AACtE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAE9B,kEAAkE;AAClE,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AAiB7C;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAA8B;IAE9B,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,GAAG,KAAK,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC;IAEnE,+BAA+B;IAC/B,IAAI,aAAa,GAAG,CAAC,CAAC;IACtB,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC;QAC/D,IAAI,GAAG,IAAI,CAAC;YAAE,aAAa,GAAG,GAAG,CAAC;IACpC,CAAC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,aAAa,GAAG,KAAK,CAAC;QAE1B,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC;YAC9B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC3B,KAAK,EAAE,CAAC,CAAC,KAA0B,EAAE,oCAAoC;gBACzE,KAAK,EAAE,CAAC,CAAC,KAAK;gBACd,IAAI,EAAE,CAAC,CAAC,IAAI;aACb,CAAC,CAAC;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,OAAO,aAAa,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* Get the authentication token from available sources.
|
|
4
|
+
* Priority:
|
|
5
|
+
* 1. DOSWIFTLY_DEPLOY_TOKEN env var (CI/CD deploy tokens)
|
|
6
|
+
* 2. Stored session token from `doswiftly auth login`
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAuthenticatedToken(): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Require authentication — returns token or throws.
|
|
11
|
+
* Use this in commands that must be authenticated.
|
|
12
|
+
*/
|
|
13
|
+
export declare function requireAuth(): string;
|
|
14
|
+
export interface SharedApiClientOptions {
|
|
15
|
+
/**
|
|
16
|
+
* Whether to require shop slug from doswiftly.config.ts.
|
|
17
|
+
* Set to false for platform-level operations (e.g., template commands).
|
|
18
|
+
* Default: true
|
|
19
|
+
*/
|
|
20
|
+
requireShopSlug?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create a shared, authenticated axios API client.
|
|
24
|
+
*
|
|
25
|
+
* Resolution chain:
|
|
26
|
+
* - shopSlug: local doswiftly.config.ts → shop.slug (required by default)
|
|
27
|
+
* - apiUrl: env DOSWIFTLY_API_URL → local config api.url → profile apiUrl → default
|
|
28
|
+
*
|
|
29
|
+
* The client includes:
|
|
30
|
+
* - Authorization: Bearer {token}
|
|
31
|
+
* - X-Shop-Slug: {shopSlug} from local config (if available and required)
|
|
32
|
+
* - X-CLI-Version: {version} from package.json
|
|
33
|
+
* - Content-Type: application/json
|
|
34
|
+
*
|
|
35
|
+
* Throws if:
|
|
36
|
+
* - No authentication token is available
|
|
37
|
+
* - No doswiftly.config.ts with shop.slug is found (unless requireShopSlug: false)
|
|
38
|
+
*/
|
|
39
|
+
export declare function createSharedApiClient(options?: SharedApiClientOptions): AxiosInstance;
|
|
40
|
+
//# sourceMappingURL=shared-api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-api-client.d.ts","sourceRoot":"","sources":["../../src/lib/shared-api-client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAqB7C;;;;;GAKG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAOrD;AAED;;;GAGG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAQpC;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,CAAC,EAAE,sBAAsB,GAAG,aAAa,CAyCrF"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { getLocalShopSlug, getLocalApiUrl } from './config.js';
|
|
3
|
+
import { getStoredToken } from '../commands/auth.js';
|
|
4
|
+
import { getApiUrl } from './api-url.js';
|
|
5
|
+
import { readFileSync } from 'fs';
|
|
6
|
+
import { join, dirname } from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
/**
|
|
9
|
+
* Read CLI version from package.json
|
|
10
|
+
*/
|
|
11
|
+
function getCLIVersion() {
|
|
12
|
+
try {
|
|
13
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '../../package.json'), 'utf-8'));
|
|
15
|
+
return pkg.version || '0.0.0';
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return '0.0.0';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the authentication token from available sources.
|
|
23
|
+
* Priority:
|
|
24
|
+
* 1. DOSWIFTLY_DEPLOY_TOKEN env var (CI/CD deploy tokens)
|
|
25
|
+
* 2. Stored session token from `doswiftly auth login`
|
|
26
|
+
*/
|
|
27
|
+
export function getAuthenticatedToken() {
|
|
28
|
+
const deployToken = process.env.DOSWIFTLY_DEPLOY_TOKEN;
|
|
29
|
+
if (deployToken) {
|
|
30
|
+
return deployToken;
|
|
31
|
+
}
|
|
32
|
+
return getStoredToken();
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Require authentication — returns token or throws.
|
|
36
|
+
* Use this in commands that must be authenticated.
|
|
37
|
+
*/
|
|
38
|
+
export function requireAuth() {
|
|
39
|
+
const token = getAuthenticatedToken();
|
|
40
|
+
if (!token) {
|
|
41
|
+
throw new Error('Not authenticated. Run "doswiftly auth login" to authenticate, or set DOSWIFTLY_DEPLOY_TOKEN for CI/CD.');
|
|
42
|
+
}
|
|
43
|
+
return token;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Create a shared, authenticated axios API client.
|
|
47
|
+
*
|
|
48
|
+
* Resolution chain:
|
|
49
|
+
* - shopSlug: local doswiftly.config.ts → shop.slug (required by default)
|
|
50
|
+
* - apiUrl: env DOSWIFTLY_API_URL → local config api.url → profile apiUrl → default
|
|
51
|
+
*
|
|
52
|
+
* The client includes:
|
|
53
|
+
* - Authorization: Bearer {token}
|
|
54
|
+
* - X-Shop-Slug: {shopSlug} from local config (if available and required)
|
|
55
|
+
* - X-CLI-Version: {version} from package.json
|
|
56
|
+
* - Content-Type: application/json
|
|
57
|
+
*
|
|
58
|
+
* Throws if:
|
|
59
|
+
* - No authentication token is available
|
|
60
|
+
* - No doswiftly.config.ts with shop.slug is found (unless requireShopSlug: false)
|
|
61
|
+
*/
|
|
62
|
+
export function createSharedApiClient(options) {
|
|
63
|
+
const token = requireAuth();
|
|
64
|
+
// 1. Shop slug: local config (required by default, optional for platform operations)
|
|
65
|
+
const shopSlug = getLocalShopSlug();
|
|
66
|
+
const shouldRequireShopSlug = options?.requireShopSlug !== false;
|
|
67
|
+
if (shouldRequireShopSlug && !shopSlug) {
|
|
68
|
+
throw new Error('No doswiftly.config.ts found. Run "doswiftly init" in a project directory, or create doswiftly.config.ts manually.');
|
|
69
|
+
}
|
|
70
|
+
// 2. API URL: env → local config → profile → default
|
|
71
|
+
const localApiUrl = getLocalApiUrl();
|
|
72
|
+
const apiUrl = localApiUrl || getApiUrl();
|
|
73
|
+
// Validate URL before creating client
|
|
74
|
+
if (!apiUrl || typeof apiUrl !== 'string' || !apiUrl.startsWith('http')) {
|
|
75
|
+
throw new Error(`Invalid API URL: "${apiUrl}". ` +
|
|
76
|
+
`Check your profile configuration with "doswiftly env list" or set DOSWIFTLY_API_URL environment variable.`);
|
|
77
|
+
}
|
|
78
|
+
const client = axios.create({
|
|
79
|
+
baseURL: apiUrl,
|
|
80
|
+
headers: {
|
|
81
|
+
'Content-Type': 'application/json',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
client.defaults.headers.common['Authorization'] = `Bearer ${token}`;
|
|
85
|
+
client.defaults.headers.common['X-CLI-Version'] = getCLIVersion();
|
|
86
|
+
// Only set X-Shop-Slug if available
|
|
87
|
+
if (shopSlug) {
|
|
88
|
+
client.defaults.headers.common['X-Shop-Slug'] = shopSlug;
|
|
89
|
+
}
|
|
90
|
+
return client;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=shared-api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-api-client.js","sourceRoot":"","sources":["../../src/lib/shared-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,C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qBAAqB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CACb,oHAAoH,CACrH,CAAC;IACJ,CAAC;IAED,qDAAqD;IACrD,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,MAAM,GAAG,WAAW,IAAI,SAAS,EAAE,CAAC;IAE1C,sCAAsC;IACtC,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CACb,qBAAqB,MAAM,KAAK;YAChC,2GAA2G,CAC5G,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC1B,OAAO,EAAE,MAAM;QACf,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;SACnC;KACF,CAAC,CAAC;IAEH,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,UAAU,KAAK,EAAE,CAAC;IACpE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,GAAG,aAAa,EAAE,CAAC;IAElE,oCAAoC;IACpC,IAAI,QAAQ,EAAE,CAAC;QACb,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC;IAC3D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wizard Engine - manages multi-step wizard flows with back navigation
|
|
3
|
+
* Provides progress display, state management, and step transitions
|
|
4
|
+
*/
|
|
5
|
+
import { BACK } from './select-with-back.js';
|
|
6
|
+
/**
|
|
7
|
+
* Clear the terminal screen
|
|
8
|
+
*/
|
|
9
|
+
export declare function clearScreen(): void;
|
|
10
|
+
export { BACK, isBack, isCancel, selectWithBack } from './select-with-back.js';
|
|
11
|
+
export { isCancel as clackIsCancel } from '@clack/prompts';
|
|
12
|
+
/**
|
|
13
|
+
* Result of executing a wizard step
|
|
14
|
+
*/
|
|
15
|
+
export type StepResult<TState> = {
|
|
16
|
+
action: 'next';
|
|
17
|
+
updates?: Partial<TState>;
|
|
18
|
+
} | {
|
|
19
|
+
action: 'back';
|
|
20
|
+
} | {
|
|
21
|
+
action: 'cancel';
|
|
22
|
+
} | {
|
|
23
|
+
action: 'skip';
|
|
24
|
+
updates?: Partial<TState>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Context passed to each step during execution
|
|
28
|
+
*/
|
|
29
|
+
export interface WizardContext {
|
|
30
|
+
/** Current step index (0-based) */
|
|
31
|
+
stepIndex: number;
|
|
32
|
+
/** Total number of steps */
|
|
33
|
+
totalSteps: number;
|
|
34
|
+
/** Whether the user can go back from this step */
|
|
35
|
+
canGoBack: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Custom progress display for a step
|
|
39
|
+
*/
|
|
40
|
+
export interface StepProgress {
|
|
41
|
+
/** Current step number (1-based) */
|
|
42
|
+
current: number;
|
|
43
|
+
/** Total number of steps */
|
|
44
|
+
total: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Definition of a wizard step
|
|
48
|
+
*/
|
|
49
|
+
export interface WizardStep<TState> {
|
|
50
|
+
/** Unique step identifier */
|
|
51
|
+
id: string;
|
|
52
|
+
/** Step title (function for i18n support) */
|
|
53
|
+
title: () => string;
|
|
54
|
+
/** State keys this step manages (cleared on back navigation) */
|
|
55
|
+
stateKeys: (keyof TState)[];
|
|
56
|
+
/** Whether back navigation is allowed from this step (default: true) */
|
|
57
|
+
canGoBack?: boolean;
|
|
58
|
+
/** Custom progress display based on current state (optional) */
|
|
59
|
+
getProgress?: (state: TState, defaultProgress: StepProgress) => StepProgress;
|
|
60
|
+
/** Execute the step and return result */
|
|
61
|
+
execute: (state: TState, ctx: WizardContext) => Promise<StepResult<TState>>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Wizard engine configuration
|
|
65
|
+
*/
|
|
66
|
+
export interface WizardConfig<TState> {
|
|
67
|
+
/** Wizard title displayed at start */
|
|
68
|
+
title?: string;
|
|
69
|
+
/** Message shown when wizard is cancelled */
|
|
70
|
+
cancelMessage?: string;
|
|
71
|
+
/** Message shown when wizard completes successfully */
|
|
72
|
+
successMessage?: string;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* WizardEngine - orchestrates multi-step wizard flows
|
|
76
|
+
*
|
|
77
|
+
* Features:
|
|
78
|
+
* - Progress indicator (●●○○○)
|
|
79
|
+
* - Back navigation with state clearing
|
|
80
|
+
* - Cancel handling
|
|
81
|
+
* - Skip step support (for auto-selections)
|
|
82
|
+
*/
|
|
83
|
+
export declare class WizardEngine<TState extends object> {
|
|
84
|
+
private steps;
|
|
85
|
+
private state;
|
|
86
|
+
private currentIndex;
|
|
87
|
+
private config;
|
|
88
|
+
constructor(steps: WizardStep<TState>[], initialState: TState, config?: WizardConfig<TState>);
|
|
89
|
+
/**
|
|
90
|
+
* Get the current wizard state (read-only view)
|
|
91
|
+
*/
|
|
92
|
+
getState(): Readonly<TState>;
|
|
93
|
+
/**
|
|
94
|
+
* Run the wizard from the beginning
|
|
95
|
+
* @returns Final state if completed, null if cancelled
|
|
96
|
+
*/
|
|
97
|
+
run(): Promise<TState | null>;
|
|
98
|
+
/**
|
|
99
|
+
* Display progress indicator for current step
|
|
100
|
+
*/
|
|
101
|
+
private showProgress;
|
|
102
|
+
/**
|
|
103
|
+
* Clear state keys managed by a step
|
|
104
|
+
*/
|
|
105
|
+
private clearStepState;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Helper to create a step result for moving to next step
|
|
109
|
+
*/
|
|
110
|
+
export declare function next<TState>(updates?: Partial<TState>): StepResult<TState>;
|
|
111
|
+
/**
|
|
112
|
+
* Helper to create a step result for going back
|
|
113
|
+
*/
|
|
114
|
+
export declare function back<TState>(): StepResult<TState>;
|
|
115
|
+
/**
|
|
116
|
+
* Helper to create a step result for cancelling
|
|
117
|
+
*/
|
|
118
|
+
export declare function cancel<TState>(): StepResult<TState>;
|
|
119
|
+
/**
|
|
120
|
+
* Helper to create a step result for skipping (auto-selection)
|
|
121
|
+
*/
|
|
122
|
+
export declare function skip<TState>(updates?: Partial<TState>): StepResult<TState>;
|
|
123
|
+
/**
|
|
124
|
+
* Handle a prompt value that might be BACK or cancel
|
|
125
|
+
* Returns the appropriate StepResult
|
|
126
|
+
*/
|
|
127
|
+
export declare function handlePromptValue<T, TState>(value: T | typeof BACK | symbol, onValue: (val: T) => StepResult<TState>): StepResult<TState>;
|
|
128
|
+
//# sourceMappingURL=wizard-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizard-engine.d.ts","sourceRoot":"","sources":["../../src/lib/wizard-engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,IAAI,EAAoC,MAAM,uBAAuB,CAAC;AAE/E;;GAEG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAGlC;AAGD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,UAAU,CAAC,MAAM,IACzB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,GAC7C;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAClB;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GACpB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAElD;;GAEG;AACH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CAAC,EAAE,EAC3B,YAAY,EAAE,MAAM,EACpB,MAAM,GAAE,YAAY,CAAC,MAAM,CAAM;IAOnC;;OAEG;IACH,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC;IAI5B;;;OAGG;IACG,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IA8DnC;;OAEG;IACH,OAAO,CAAC,YAAY;IAwBpB;;OAEG;IACH,OAAO,CAAC,cAAc;CAKvB;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAE1E;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,CAAC,CAEjD;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,CAAC,CAEnD;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,CAE1E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EACzC,KAAK,EAAE,CAAC,GAAG,OAAO,IAAI,GAAG,MAAM,EAC/B,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,UAAU,CAAC,MAAM,CAAC,GACtC,UAAU,CAAC,MAAM,CAAC,CAQpB"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wizard Engine - manages multi-step wizard flows with back navigation
|
|
3
|
+
* Provides progress display, state management, and step transitions
|
|
4
|
+
*/
|
|
5
|
+
import * as p from '@clack/prompts';
|
|
6
|
+
import pc from 'picocolors';
|
|
7
|
+
import { t } from './i18n.js';
|
|
8
|
+
import { isBack, isCancel } from './select-with-back.js';
|
|
9
|
+
/**
|
|
10
|
+
* Clear the terminal screen
|
|
11
|
+
*/
|
|
12
|
+
export function clearScreen() {
|
|
13
|
+
// Move cursor to top-left and clear screen
|
|
14
|
+
process.stdout.write('\x1B[2J\x1B[0f');
|
|
15
|
+
}
|
|
16
|
+
// Re-export for convenience
|
|
17
|
+
export { BACK, isBack, isCancel, selectWithBack } from './select-with-back.js';
|
|
18
|
+
export { isCancel as clackIsCancel } from '@clack/prompts';
|
|
19
|
+
/**
|
|
20
|
+
* WizardEngine - orchestrates multi-step wizard flows
|
|
21
|
+
*
|
|
22
|
+
* Features:
|
|
23
|
+
* - Progress indicator (●●○○○)
|
|
24
|
+
* - Back navigation with state clearing
|
|
25
|
+
* - Cancel handling
|
|
26
|
+
* - Skip step support (for auto-selections)
|
|
27
|
+
*/
|
|
28
|
+
export class WizardEngine {
|
|
29
|
+
steps;
|
|
30
|
+
state;
|
|
31
|
+
currentIndex = 0;
|
|
32
|
+
config;
|
|
33
|
+
constructor(steps, initialState, config = {}) {
|
|
34
|
+
this.steps = steps;
|
|
35
|
+
this.state = { ...initialState };
|
|
36
|
+
this.config = config;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Get the current wizard state (read-only view)
|
|
40
|
+
*/
|
|
41
|
+
getState() {
|
|
42
|
+
return this.state;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Run the wizard from the beginning
|
|
46
|
+
* @returns Final state if completed, null if cancelled
|
|
47
|
+
*/
|
|
48
|
+
async run() {
|
|
49
|
+
const title = this.config.title || t().wizardTitle;
|
|
50
|
+
// Run step loop
|
|
51
|
+
while (this.currentIndex < this.steps.length) {
|
|
52
|
+
const step = this.steps[this.currentIndex];
|
|
53
|
+
const canGoBack = this.currentIndex > 0 && step.canGoBack !== false;
|
|
54
|
+
// Clear screen and show intro + progress for clean UI
|
|
55
|
+
clearScreen();
|
|
56
|
+
p.intro(pc.bgCyan(pc.black(` ${title} `)));
|
|
57
|
+
this.showProgress(step);
|
|
58
|
+
// Build context
|
|
59
|
+
const ctx = {
|
|
60
|
+
stepIndex: this.currentIndex,
|
|
61
|
+
totalSteps: this.steps.length,
|
|
62
|
+
canGoBack,
|
|
63
|
+
};
|
|
64
|
+
// Execute step
|
|
65
|
+
const result = await step.execute(this.state, ctx);
|
|
66
|
+
// Handle result
|
|
67
|
+
switch (result.action) {
|
|
68
|
+
case 'cancel':
|
|
69
|
+
p.cancel(this.config.cancelMessage || t().cancelled);
|
|
70
|
+
return null;
|
|
71
|
+
case 'back':
|
|
72
|
+
if (canGoBack) {
|
|
73
|
+
// Clear previous step's state before going back
|
|
74
|
+
const prevStep = this.steps[this.currentIndex - 1];
|
|
75
|
+
this.clearStepState(prevStep);
|
|
76
|
+
this.currentIndex--;
|
|
77
|
+
}
|
|
78
|
+
// If can't go back, just retry current step
|
|
79
|
+
break;
|
|
80
|
+
case 'skip':
|
|
81
|
+
// Skip without displaying, just apply updates and move forward
|
|
82
|
+
if (result.updates) {
|
|
83
|
+
Object.assign(this.state, result.updates);
|
|
84
|
+
}
|
|
85
|
+
this.currentIndex++;
|
|
86
|
+
break;
|
|
87
|
+
case 'next':
|
|
88
|
+
if (result.updates) {
|
|
89
|
+
Object.assign(this.state, result.updates);
|
|
90
|
+
}
|
|
91
|
+
this.currentIndex++;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Clear screen for clean final view
|
|
96
|
+
clearScreen();
|
|
97
|
+
p.intro(pc.bgCyan(pc.black(` ${title} `)));
|
|
98
|
+
return this.state;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Display progress indicator for current step
|
|
102
|
+
*/
|
|
103
|
+
showProgress(step) {
|
|
104
|
+
const defaultProgress = {
|
|
105
|
+
current: this.currentIndex + 1,
|
|
106
|
+
total: this.steps.length,
|
|
107
|
+
};
|
|
108
|
+
// Allow step to customize progress display
|
|
109
|
+
const progress = step.getProgress
|
|
110
|
+
? step.getProgress(this.state, defaultProgress)
|
|
111
|
+
: defaultProgress;
|
|
112
|
+
const { current, total } = progress;
|
|
113
|
+
// Progress dots
|
|
114
|
+
const filled = pc.green('●'.repeat(current));
|
|
115
|
+
const empty = pc.dim('○'.repeat(total - current));
|
|
116
|
+
const progressBar = `${filled}${empty}`;
|
|
117
|
+
// Step indicator with title
|
|
118
|
+
const stepInfo = t().stepOf(current, total);
|
|
119
|
+
p.log.step(pc.cyan(`${stepInfo}: ${step.title()}`));
|
|
120
|
+
p.log.message(progressBar, { symbol: '' });
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Clear state keys managed by a step
|
|
124
|
+
*/
|
|
125
|
+
clearStepState(step) {
|
|
126
|
+
for (const key of step.stateKeys) {
|
|
127
|
+
delete this.state[key];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Helper to create a step result for moving to next step
|
|
133
|
+
*/
|
|
134
|
+
export function next(updates) {
|
|
135
|
+
return { action: 'next', updates };
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Helper to create a step result for going back
|
|
139
|
+
*/
|
|
140
|
+
export function back() {
|
|
141
|
+
return { action: 'back' };
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Helper to create a step result for cancelling
|
|
145
|
+
*/
|
|
146
|
+
export function cancel() {
|
|
147
|
+
return { action: 'cancel' };
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Helper to create a step result for skipping (auto-selection)
|
|
151
|
+
*/
|
|
152
|
+
export function skip(updates) {
|
|
153
|
+
return { action: 'skip', updates };
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Handle a prompt value that might be BACK or cancel
|
|
157
|
+
* Returns the appropriate StepResult
|
|
158
|
+
*/
|
|
159
|
+
export function handlePromptValue(value, onValue) {
|
|
160
|
+
if (isCancel(value)) {
|
|
161
|
+
return cancel();
|
|
162
|
+
}
|
|
163
|
+
if (isBack(value)) {
|
|
164
|
+
return back();
|
|
165
|
+
}
|
|
166
|
+
return onValue(value);
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=wizard-engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wizard-engine.js","sourceRoot":"","sources":["../../src/lib/wizard-engine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,CAAC,EAAE,MAAM,WAAW,CAAC;AAC9B,OAAO,EAAQ,MAAM,EAAE,QAAQ,EAAkB,MAAM,uBAAuB,CAAC;AAE/E;;GAEG;AACH,MAAM,UAAU,WAAW;IACzB,2CAA2C;IAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AACzC,CAAC;AAED,4BAA4B;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,gBAAgB,CAAC;AA+D3D;;;;;;;;GAQG;AACH,MAAM,OAAO,YAAY;IACf,KAAK,CAAuB;IAC5B,KAAK,CAAS;IACd,YAAY,GAAG,CAAC,CAAC;IACjB,MAAM,CAAuB;IAErC,YACE,KAA2B,EAC3B,YAAoB,EACpB,SAA+B,EAAE;QAEjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,GAAG;QACP,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC;QAEn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