Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
336 commits
Select commit Hold shift + click to select a range
118c107
Fix tabs style
zachharrison Jun 24, 2025
96cd691
Refactor referral table rewards cell
zachharrison Jun 24, 2025
1cc7aa2
Refacor referral table status badges
zachharrison Jun 24, 2025
b06f723
Refactor rewards table cells
zachharrison Jun 24, 2025
4b8dba9
Version bump
zachharrison Jun 24, 2025
75ae102
Update program explainer default values
zachharrison Jun 24, 2025
b0ad8bf
Update more defaults
zachharrison Jun 24, 2025
1e3c604
Add new brand selector
zachharrison Jun 24, 2025
891fa18
replace parentState tag with dependencies in componentState
Locrian24 Jun 25, 2025
b6bf0a1
Fix brand selector and update styles
zachharrison Jun 25, 2025
6b4ad64
Theme updates
zachharrison Jun 25, 2025
a28ec5f
Start adding types for branding config
zachharrison Jun 25, 2025
a3a0d08
Fix types
zachharrison Jun 25, 2025
76f8cc7
Merge branch 'component-preview-states' into feature/content-editor
Locrian24 Jun 25, 2025
2f3dde0
Merge remote-tracking branch 'origin/content-editor' into feature/con…
Locrian24 Jun 25, 2025
e6c0ba0
Get branding config working in stencilbook
zachharrison Jun 25, 2025
613deee
add optional chaining in stylesheet
Locrian24 Jun 25, 2025
287bfa7
Add brand hash to url
zachharrison Jun 25, 2025
80a89b5
Keep exising url hash and tack on new brand hash to keep story url in…
zachharrison Jun 25, 2025
aaae9b0
Comment console.log
zachharrison Jun 26, 2025
1810d75
Refactor to store brand name in local storage instead of url hash
zachharrison Jun 26, 2025
c43accf
Try adding helper function to get theme from local storage
zachharrison Jun 26, 2025
f6d161c
Get brand config switching working with local storage
zachharrison Jun 26, 2025
bbafee6
Add accent color variables
zachharrison Jun 26, 2025
7266aab
More theme styling updates
zachharrison Jun 26, 2025
2f38d63
Add input variables
zachharrison Jun 26, 2025
6f2ef42
Add more button and border styles
zachharrison Jun 27, 2025
9f82308
Add more theming updates
zachharrison Jun 27, 2025
ec015ea
Update demo button style
zachharrison Jun 27, 2025
375196d
More polish
zachharrison Jun 27, 2025
0b734f4
update tax component states
Locrian24 Jun 27, 2025
65e0d2c
More bug fixes and variable updates
zachharrison Jun 27, 2025
0a2c042
Leaderboard styling
zachharrison Jun 27, 2025
a233bf1
More styling updates
zachharrison Jun 27, 2025
8c83881
update primary button css selector
zachharrison Jul 2, 2025
666a373
Remove unused asset card component
zachharrison Jul 2, 2025
290eb75
Fix error border color
zachharrison Jul 3, 2025
27e9e2e
Update brand selector styles
zachharrison Jul 3, 2025
bd39f4c
Add type secondary to secondary buttons
zachharrison Jul 3, 2025
f45febd
Update portal login stories
zachharrison Jul 3, 2025
bdc3298
Version bump
zachharrison Jul 3, 2025
1a10eae
More styling updates
zachharrison Jul 3, 2025
f9a0b2b
Fix broken stories
zachharrison Jul 4, 2025
da6f235
state list update and pre-release
Locrian24 Jul 4, 2025
61eef3c
Code cleanup
zachharrison Jul 4, 2025
bbd208c
Update badge styles to use new css vars
zachharrison Jul 4, 2025
f7dee29
Fix navigation sidebar stories
zachharrison Jul 6, 2025
bc3f5a5
Fix radio background color by overwriting primary color variables.
zachharrison Jul 6, 2025
00599ee
Fix border hover css variable
zachharrison Jul 7, 2025
89765d9
share link and coupon code background
zachharrison Jul 7, 2025
2869687
Merge branch 'content-editor' into feature/content-editor
zachharrison Jul 7, 2025
c9b4e25
sync branding config variables with mint
Locrian24 Jul 7, 2025
eda9ca6
pre-release 1.15.0-44
Locrian24 Jul 7, 2025
2cba9ca
fix all the randomly appearing type issues
Locrian24 Jul 7, 2025
81e2080
Update storybook branding configs to match new schema
zachharrison Jul 7, 2025
644dba6
Fix button variables
zachharrison Jul 8, 2025
70ac82c
More global style fixes
zachharrison Jul 8, 2025
5c27a12
Remove all instances of tertiary buttons
zachharrison Jul 8, 2025
985c1eb
branding config updates
zachharrison Jul 10, 2025
2ccba44
border radius update
zachharrison Jul 10, 2025
576857c
Update task card and global styles
zachharrison Jul 10, 2025
d504ccd
Version bump
zachharrison Jul 10, 2025
721afa3
stencil docs target bump
Locrian24 Jul 10, 2025
414c7cf
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Jul 10, 2025
cec4719
Reward exchange story fixes in progress
zachharrison Jul 11, 2025
6eb8bd7
Fix stories
zachharrison Jul 11, 2025
067faa5
Styling updates
zachharrison Jul 14, 2025
904e8c4
Fix progress bar styling
zachharrison Jul 14, 2025
a5338ae
Add input border radius to themes and update dropdown in reward exchange
zachharrison Jul 14, 2025
15dae9f
Merge branch 'master' into feature/content-editor
zachharrison Jul 14, 2025
0c08886
Update portal background
zachharrison Jul 15, 2025
493a6e2
version update
zachharrison Jul 15, 2025
79a6d09
Rename example UI names for components
AndiLuo Jul 15, 2025
4b81d52
Update missed name
AndiLuo Jul 15, 2025
ac0409e
Another missed example tag
AndiLuo Jul 15, 2025
16cbff4
Update task card background color
zachharrison Jul 15, 2025
089f41e
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
zachharrison Jul 15, 2025
6c1303d
update how styling is set to allow for soft refreshes in the editor
Locrian24 Jul 15, 2025
6c9666a
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Jul 15, 2025
a40bed5
Task card styling
zachharrison Jul 15, 2025
8890f7c
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
zachharrison Jul 15, 2025
ef5917e
Update css vars
zachharrison Jul 15, 2025
4e52ec2
Version bump
zachharrison Jul 15, 2025
b90f234
Version bump
zachharrison Jul 16, 2025
9866ab5
Fix default values
zachharrison Jul 16, 2025
8bd7af6
Version bump
zachharrison Jul 16, 2025
2c5e0c7
Version bump
zachharrison Jul 16, 2025
af80c56
Fix stencilbook background color
zachharrison Jul 16, 2025
62429d0
Version bump
zachharrison Jul 16, 2025
18530e6
add support for branded font
Locrian24 Jul 16, 2025
3f4189e
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Jul 16, 2025
7bb561d
fix early crash and config not updating on window in editor
Locrian24 Jul 16, 2025
acf8a63
replace hard coded pixel value for border with new css variable
zachharrison Jul 17, 2025
a908f62
version bump
zachharrison Jul 17, 2025
6c82864
Update form message component styles to use new branding vars
zachharrison Jul 17, 2025
5894862
Cleanup
zachharrison Jul 17, 2025
0fe8365
Fix theme variable
zachharrison Jul 17, 2025
87e4b18
Refactor alerts to use shared component
zachharrison Jul 17, 2025
cb900d9
Remove remaining alerts
zachharrison Jul 18, 2025
d73fb51
More alert and badge css cleanup
zachharrison Jul 18, 2025
742ea6f
Fix banner styling
zachharrison Jul 19, 2025
773a3a1
Update font family
zachharrison Jul 19, 2025
564b016
Version bump
zachharrison Jul 22, 2025
536873c
Update fonts
zachharrison Jul 22, 2025
5725ed0
Version bump
zachharrison Jul 22, 2025
c521768
Fix placeholder styles
zachharrison Jul 22, 2025
621a2d1
Update component annotations
zachharrison Jul 22, 2025
7e8af45
Version bump
zachharrison Jul 22, 2025
e2abe6c
Update js docs
zachharrison Jul 23, 2025
40cd8fd
avoid sqm brand override if brandColor is set
Locrian24 Jul 23, 2025
428c0ee
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Jul 23, 2025
6b0989e
version bump
zachharrison Jul 23, 2025
08d13c2
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
zachharrison Jul 23, 2025
c9735c4
Add component annotations to bedrock components
zachharrison Jul 23, 2025
4f3ea44
Bump bedrock version
zachharrison Jul 23, 2025
a66a06a
Update badge text color
zachharrison Jul 24, 2025
9f3b271
Fix alert icon
zachharrison Jul 24, 2025
4f24a63
Add colum to hide in mobile prop
zachharrison Jul 24, 2025
c09238a
version bump
zachharrison Jul 24, 2025
af3a222
Add more annotations
zachharrison Jul 25, 2025
f8db0ed
big stat ordering and fueltank support for reward count
Locrian24 Jul 25, 2025
62e362f
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Jul 25, 2025
5cea4fa
other stat on user stat component
Locrian24 Jul 25, 2025
a7b9755
Fix more component annotations
zachharrison Jul 25, 2025
2a9eff8
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
zachharrison Jul 25, 2025
2b93e71
More annotation fixes
zachharrison Jul 25, 2025
7dcbcae
Fix remaining component annotations
zachharrison Jul 25, 2025
f5f5b74
Version bump
zachharrison Jul 25, 2025
66a6bed
Update copy
zachharrison Jul 28, 2025
cad9db6
update default background color
zachharrison Jul 28, 2025
57b8d05
Version bump
zachharrison Jul 28, 2025
ffcb918
version bump
zachharrison Jul 28, 2025
c72d64d
Add program id to additional settings in big stat
Locrian24 Jul 29, 2025
471a2c0
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Jul 29, 2025
e5bcda1
expired and cancelled sum aggregate stats added
Locrian24 Jul 29, 2025
b9a5437
state specs
Locrian24 Jul 30, 2025
6863581
editor states for auth-template-switch
Locrian24 Jul 30, 2025
29472dd
Update titled section
zachharrison Jul 30, 2025
531423b
Remove old console logs
zachharrison Jul 30, 2025
999f9e8
Add component states to sqm-reward-exchange and updated the states in…
AndiLuo Jul 31, 2025
54d4920
Updated mint version
AndiLuo Jul 31, 2025
3512a0c
Add new spec for hero unit
zachharrison Aug 6, 2025
50293eb
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
zachharrison Aug 6, 2025
e83c572
Remove anonymous leaderboard wrapper and copy
zachharrison Aug 7, 2025
56fd2c5
Deploy new pre release
zachharrison Aug 7, 2025
1a75a3a
Version bump
zachharrison Aug 7, 2025
379e81b
Update hero layout spec
zachharrison Aug 8, 2025
62555db
Cleanup spec
zachharrison Aug 8, 2025
f4cd8ea
add uiGroup to componentState json
Locrian24 Aug 13, 2025
0bb0595
prerelease 1.15.0-82
Locrian24 Aug 13, 2025
2f98d1e
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Aug 13, 2025
d2feb43
fix exchange list state json
Locrian24 Aug 13, 2025
3f51315
Fix annotations
zachharrison Aug 13, 2025
4f27c41
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
zachharrison Aug 13, 2025
72fa111
Version bump
zachharrison Aug 13, 2025
946dce1
Fix component placement errors
zachharrison Aug 14, 2025
bfc942c
deploy pre release
zachharrison Aug 14, 2025
9aafd55
prerelease 1.4.12-2
Locrian24 Aug 14, 2025
bd54609
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Aug 14, 2025
cbcdb85
Fix component placement error
zachharrison Aug 14, 2025
46b4210
Version bump
zachharrison Aug 14, 2025
4f7829f
another component placement fix
zachharrison Aug 14, 2025
de35597
version bump
zachharrison Aug 14, 2025
1a82563
Fix empty example group
zachharrison Aug 14, 2025
a410e52
Version bump
zachharrison Aug 14, 2025
084ab6a
Fix radio button labels in tax form step 2 not using main text color
AndiLuo Aug 15, 2025
249afcb
Fix ProgramExplainer having default text color. Fix HeroImage button …
AndiLuo Aug 15, 2025
a3b07d3
Fix ShareLink text not using form fields color
AndiLuo Aug 18, 2025
11d8d38
fix reward exchange states not being applied
Locrian24 Aug 18, 2025
7e5bb2e
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Aug 18, 2025
c86779c
Fix sharelink to use FormFields borderColor
AndiLuo Aug 18, 2025
cdd3c8e
Merge branch 'feature/content-editor' of https://github.com/saasquatc…
AndiLuo Aug 18, 2025
6a2a67d
Fix horizontal lines in sqm-leaderboard
AndiLuo Aug 19, 2025
bd30025
Add new story
zachharrison Aug 19, 2025
1c04425
update state section names
Locrian24 Aug 20, 2025
753c1c0
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Aug 20, 2025
d08c4fa
Update hero component
zachharrison Aug 20, 2025
f352a67
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
zachharrison Aug 20, 2025
6eb7e3c
Fix copy text view styles
zachharrison Aug 20, 2025
a6dbc98
Version bump
zachharrison Aug 20, 2025
3abc63a
Another version bump
zachharrison Aug 20, 2025
b3490d4
Fix text color
zachharrison Aug 20, 2025
bebce4f
version bump
zachharrison Aug 20, 2025
7f5dd74
Fix issues with hero layout
zachharrison Aug 21, 2025
7958ad8
Add missing enum options
zachharrison Aug 21, 2025
99fa61b
fix secondary background color mapping
Locrian24 Aug 21, 2025
4d21c22
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Aug 21, 2025
baa2936
Add secondary parts to sqm scroll button and remove unwanted styling
zachharrison Aug 22, 2025
4a77fc0
Fix styling issue
zachharrison Aug 22, 2025
7f7af0d
Fix radio labels in banking info form having background form color
AndiLuo Aug 22, 2025
7d037b6
Update fallback color values to match new designs
zachharrison Aug 22, 2025
61efbcb
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
zachharrison Aug 22, 2025
16f0694
Version bump
zachharrison Aug 22, 2025
19f4275
Use correct button style in tax and cash dashboard
zachharrison Aug 22, 2025
13b1e9c
Version bump
zachharrison Aug 22, 2025
425a319
Make checkbox label use main text variable
zachharrison Aug 25, 2025
da1e37a
Version bump
zachharrison Aug 25, 2025
8cd833a
Misc bug fixes
zachharrison Aug 25, 2025
9bc86e7
Fix form message banner
zachharrison Aug 25, 2025
0f336cc
Fix share button radius
zachharrison Aug 25, 2025
897be8e
bump stencil docs target
Locrian24 Aug 25, 2025
4a53307
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Aug 25, 2025
fcf713b
tunnel dashboard states to component
Locrian24 Aug 26, 2025
110d6ad
fix payout status, prerelease 133
Locrian24 Aug 26, 2025
f7c62ba
Remove disabled label color
zachharrison Aug 26, 2025
d8c04be
publish pre release
zachharrison Aug 26, 2025
5762389
add missing border thickness var
zachharrison Aug 26, 2025
c752167
version bump
zachharrison Aug 26, 2025
d717c49
Fix loading view
zachharrison Aug 26, 2025
bb654f4
Updates to use correct css variables
zachharrison Aug 26, 2025
8272900
Update inputs, labels, and borders to use correct css vars
zachharrison Aug 26, 2025
993c521
Fix navigation css variables
zachharrison Aug 28, 2025
c51a054
Another navigation color fix
zachharrison Aug 28, 2025
d1f0362
fix crash and demo states for sqm-reward-exchange-list
Locrian24 Aug 29, 2025
772c6a9
Remove hard coded color from text
zachharrison Sep 2, 2025
5f4aa8a
1.15.0-138 prerelease
Locrian24 Sep 2, 2025
529781d
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
Locrian24 Sep 9, 2025
5a244e5
Update copy-text-view colors
AndiLuo Sep 29, 2025
cb6fe1a
Cleanup task card view
zachharrison Sep 29, 2025
45c5621
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
zachharrison Sep 29, 2025
1175b16
Update hover state color for select list items
zachharrison Oct 1, 2025
11ff3e3
Update input text color
zachharrison Oct 1, 2025
752db2e
deploy pre release
zachharrison Oct 1, 2025
30af691
Try to fix select list background color
zachharrison Oct 1, 2025
4937c44
Add secondary button styles to tax and cash dashboard buttons
zachharrison Oct 1, 2025
e0c16f8
Version bump
zachharrison Oct 1, 2025
f1c6b2c
Fix background token in copy-text-view
AndiLuo Oct 2, 2025
24691f1
Remove potentially problematic css
zachharrison Oct 3, 2025
44d3518
version bump
zachharrison Oct 3, 2025
350f021
Add missing semicolon
zachharrison Oct 3, 2025
9e9e921
Change --sl-input-font-family to point to different css var
AndiLuo Oct 3, 2025
acdf9f3
Merge branch 'feature/content-editor' of https://github.com/saasquatc…
AndiLuo Oct 3, 2025
f557e94
Version bump
zachharrison Oct 3, 2025
1e1620a
Override select menu-item class in user-info-form
AndiLuo Oct 3, 2025
b34f19d
Merge branch 'feature/content-editor' of https://github.com/saasquatc…
AndiLuo Oct 3, 2025
7f349b9
overwrite color of menu item vars
zachharrison Oct 3, 2025
9f4445e
Version bump
zachharrison Oct 3, 2025
9602fe4
Added sl-menu-item selector styles to components
AndiLuo Oct 3, 2025
284e766
Merge branch 'feature/content-editor' of https://github.com/saasquatc…
AndiLuo Oct 3, 2025
a64cfb6
Add select styling to banking info form
zachharrison Oct 3, 2025
610c6d5
Merge branch 'feature/content-editor' of github.com:saasquatch/progra…
zachharrison Oct 3, 2025
6cd952d
Deploy pre-release -158
AndiLuo Oct 3, 2025
2a5e71e
Cleanup styles
zachharrison Oct 3, 2025
57e0dc5
Update checkbox styles in components
AndiLuo Oct 6, 2025
bd04acb
Merge remote-tracking branch 'origin/master' into feature/content-editor
AndiLuo Oct 7, 2025
e3946e8
Bump to major pre-release version
AndiLuo Oct 7, 2025
f82ce04
Test portal background default
zachharrison Oct 8, 2025
2fda9de
Update sqm-hero ui copy. Bump version
AndiLuo Oct 8, 2025
bf2d2af
Merge branch 'feature/content-editor' of https://github.com/saasquatc…
AndiLuo Oct 8, 2025
8ed3809
Remove default background color value from sqm-hero
AndiLuo Oct 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/bedrock-components/.prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"quoteProps": "consistent",
"printWidth": 180,
"semi": true,
"singleQuote": true,
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
Expand Down
18 changes: 9 additions & 9 deletions packages/bedrock-components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/bedrock-components/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@saasquatch/bedrock-components",
"title": "Bedrock Components",
"version": "1.4.10",
"version": "1.4.12-2",
"description": "Component library that adds advanced logic to your widgets and pages. Built and maintained by Saasquatch.",
"icon": "https://res.cloudinary.com/saasquatch/image/upload/v1652219900/squatch-assets/For_Bedrock.svg",
"main": "dist/index.cjs.js",
Expand Down Expand Up @@ -35,7 +35,7 @@
"postinstall": "patch-package"
},
"dependencies": {
"@raisins/stencil-docs-target": "^1.1.0",
"@raisins/stencil-docs-target": "^1.2.0-1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flagging updating this at launch

"@saasquatch/component-boilerplate": "^1.6.9",
"@saasquatch/dom-context-hooks": "^1.0.5",
"@saasquatch/stencil-hooks": "^2.0.2",
Expand Down
10 changes: 10 additions & 0 deletions packages/bedrock-components/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ import { FunctionalComponent } from "@stencil/core";
import { DemoData } from "./global/demo";
export namespace Components {
interface SqbAuthTemplateSwitch {
/**
* @componentState { "title": "Sign up form", "slot": "logged-out", "props": { "overrideToken": false } }
* @componentState { "title": "Logged In", "slot": "logged-in", "props": { "overrideToken": true } }
*/
"stateController": string;
}
interface SqbConditionalSection {
/**
Expand Down Expand Up @@ -127,6 +132,11 @@ declare global {
}
declare namespace LocalJSX {
interface SqbAuthTemplateSwitch {
/**
* @componentState { "title": "Sign up form", "slot": "logged-out", "props": { "overrideToken": false } }
* @componentState { "title": "Logged In", "slot": "logged-in", "props": { "overrideToken": true } }
*/
"stateController"?: string;
}
interface SqbConditionalSection {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
<!-- Auto Generated Below -->


## Properties

| Property | Attribute | Description | Type | Default |
| ----------------- | ------------------ | ----------- | -------- | ------- |
| `stateController` | `state-controller` | | `string` | `"{}"` |


## Dependencies

### Used by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,18 @@ Feature: Switch Templates based on Authentication status
| isOrIsNot | templateType |
| is | "logged-in" |
| is not | "logged-out" |


@motivating
Scenario: sqb-auth-template-switch editor states
Given html is loaded into a raisins editor
And the html includes "<sqb-auth-template-switch></sqb-auth-template-switch>"
When "sqb-auth-template-switch" is selected in the editor
Then the following states are displayed
| state |
| Logged in |
| Logged out |
When "Logged in" is selected
Then "sqb-auth-template-switch" displays whatever is slotted in the template slot "logged-in"
When "Logged out" is selected
Then "sqb-auth-template-switch" displays whatever is slotted in the template slot "logged-out"
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
import { withHooks } from '@saasquatch/stencil-hooks';
import { Component, h, Host } from '@stencil/core';
import { useAuthTemplateSwitch } from './useAuthTemplateSwitch';
import { withHooks } from "@saasquatch/stencil-hooks";
import { Component, h, Host, Prop } from "@stencil/core";
import { useAuthTemplateSwitch } from "./useAuthTemplateSwitch";

/**
* Displays "logged-out" content if no valid user is set, otherwise displays "logged-in" content
*
* @uiName Auth Template Switcher
* @slots [{"name":"logged-out","title":"Logged out template"}, {"name": "logged-in", "title": "Logged in template"}]
* @slots [{"name":"logged-out","title":"Logged out template"},{"name":"logged-in","title":"Logged in template"}]
* @canvasRenderer always-replace
*/
@Component({
tag: 'sqb-auth-template-switch',
tag: "sqb-auth-template-switch",
})
export class SqbAuthTemplateSwitch {
/**
* @componentState { "title": "Sign up form", "slot": "logged-out", "props": { "overrideToken": false } }
* @componentState { "title": "Referral & Reward info", "slot": "logged-in", "props": { "overrideToken": true } }
*/
@Prop() stateController: string = "{}";

constructor() {
withHooks(this);
}

disconnectedCallback() {}

render() {
const { setContainer, setSlot } = useAuthTemplateSwitch();
const stateProps = JSON.parse(this.stateController)["sqb-auth-template-switch"];
const { setContainer, setSlot } = useAuthTemplateSwitch(stateProps?.overrideToken);

return (
<Host>
<div ref={setSlot} style={{ display: 'contents' }}>
<div ref={setSlot} style={{ display: "contents" }}>
<slot name="logged-out" />
<slot name="logged-in" />
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { useToken } from '@saasquatch/component-boilerplate';
import { useCallback, useEffect, useState } from '@saasquatch/universal-hooks';
import debugFn from 'debug';
import { useTemplateChildren } from '../../utils/useTemplateChildren';
const debug = debugFn('sq:useAuthTemplateSwitch');
import { isDemo, useToken } from "@saasquatch/component-boilerplate";
import { useCallback, useEffect, useState } from "@saasquatch/universal-hooks";
import debugFn from "debug";
import { useTemplateChildren } from "../../utils/useTemplateChildren";
const debug = debugFn("sq:useAuthTemplateSwitch");

export function useAuthTemplateSwitch() {
const authToken = useToken();
export function useAuthTemplateSwitch(overrideToken?: boolean) {
const authToken = useToken() || (isDemo() && overrideToken);

const [container, setContainer] = useState<HTMLDivElement>(undefined);
const [slot, setSlot] = useState<HTMLDivElement>(undefined);

if (!authToken) debug('No user identity available');
if (!authToken) debug("No user identity available");

const updateTemplates = useCallback(() => {
const isAuth = !!authToken;
const templates = slot.querySelectorAll<HTMLTemplateElement>(`template`);
const template = Array.from(templates).find(t => t.slot === (isAuth ? 'logged-in' : 'logged-out'));
const template = Array.from(templates).find(t => t.slot === (isAuth ? "logged-in" : "logged-out"));

if (template) {
// use outerHTML if template's innerHTML is unset (only happens in Stencilbook)
Expand All @@ -29,51 +29,51 @@ export function useAuthTemplateSwitch() {
}
}

const plopTargets = Array.from(slot.children).filter(el => el.tagName === 'RAISINS-PLOP-TARGET');
const plopTargets = Array.from(slot.children).filter(el => el.tagName === "RAISINS-PLOP-TARGET");

// if editing in raisins
if (plopTargets.length) {
const loggedInPlopTargets = plopTargets.filter(el => el.slot === 'logged-in');
const loggedInPlopTargets = plopTargets.filter(el => el.slot === "logged-in");

const loggedOutPlopTargets = plopTargets.filter(el => el.slot === 'logged-out');
const loggedOutPlopTargets = plopTargets.filter(el => el.slot === "logged-out");

loggedOutPlopTargets.forEach((target: HTMLElement, i) => {
if (isAuth) {
target.style.display = 'none';
target.style.display = "none";
return;
}
// Place last plop target at the bottom of the parent
if (i === loggedOutPlopTargets.length - 1) {
target.style.bottom = '0px';
target.style.left = '0px';
target.style.right = '0px';
target.style.position = 'absolute';
target.style.bottom = "0px";
target.style.left = "0px";
target.style.right = "0px";
target.style.position = "absolute";
}

target.style.height = '25px';
target.style.height = "25px";
});

loggedInPlopTargets.forEach((target: HTMLElement, i) => {
if (!isAuth) {
target.style.display = 'none';
target.style.display = "none";
return;
}
// Place last plop target at the bottom of the parent
if (i === loggedInPlopTargets.length - 1) {
target.style.bottom = '0px';
target.style.left = '0px';
target.style.right = '0px';
target.style.position = 'absolute';
target.style.bottom = "0px";
target.style.left = "0px";
target.style.right = "0px";
target.style.position = "absolute";
}

target.style.height = '25px';
target.style.height = "25px";
});
}
}, [container, slot, authToken]);

useEffect(() => {
if (!container || !slot) {
debug('DOM not ready:');
debug("DOM not ready:");
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { isDemo } from '@saasquatch/component-boilerplate';
import { withHooks } from '@saasquatch/stencil-hooks';
import { Component, Host, h, Prop } from '@stencil/core';
import { useConditionalSection, UseConditionalSection } from './useConditonalSection';
import { isDemo } from "@saasquatch/component-boilerplate";
import { withHooks } from "@saasquatch/stencil-hooks";
import { Component, Host, h, Prop } from "@stencil/core";
import { useConditionalSection, UseConditionalSection } from "./useConditonalSection";

/**
* Only displayed for certain users. Hides content if not available.
*
* @uiName Conditional Section
* @exampleGroup Advanced
* @slots [{"name":"","title":"Section Content"}]
* @example Conditional Section On Segment - <sqb-conditional-section condition="'vip' in user.segments"><p>Add your conditional content here!</p></sqb-conditional-section>
* @example Conditional Section On Custom Field - <sqb-conditional-section condition="user.customFields.foo = true"><p>Add your conditional content here!</p></sqb-conditional-section>
* @validParents ["sqm-portal-container","div","template","sqm-instant-access-registration","sqb-program-section"]
* @example Conditional Area / Segment - <sqb-conditional-section condition="'vip' in user.segments"><p>Add your conditional content here!</p></sqb-conditional-section>
* @example Conditional Area / Field - <sqb-conditional-section condition="user.customFields.foo = true"><p>Add your conditional content here!</p></sqb-conditional-section>
*/
@Component({
tag: 'sqb-conditional-section',
tag: "sqb-conditional-section",
shadow: true,
})
export class SqbConditionalSection {
Expand All @@ -34,7 +35,7 @@ export class SqbConditionalSection {

render() {
const props = isDemo() ? useDemoHook() : useConditionalSection({ expression: this.condition });
const display = props.shouldDisplay ? 'contents' : 'none';
const display = props.shouldDisplay ? "contents" : "none";
return (
<Host style={{ display }}>
<slot />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
import { withHooks } from '@saasquatch/stencil-hooks';
import { Component, Host, h, Prop, State, Element } from '@stencil/core';
import { ContextProvider } from 'dom-context';
import { useEffect } from '@saasquatch/universal-hooks';
import { isDemo } from '@saasquatch/component-boilerplate';
import { useProgramSection } from './useProgramSection';
import { withHooks } from "@saasquatch/stencil-hooks";
import { Component, Host, h, Prop, State, Element } from "@stencil/core";
import { ContextProvider } from "dom-context";
import { useEffect } from "@saasquatch/universal-hooks";
import { isDemo } from "@saasquatch/component-boilerplate";
import { useProgramSection } from "./useProgramSection";

/**
* Matches @saasquatch/component-environment
*/
const PROGRAM_CONTEXT = 'sq:program-id';
const PROGRAM_CONTEXT = "sq:program-id";

/**
* Use this with other components like share buttons, referral lists
*
* @uiName Program Section
* @exampleGroup Advanced
* @slots [{"name":"","title":"Section Content"}]
* @validParents ["sqm-portal-container","div","template","sqm-instant-access-registration","sqb-program-section"]
* @example Program Section - <sqb-program-section>Add your program specific content here!</sqb-program-section>
*/
@Component({
tag: 'sqb-program-section',
tag: "sqb-program-section",
shadow: true,
})
export class SqbProgramSection {
Expand All @@ -44,7 +45,7 @@ export class SqbProgramSection {
initialState: this.programId,
});
this.provider.start();
this.el.addEventListener('sq:update-program-id', (e: CustomEvent) => (this.provider.context = e.detail));
this.el.addEventListener("sq:update-program-id", (e: CustomEvent) => (this.provider.context = e.detail));
withHooks(this);
}

Expand All @@ -61,7 +62,7 @@ export class SqbProgramSection {
}, [programId]);

return (
<Host style={{ display: 'contents' }}>
<Host style={{ display: "contents" }}>
<slot></slot>
</Host>
);
Expand Down
Loading
Loading