You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`@saasquatch/component-boilerplate/canned` answers any query valid against a
snapshot of the SaaSquatch schema (saasquatch-core SaaSquatch.graphql) with
realistic, deterministic data, so stories no longer need a real tenant and a
real, signed user JWT.
- CannedGraphQLClient: graphql-tools mocks over the real schema; per-field
realism (personas, pretty money values, epoch-ms dates, list sizes that match
totalCount, inline images), Viewer/WidgetConfig pinned to the types a
logged-in widget user gets, and a seeded PRNG so every response is stable.
- provideCannedGraphQL: supplies it through the existing `sq:graphql-client`
DOM context, so components need no changes (works across bundles).
- interceptCannedFetch: answers direct `fetch`es to the canned endpoint only
(component-environment's locale lookup bypasses the GraphQL client).
- useCannedEnvironment: one-call story setup with cleanup on unmount.
- fakeJwt: unsigned token, also exported from the main entry for demos.
The canned entry is separate so production consumers of the main entry never
load the 204 KB schema or graphql-tools (main entry size unchanged).
GRAPHQL_CONTEXT moves to its own module so the canned bundle doesn't inline a
second BatchedGraphQLClient or useHost.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stories, e2e tests and two demo registration flows embedded 14 HS256 user
tokens with no expiry for real test tenants. They shipped in dist/ (31 mint
and 8 bedrock files) to npm and the CDN.
- 16 story setups use useCannedEnvironment instead of a real tenant + token.
Locale stories set the locale explicitly instead of relying on the real
users' stored locales.
- PortalFrame keeps the Android SDK identity path, now with a fakeJwt, and its
full-stack stories become hook stories so their setup is cleaned up.
- Bedrock widget stories render mint's official ReferralWidget and
CashPayoutsReferralWidget templates as the canned renderWidget response.
- Instant-access and referred registration demos use fakeJwt.
- The auth-template-switch e2e tests use an unsigned token.
- A spec in each package fails if a signed-looking JWT appears in src/.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Without an explicit bundle, Stencil merged sqb-stencilbook and the hook story
container into the lazy chunk customer pages load for sqb-widget, so story
code (and the tokens it contained) shipped to every page using the widget.
That chunk was 170 KB; sqb-widget is now 6 KB and story code lives in its own
chunk that only stencilbook loads.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Clean builds cannot resolve the new boilerplate imports, and unresolved identity lifecycle, Request-body handling, widget selection, and leaderboard mock issues break story behavior.
This PR replaces signed credentials and live-tenant data in Mint and Bedrock stories with shared canned GraphQL data, while switching registration demos to unsigned tokens.
Changes:
Adds a canned GraphQL client, environment helpers, configurable mocks, and schema-sync tooling.
Migrates stories and demos away from signed JWTs and separates Bedrock story bundles.
Adds canned-client tests and source checks for signed JWTs.
- useCannedEnvironment sets identity on every mount: an explicit user, else
widgetIdent credentials (userId/accountId/token), else logged out. The
global identity provider outlives stories and reads widgetIdent only when
first created, so revisiting a widgetIdent-authenticated story (Auth
Template Switch, Program Switch, Full Stack Frame) after any other story
rendered it logged out. Reproduced in stencilbook before the fix.
- interceptCannedFetch reads the body from a Request when init.body is
absent, matching fetch, so fetch(new Request(...)) gets data, not errors.
- EmptyLeaderboard returns no rows, as the real tenant did for its 2021
interval, so the story shows the empty state again.
- Test pinning that graphql-tools v7 passes query arguments first to root
field mocks, which bedrock's cannedWidgetMocks relies on.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This resolver discards the requested locale and always returns an English template. Consequently, WidgetWithLocaleTr and WidgetWithLocaleFr now render the same English widget as the English story, losing the translated-widget behavior described in sqb-widget.feature:25-41. Select a locale-specific canned template using the resolver's locale argument so these stories still exercise translation loading without contacting a tenant.
Add a types condition for the canned export
packages/component-boilerplate/package.json:13
TypeScript's node16, nodenext, and bundler resolution follow this export target rather than the types field in canned/package.json. They look for canned.modern.d.ts, but the declaration output is dist/canned.d.ts, leaving the new entry untyped or producing TS7016. Add a types condition while retaining the JavaScript target.
Reset the program ID when setting up canned stories
lazilyStartProgramContext() reads widgetIdent.programId only when creating the global provider, so later canned stories can inherit the previous story's program, including stories without a program. Initialize that provider with setProgramId during canned setup and clear it on cleanup. Apply initialization before any story-specific setProgramId override, so the table stories retain their chosen program.
Return a decodable JWT from the canned registration response
The canned registration response returns Example token, which useRegisterWithEmailAndPasswordMutation immediately tries to JWT-decode. Submitting a valid form in the input, checkbox, or dropdown stories therefore shows a network error instead of completing registration. Add a ManagedIdentityAuthenticationResult mock whose token comes from fakeJwt with a user payload containing id and accountId.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved defects leave stories using stale program context, break translated-widget and missing-locale scenarios, and return invalid registration tokens that cause valid submissions to fail.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved issues leave stories using stale program context, allow VAT to exceed invoice totals, misrepresent pagination, and prevent locale stories from exercising translation and fallback behavior.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The new Object.fromEntries call is incompatible with the package’s ES2017 TypeScript libraries, causing TS2550 in the declaration build and blocking build/prepack.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The change introduces a declaration-build failure by using Object.fromEntries with ES2017 libraries, and stale story cleanup can erase the next story’s tenant settings or log it out.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human review is needed to evaluate overlapping story lifecycles that can overwrite shared program or locale state and fixtures that fail to reflect successful link updates.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the change
Type of change
Links
Checklists
Development
Paperwork
Code review