@stridge/kit 0.1.0-alpha.3 → 0.1.0-alpha.30
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 +22 -6
- package/dist/KitProvider.d.ts +29 -0
- package/dist/KitProvider.js +1 -1
- package/dist/_internal/withdraw/driver/index.d.ts +2 -2
- package/dist/deposit/compound/index.d.ts +2 -2
- package/dist/drivers/stridge/createStridgeDepositDriver.js +1 -1
- package/dist/drivers/stridge/createStridgeWithdrawDriver.d.ts +10 -12
- package/dist/drivers/stridge/createStridgeWithdrawDriver.js +1 -1
- package/dist/drivers/stridge/internal/metadata.js +1 -1
- package/dist/drivers/stridge/types.d.ts +7 -4
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.d.ts +3 -3
- package/dist/drivers/stridge-mock/createStridgeMockWithdrawDriver.js +1 -1
- package/dist/drivers/stridge-mock/fixtures.d.ts +7 -5
- package/dist/drivers/stridge-mock/fixtures.js +1 -1
- package/dist/flows/deposit/dialog/DepositDialog.js +1 -1
- package/dist/flows/deposit/orchestrator/controller.js +1 -1
- package/dist/flows/deposit/orchestrator/types.d.ts +30 -1
- package/dist/flows/deposit/orchestrator/useDeposit.d.ts +18 -1
- package/dist/flows/deposit/orchestrator/useDeposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/Deposit.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/components/Method.d.ts +6 -0
- package/dist/flows/deposit/widgets/deposit/compound/components/Method.js +1 -1
- package/dist/flows/deposit/widgets/deposit/compound/types.d.ts +6 -3
- package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.d.ts +7 -0
- package/dist/flows/deposit/widgets/deposit-status-banner/DepositStatusBanner.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/DepositStatusBanner.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/Hero.js +1 -1
- package/dist/flows/deposit/widgets/deposit-status-banner/compound/components/PrimaryAction.js +1 -1
- package/dist/flows/deposit/widgets/processing-state/ProcessingState.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Address.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.d.ts +2 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/Disclosure.js +1 -1
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.d.ts +4 -10
- package/dist/flows/deposit/widgets/transfer-crypto/compound/components/QrCode.js +1 -1
- package/dist/flows/shared/transformers/pickRelevantSettlement.js +1 -1
- package/dist/flows/withdraw/bindings/WithdrawBindings.d.ts +92 -0
- package/dist/flows/withdraw/bindings/WithdrawBindings.js +1 -0
- package/dist/flows/withdraw/bindings/index.d.ts +1 -0
- package/dist/flows/withdraw/bindings/index.js +1 -0
- package/dist/flows/withdraw/dialog/WithdrawDialog.d.ts +58 -12
- package/dist/flows/withdraw/dialog/WithdrawDialog.js +1 -1
- package/dist/flows/withdraw/driver/payloads.d.ts +16 -1
- package/dist/flows/withdraw/driver/transformers/settlementToWithdrawalPayload.js +1 -1
- package/dist/flows/withdraw/driver/transformers/supportedAssetsToReceiveOptionsPayload.js +1 -1
- package/dist/flows/withdraw/driver/types.d.ts +53 -11
- package/dist/flows/withdraw/orchestrator/controller.js +1 -1
- package/dist/flows/withdraw/orchestrator/index.d.ts +1 -1
- package/dist/flows/withdraw/orchestrator/reducer.js +1 -1
- package/dist/flows/withdraw/orchestrator/types.d.ts +106 -32
- package/dist/flows/withdraw/orchestrator/useWithdraw.d.ts +18 -1
- package/dist/flows/withdraw/orchestrator/useWithdraw.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/WithdrawForm.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/WithdrawForm.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.d.ts +7 -5
- package/dist/flows/withdraw/widgets/withdraw-form/compound/components/RecipientField.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-form/compound/types.d.ts +15 -5
- package/dist/flows/withdraw/widgets/withdraw-form/validation.js +1 -1
- package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.d.ts +2 -1
- package/dist/flows/withdraw/widgets/withdraw-in-progress/WithdrawInProgress.js +1 -1
- package/dist/i18n/index.d.ts +5 -4
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/locales/ar.js +1 -1
- package/dist/i18n/locales/es.js +1 -1
- package/dist/i18n/locales/source-keys.d.ts +12 -0
- package/dist/i18n/locales/source-keys.js +0 -0
- package/dist/icons/index.d.ts +2 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +12 -8
- package/dist/index.js +1 -1
- package/dist/package.js +1 -0
- package/dist/scope/KitPortalScope.js +1 -1
- package/dist/scope/KitScope.d.ts +18 -1
- package/dist/scope/KitScope.js +1 -1
- package/dist/scope/context.d.ts +17 -1
- package/dist/scope/index.d.ts +1 -1
- package/dist/shared/attribution/Attribution.js +1 -0
- package/dist/shared/attribution/Attribution.slots.js +1 -0
- package/dist/shared/attribution/Attribution.styles.js +1 -0
- package/dist/shared/attribution/index.js +1 -0
- package/dist/shared/chains/index.d.ts +48 -29
- package/dist/shared/chains/index.js +1 -1
- package/dist/shared/constants/brand-intercom.js +1 -0
- package/dist/shared/cuer/Cuer.js +1 -0
- package/dist/shared/cuer/QrCode.js +1 -0
- package/dist/shared/cuer/index.js +1 -0
- package/dist/shared/dialog/Frame.js +1 -1
- package/dist/shared/dialog/StepTransition.js +1 -1
- package/dist/shared/driver/types.d.ts +4 -3
- package/dist/shared/i18n/KitI18nProvider.d.ts +11 -8
- package/dist/shared/i18n/KitI18nProvider.js +1 -1
- package/dist/shared/i18n/createKitI18n.d.ts +79 -16
- package/dist/shared/i18n/createKitI18n.js +1 -1
- package/dist/shared/i18n/useLingui.d.ts +11 -3
- package/dist/shared/icons/LogoIcon.d.ts +13 -0
- package/dist/shared/icons/LogoIcon.js +1 -0
- package/dist/shared/orchestrator/useSettlementWatcher.js +1 -1
- package/dist/shared/primitives/TxHashValue/TxHashValue.js +1 -1
- package/dist/shared/support/SupportButton.d.ts +1 -0
- package/dist/shared/support/SupportButton.js +1 -0
- package/dist/shared/support/SupportConfigContext.d.ts +1 -0
- package/dist/shared/support/SupportConfigContext.js +1 -0
- package/dist/shared/support/SupportLink.d.ts +1 -0
- package/dist/shared/support/SupportLink.js +1 -0
- package/dist/shared/support/SupportSpinner.d.ts +1 -0
- package/dist/shared/support/SupportSpinner.js +1 -0
- package/dist/shared/support/index.d.ts +2 -0
- package/dist/shared/support/index.js +1 -0
- package/dist/shared/support/intercom-loader.d.ts +17 -0
- package/dist/shared/support/intercom-loader.js +1 -0
- package/dist/shared/support/resolveSupport.d.ts +1 -0
- package/dist/shared/support/resolveSupport.js +1 -0
- package/dist/shared/support/types.d.ts +43 -0
- package/dist/shared/support/useIntercomMerchantContext.d.ts +27 -0
- package/dist/shared/support/useIntercomMerchantContext.js +1 -0
- package/dist/shared/support/useIntercomShutdownOnUnmount.js +1 -0
- package/dist/shared/support/useMerchantContext.d.ts +1 -0
- package/dist/shared/support/useMerchantContext.js +1 -0
- package/dist/shared/support/useSupportTrigger.js +1 -0
- package/dist/shared/terms/TermsButton.d.ts +1 -0
- package/dist/shared/terms/TermsButton.js +1 -0
- package/dist/shared/terms/TermsConfigContext.d.ts +1 -0
- package/dist/shared/terms/TermsConfigContext.js +1 -0
- package/dist/shared/terms/TermsLink.d.ts +1 -0
- package/dist/shared/terms/TermsLink.js +1 -0
- package/dist/shared/terms/index.d.ts +1 -0
- package/dist/shared/terms/index.js +1 -0
- package/dist/shared/terms/resolveTerms.d.ts +1 -0
- package/dist/shared/terms/resolveTerms.js +1 -0
- package/dist/shared/terms/types.d.ts +43 -0
- package/dist/shared/ui/Card/Card.styles.js +1 -1
- package/dist/shared/ui/Details/Details.d.ts +9 -1
- package/dist/shared/ui/Details/Details.styles.js +1 -1
- package/dist/shared/ui/Dialog/Dialog.js +1 -1
- package/dist/shared/ui/Dialog/Dialog.styles.js +1 -1
- package/dist/shared/ui/ExternalLink/ExternalLink.js +1 -1
- package/dist/shared/ui/Select/Select.js +1 -1
- package/dist/shared/ui/WalletRow/WalletRow.d.ts +1 -1
- package/dist/shared/ui/WalletRow/WalletRow.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Hero/Hero.js +1 -1
- package/dist/shared/widgets/amount-entry/compound/components/Hero/SwapBackdrop.js +1 -1
- package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.d.ts +4 -3
- package/dist/shared/widgets/confirm-transfer/compound/components/Disclaimer.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/AssetValue.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/HelpInfo.js +1 -1
- package/dist/shared/widgets/error-state/compound/components/StatusValue.js +1 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.d.ts +1 -5
- package/dist/shared/widgets/processing-state/compound/ProcessingState.js +1 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.d.ts +0 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.slots.js +1 -1
- package/dist/shared/widgets/processing-state/compound/ProcessingState.styles.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Details.d.ts +6 -1
- package/dist/shared/widgets/processing-state/compound/components/Details.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Header.d.ts +4 -3
- package/dist/shared/widgets/processing-state/compound/components/Header.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Hero.d.ts +11 -7
- package/dist/shared/widgets/processing-state/compound/components/Hero.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/Rows.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/StatusPill.js +1 -1
- package/dist/shared/widgets/processing-state/compound/components/splitAmount.js +1 -0
- package/dist/shared/widgets/processing-state/compound/index.d.ts +1 -1
- package/dist/shared/widgets/processing-state/compound/types.d.ts +7 -26
- package/dist/shared/widgets/success-state/compound/components/Actions.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/AssetValue.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/RouteValue.js +1 -1
- package/dist/shared/widgets/success-state/compound/components/StatusPill.js +1 -1
- package/dist/stridge/StridgeProvider.d.ts +147 -15
- package/dist/stridge/StridgeProvider.js +1 -1
- package/dist/stridge/optionalWagmi.js +1 -0
- package/dist/stridge/stubs.js +1 -1
- package/dist/styles/index.css +58 -12
- package/dist/types.d.ts +5 -4
- package/dist/ui/index.js +1 -1
- package/dist/withdraw/compound/index.d.ts +2 -2
- package/dist/withdraw/dialog/index.d.ts +3 -1
- package/package.json +10 -11
- package/dist/kit/package.js +0 -1
- package/dist/shared/widgets/processing-state/compound/components/Actions.d.ts +0 -17
- package/dist/shared/widgets/processing-state/compound/components/Actions.js +0 -1
- /package/dist/{utils/src/use-copy-to-clipboard.js → shared/utils/useCopyToClipboard.js} +0 -0
|
@@ -1,40 +1,59 @@
|
|
|
1
1
|
//#region src/shared/chains/index.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Chain
|
|
4
|
-
* slug, suitable for IDE autocomplete) and a normalizer that converts any accepted form
|
|
5
|
-
* (slug, EIP-155 number, Stridge networkId) into the wire-shape `network_id` string the gateway
|
|
6
|
-
* expects.
|
|
3
|
+
* Chain-family types and recipient-address validators for `@stridge/kit`.
|
|
7
4
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* The kit does not ship a static chain catalog — the gateway is the single source of truth for
|
|
6
|
+
* which networks exist. Consumers pass the Stridge network id (read straight off
|
|
7
|
+
* `Uda.supportedAssets()`) as `StridgeAsset.networkId`, and the kit forwards it to
|
|
8
|
+
* `gateway/start` verbatim. This module only carries the chain-*family* tag (`ChainType`) and
|
|
9
|
+
* the address-shape validators that depend on it.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Chain family a network belongs to. The kit-internal, case-stable mirror of the gateway's
|
|
13
|
+
* `chain_type` wire tag (`SupportedAssetDto.chain_type`):
|
|
11
14
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
15
|
+
* - `"evm"` — every EIP-155 chain (Ethereum, BSC, Polygon, …); addresses are `0x` + 40 hex.
|
|
16
|
+
* - `"tron"` — Tron mainnet; addresses are base58check, 34 chars, leading `T`.
|
|
17
|
+
* - `"unknown"` — a family the kit predates. Address validation falls back to a permissive
|
|
18
|
+
* shape check (see {@link isValidAddressForChainType}) so a chain the backend lists before
|
|
19
|
+
* the kit ships explicit support is still usable rather than hard-blocked.
|
|
20
|
+
*
|
|
21
|
+
* Drivers are the source of truth: each one tags its payloads (`ReceiveChainPayload.chainType`,
|
|
22
|
+
* …) so widgets and headless consumers never re-derive the family from chain-id heuristics.
|
|
23
|
+
*/
|
|
24
|
+
type ChainType = "evm" | "tron" | "unknown";
|
|
25
|
+
/**
|
|
26
|
+
* Normalize a raw gateway `chain_type` value (or a missing one) into a {@link ChainType}.
|
|
27
|
+
* Surrounding whitespace is trimmed and matching is case-insensitive; the gateway tags Tron as
|
|
28
|
+
* `"TVM"` (Tron Virtual Machine). Any value the kit doesn't recognize — including `undefined` —
|
|
29
|
+
* collapses to `"unknown"`, which keeps the address gate permissive instead of blocking the flow.
|
|
30
|
+
*/
|
|
31
|
+
declare function toChainType(raw: string | null | undefined): ChainType;
|
|
32
|
+
/**
|
|
33
|
+
* Lightweight EVM-address validator. Matches `0x` followed by exactly 40 hex characters.
|
|
34
|
+
* Does NOT enforce the EIP-55 mixed-case checksum — the gateway lowercases before routing, and
|
|
35
|
+
* checksum validation would reject the all-lowercase forms wallets and explorers commonly emit.
|
|
36
|
+
* Input is trimmed before matching.
|
|
17
37
|
*/
|
|
38
|
+
declare function isValidEvmAddress(value: string): boolean;
|
|
18
39
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
40
|
+
* Lightweight Tron-address validator. Matches the base58check mainnet shape: a leading `T`
|
|
41
|
+
* followed by 33 base58 characters (34 total). Does NOT verify the trailing checksum bytes —
|
|
42
|
+
* that needs a base58check decode the kit deliberately keeps out of the bundle; the gateway
|
|
43
|
+
* performs the authoritative check. Input is trimmed before matching.
|
|
22
44
|
*/
|
|
23
|
-
declare
|
|
24
|
-
readonly ethereum: 1;
|
|
25
|
-
readonly bsc: 56;
|
|
26
|
-
readonly polygon: 137;
|
|
27
|
-
readonly arbitrum: 42161;
|
|
28
|
-
readonly base: 8453;
|
|
29
|
-
};
|
|
30
|
-
type ChainSlug = keyof typeof chains;
|
|
45
|
+
declare function isValidTronAddress(value: string): boolean;
|
|
31
46
|
/**
|
|
32
|
-
*
|
|
47
|
+
* Validate a recipient address against the chain family it's being sent to — the chain-type-aware
|
|
48
|
+
* gate the withdraw form and headless integrators share. Pass the `chainType` the driver tagged
|
|
49
|
+
* onto the receive-chain payload.
|
|
50
|
+
*
|
|
51
|
+
* - `"evm"` / `"tron"` — checked against the family's real address shape.
|
|
52
|
+
* - `"unknown"` — a family the kit predates: accepts any whitespace-free token of at least 8
|
|
53
|
+
* characters, so a backend-listed chain still works before the kit ships a dedicated matcher.
|
|
33
54
|
*
|
|
34
|
-
* -
|
|
35
|
-
* - `string` — chain slug (`"bsc"`), the matching EIP-155 id as text (`"56"`), or a Stridge
|
|
36
|
-
* `network_id` (`"9006"`). The kit normalizes via {@link normalizeChainToNetworkId}.
|
|
55
|
+
* Empty / whitespace-only input is always rejected. Trim is handled internally.
|
|
37
56
|
*/
|
|
38
|
-
|
|
57
|
+
declare function isValidAddressForChainType(value: string, chainType: ChainType): boolean;
|
|
39
58
|
//#endregion
|
|
40
|
-
export {
|
|
59
|
+
export { ChainType, isValidAddressForChainType, isValidEvmAddress, isValidTronAddress, toChainType };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function e(e){switch(e?.trim().toUpperCase()){case`EVM`:return`evm`;case`TVM`:return`tron`;default:return`unknown`}}const t=/^0x[0-9a-fA-F]{40}$/,n=/^T[1-9A-HJ-NP-Za-km-z]{33}$/;function r(e){return t.test(e.trim())}function i(e){return n.test(e.trim())}function a(e,r){let i=e.trim();if(i.length===0)return!1;switch(r){case`evm`:return t.test(i);case`tron`:return n.test(i);default:return/^\S{8,}$/.test(i)}}export{a as isValidAddressForChainType,r as isValidEvmAddress,i as isValidTronAddress,e as toChainType};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={appId:`ii7w0vsj`};export{e as BRAND_INTERCOM};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{create as e}from"./QrCode.js";import*as t from"react";import{Fragment as n,jsx as r,jsxs as i}from"react/jsx-runtime";const a=e=>Math.max(0,Math.min(1,e));function o(e){let{arena:t,...n}=e;return i(o.Root,{...n,children:[r(o.Finder,{}),r(o.Cells,{}),t&&r(o.Arena,{href:t})]})}(function(o){let s=o.Context=t.createContext(null);function c(n){let{children:a,size:o=`100%`,value:c,version:l,errorCorrection:u,...d}=n,f=t.useMemo(()=>(t.Children.map(a,e=>!t.isValidElement(e)||typeof e.type==`string`?null:`displayName`in e.type&&e.type.displayName===`Arena`?!0:null)??[]).some(Boolean),[a]),p=t.useMemo(()=>{let t=u;return f&&u===`low`&&(t=`medium`),e(c,{errorCorrection:t,version:l})},[c,f,u,l]),m=p.edgeLength*1,h=p.finderLength*1/2,g=f?Math.floor(m/4):0,_=(m-g)/2,v=t.useMemo(()=>({arenaSize:g,arenaStart:_,cellSize:1,edgeSize:m,qrcode:p,finderSize:h}),[g,_,m,p,h]);return r(s.Provider,{value:v,children:i(`svg`,{...d,width:o,height:o,viewBox:`0 0 ${m} ${m}`,xmlns:`http://www.w3.org/2000/svg`,children:[r(`title`,{children:`QR Code`}),a]})})}o.Root=c,(function(e){e.displayName=`Root`})(c||=o.Root||={});function l(e){let{className:o,fill:c,innerClassName:l,radius:u=.25,stroke:d}=e,{cellSize:f,edgeSize:p,finderSize:m}=t.useContext(s),h=a(u);function g({position:e}){let t=m-(m-f)-f/2;e===`top-right`&&(t=p-m-(m-f)-f/2);let a=m-(m-f)-f/2;e===`bottom-left`&&(a=p-m-(m-f)-f/2);let s=m-f*1.5;e===`top-right`&&(s=p-m-f*1.5);let u=m-f*1.5;return e===`bottom-left`&&(u=p-m-f*1.5),i(n,{children:[r(`rect`,{className:o,stroke:d??c??`currentColor`,fill:`transparent`,x:t,y:a,width:f+(m-f)*2,height:f+(m-f)*2,rx:2*h*(m-f),ry:2*h*(m-f),strokeWidth:f}),r(`rect`,{className:l,fill:c??`currentColor`,x:s,y:u,width:f*3,height:f*3,rx:2*h*f,ry:2*h*f})]})}return i(n,{children:[r(g,{position:`top-left`}),r(g,{position:`top-right`}),r(g,{position:`bottom-left`})]})}o.Finder=l,(function(e){e.displayName=`Finder`})(l||=o.Finder||={});function u(e){let{className:n,fill:i=`currentColor`,inset:o=!0,radius:c=1}=e,{arenaSize:l,arenaStart:u,cellSize:d,qrcode:f}=t.useContext(s),{edgeLength:p,finderLength:m}=f,h=a(c);return r(`path`,{className:n,d:t.useMemo(()=>{let e=``,t=u+l;for(let n=0;n<f.grid.length;n++){let r=f.grid[n];if(r)for(let i=0;i<r.length;i++){if(!r[i])continue;if(l>0){let e=(i+.5)*d,r=(n+.5)*d;if(e>=u&&e<=t&&r>=u&&r<=t)continue}let a=n<m&&i<m,s=n<m&&i>=p-m,c=n>=p-m&&i<m;if(a||s||c)continue;let f=(d-(o?d*.1:0)*2)/2,g=i*d+d/2,_=n*d+d/2,v=g-f,y=g+f,b=_-f,x=_+f,S=h*f;e+=[`M ${v+S},${b}`,`L ${y-S},${b}`,`A ${S},${S} 0 0,1 ${y},${b+S}`,`L ${y},${x-S}`,`A ${S},${S} 0 0,1 ${y-S},${x}`,`L ${v+S},${x}`,`A ${S},${S} 0 0,1 ${v},${x-S}`,`L ${v},${b+S}`,`A ${S},${S} 0 0,1 ${v+S},${b}`,`z`].join(` `)}}return e},[l,u,d,p,m,f.grid,o,h]),fill:i})}o.Cells=u,(function(e){e.displayName=`Cells`})(u||=o.Cells||={});function d(e){let{href:n,preserveAspectRatio:i=`xMidYMid meet`,...a}=e,{arenaSize:o,arenaStart:c,cellSize:l}=t.useContext(s),u=l/2,d=c+u,f=o-u*2;return r(`image`,{href:n,...a,x:d,y:d,width:f,height:f,preserveAspectRatio:i})}o.Arena=d,(function(e){e.displayName=`Arena`})(d||=o.Arena||={})})(o||={});export{o as Cuer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{encodeQR as e}from"qr";function t(t,n={}){let{errorCorrection:r,version:i}=n,a=e(t,`raw`,{border:1,ecc:r,scale:1,version:i}).slice(1,-1).map(e=>e.slice(1,-1));return{edgeLength:a.length,finderLength:7,grid:a,value:t}}export{t as create};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./Cuer.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useKitConfig as e}from"../../scope/context.js";import{useIsInsideDialogContent as t}from"../ui/Dialog/Dialog.js";import"../ui/Dialog/index.js";import{
|
|
1
|
+
"use client";import{useKitConfig as e}from"../../scope/context.js";import{useIsInsideDialogContent as t}from"../ui/Dialog/Dialog.js";import"../ui/Dialog/index.js";import{Attribution as n}from"../attribution/Attribution.js";import"../attribution/index.js";import{Card as r}from"../ui/Card/Card.js";import"../../ui/index.js";import{jsx as i,jsxs as a}from"react/jsx-runtime";function o({className:o,style:s,dir:c,children:l,...u}){let d=t(),{direction:f,attribution:p}=e(),m=c??f,h=p!==`hidden`;if(d){let e={className:`Frame__styles.bare x78zum5 xdt5ytf xkz0k9k x2lwn1j x7giv3`,"data-style-src":`@stridge/kit:src/shared/dialog/Frame.tsx:33`};return a(`div`,{...u,dir:m,className:[e.className,o].filter(Boolean).join(` `)||void 0,style:{...e.style,...s},children:[l,h?i(n,{}):null]})}return a(r,{variant:`frame`,dir:m,className:o,style:s,...u,children:[l,h?i(n,{}):null]})}export{o as Frame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as e,useLayoutEffect as t,useRef as n}from"react";import{jsx as r}from"react/jsx-runtime";import{AnimatePresence as i,
|
|
1
|
+
"use client";import{useEffect as e,useLayoutEffect as t,useRef as n}from"react";import{jsx as r}from"react/jsx-runtime";import{AnimatePresence as i,m as a}from"motion/react";const o=[.3,0,.06,1],s={enter:e=>({opacity:0,x:e>=0?16:-16,filter:`blur(6px)`}),center:{opacity:1,x:0,filter:`blur(0px)`,transition:{duration:.22,delay:.12,ease:o}},exit:e=>({opacity:0,x:e>=0?-16:16,filter:`blur(6px)`,transition:{duration:.14,ease:o}})};function c({stateKey:o,children:c}){let l=n([]),u=n(null),d=l.current,f=d[d.length-1],p=0;o!==f&&(p=d.indexOf(o)>=0?-1:1);let m=n(null),h=n(o),g=n(null),_=n(null);return e(()=>{let e=l.current;if(e[e.length-1]===o)return;let t=e.indexOf(o);l.current=t>=0?e.slice(0,t+1):[...e,o]},[o]),t(()=>{let e=u.current;if(!e)return;let t=e.getBoundingClientRect().height;if(h.current===o){m.current=t;return}let n=m.current;if(h.current=o,m.current=t,n===null||n===t||document.visibilityState===`hidden`)return;let r=e.style.transition;e.style.transition=`none`,e.style.height=`${n}px`,e.offsetHeight,e.style.transition=r,_.current!==null&&window.cancelAnimationFrame(_.current),_.current=window.requestAnimationFrame(()=>{_.current=null,u.current&&(u.current.style.height=`${t}px`)}),g.current!==null&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{g.current=null;let e=u.current;e&&(e.style.height=``)},320)}),e(()=>{let e=()=>{if(document.visibilityState!==`hidden`)return;_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),g.current!==null&&(window.clearTimeout(g.current),g.current=null);let e=u.current;e&&(e.style.height=``)};return document.addEventListener(`visibilitychange`,e),()=>{document.removeEventListener(`visibilitychange`,e),g.current!==null&&(window.clearTimeout(g.current),g.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null)}},[]),r(`div`,{ref:u,style:{position:`relative`,overflow:`hidden`,transition:`height 260ms cubic-bezier(0.3, 0, 0.06, 1)`,flex:`0 1 auto`,minHeight:0,display:`flex`,flexDirection:`column`},children:r(i,{mode:`popLayout`,custom:p,initial:!1,children:r(a.div,{custom:p,variants:s,initial:`enter`,animate:`center`,exit:`exit`,tabIndex:-1,style:{display:`flex`,flexDirection:`column`,flex:`1 1 auto`,minHeight:0,outline:`none`},children:c},o)})})}export{c as StepTransition};
|
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
* public `@stridge/kit/<flow>/driver` surface.
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
|
-
* On-chain transaction reference.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* On-chain transaction reference. The deposit driver returns one from `submitDeposit`; the
|
|
10
|
+
* withdraw flow's host-supplied `onSubmit` surfaces one via `actions.beginProcessing({ hash })`
|
|
11
|
+
* or `actions.setTxHash`. The orchestrator stamps it on the FSM's `tx` slot until the matching
|
|
12
|
+
* settlement entity catches up and exposes a richer `txHash` / `txExplorerUrl` pair.
|
|
12
13
|
*/
|
|
13
14
|
interface TxRef {
|
|
14
15
|
hash: string;
|
|
@@ -3,21 +3,24 @@ import { ReactNode } from "react";
|
|
|
3
3
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/shared/i18n/KitI18nProvider.d.ts
|
|
6
|
-
interface Props extends KitI18nConfig {
|
|
7
|
-
children: ReactNode;
|
|
8
|
-
}
|
|
9
6
|
/**
|
|
10
7
|
* Mounts a per-request Lingui `I18n` instance into React context. Re-creates the instance only
|
|
11
|
-
* when `locale` or the identity of `
|
|
12
|
-
* other context providers, and the SSR-safe alternative to mutating a module-level
|
|
8
|
+
* when `locale` or the identity of `messages` changes — same render-stable pattern as the
|
|
9
|
+
* kit's other context providers, and the SSR-safe alternative to mutating a module-level
|
|
10
|
+
* singleton.
|
|
13
11
|
*
|
|
14
12
|
* Used internally by `KitProvider`. Hosts don't mount this directly; they pass a single
|
|
15
|
-
* `i18n={{ locale,
|
|
13
|
+
* `i18n={{ locale, messages }}` prop on `<KitProvider>` and the kit handles the wiring.
|
|
16
14
|
*/
|
|
17
15
|
declare function KitI18nProvider({
|
|
18
16
|
locale,
|
|
19
|
-
|
|
17
|
+
messages,
|
|
20
18
|
children
|
|
21
|
-
}: Props): _$react_jsx_runtime0.JSX.Element;
|
|
19
|
+
}: KitI18nProvider.Props): _$react_jsx_runtime0.JSX.Element;
|
|
20
|
+
declare namespace KitI18nProvider {
|
|
21
|
+
interface Props extends KitI18nConfig {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
22
25
|
//#endregion
|
|
23
26
|
export { KitI18nProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{createKitI18n as e}from"./createKitI18n.js";import{useMemo as t}from"react";import{jsx as n}from"react/jsx-runtime";import{I18nProvider as r}from"@lingui/react";function i({locale:i=`en`,
|
|
1
|
+
"use client";import{createKitI18n as e}from"./createKitI18n.js";import{useMemo as t}from"react";import{jsx as n}from"react/jsx-runtime";import{I18nProvider as r}from"@lingui/react";function i({locale:i=`en`,messages:a,children:o}){return n(r,{i18n:t(()=>e({locale:i,messages:a}),[i,a]),children:o})}export{i as KitI18nProvider};
|
|
@@ -1,33 +1,96 @@
|
|
|
1
|
+
import { SupportedLocale } from "./locales.js";
|
|
2
|
+
import { KitTranslatableKey } from "../../i18n/locales/source-keys.js";
|
|
1
3
|
import { I18n, Messages } from "@lingui/core";
|
|
2
4
|
|
|
3
5
|
//#region src/shared/i18n/createKitI18n.d.ts
|
|
4
6
|
/**
|
|
5
|
-
*
|
|
6
|
-
* (`"en"`, `"es"`,
|
|
7
|
-
*
|
|
7
|
+
* Locale codes the kit's i18n surface accepts. Autocompletes on the locales the kit ships
|
|
8
|
+
* catalogs for ({@link SupportedLocale} — `"en"`, `"es"`, `"ar"`) while still accepting any
|
|
9
|
+
* other BCP-47 tag, so hosts who add their own catalogs via `defineMessages` aren't fenced
|
|
10
|
+
* out of the type.
|
|
11
|
+
*
|
|
12
|
+
* The `(string & {})` intersection is the standard escape hatch for "literal union + open
|
|
13
|
+
* string with autocomplete": without it, TypeScript collapses `Supported | string` to plain
|
|
14
|
+
* `string` and the editor loses the autocomplete suggestions for the named literals.
|
|
15
|
+
*/
|
|
16
|
+
type KitLocale = SupportedLocale | (string & {});
|
|
17
|
+
/**
|
|
18
|
+
* Map of locale codes to compiled message catalogs. Values are lingui `Messages` —
|
|
19
|
+
* content-hash-keyed `{ [id]: translation }` maps where ICU placeholders and plurals are
|
|
20
|
+
* compiled at runtime by {@link compileMessage}.
|
|
21
|
+
*
|
|
22
|
+
* Shipped locales (`@stridge/kit/i18n/locales/<code>`) export `Messages` directly. For hosts
|
|
23
|
+
* authoring their own translations, the recommended path is {@link defineMessages}, which
|
|
24
|
+
* takes a plain English-keyed map and emits the same hash-keyed shape — so shipped and
|
|
25
|
+
* host-authored translations slot into the same prop without different shapes.
|
|
8
26
|
*/
|
|
9
|
-
type
|
|
27
|
+
type KitMessages = Partial<Record<KitLocale, Messages>>;
|
|
28
|
+
/**
|
|
29
|
+
* Hash a plain English-keyed translation map into the lingui `Messages` shape, ready to drop
|
|
30
|
+
* into `<KitProvider i18n={{ messages: { … } }}>`. Use this whenever you want to author
|
|
31
|
+
* translations by hand — adding a locale the kit doesn't ship, overriding a single key on a
|
|
32
|
+
* shipped locale, or tweaking the source English copy.
|
|
33
|
+
*
|
|
34
|
+
* Keys are constrained to {@link KitTranslatableKey} — the literal union of every English
|
|
35
|
+
* source the kit actually translates. Editors autocomplete on every valid key, and typos /
|
|
36
|
+
* stale keys fail at compile time via excess-property checks on the object literal. The union
|
|
37
|
+
* is codegened from `en.po` at `pnpm i18n:compile` time.
|
|
38
|
+
*
|
|
39
|
+
* Hashing runs once per call (typically at module load), not on every render. ICU placeholders
|
|
40
|
+
* (`{symbol}`) and plurals (`{count, plural, one {# item} other {# items}}`) are supported in
|
|
41
|
+
* both keys and values; the kit's runtime compiler handles ICU on access.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```tsx
|
|
45
|
+
* import { messages as es } from "@stridge/kit/i18n/locales/es";
|
|
46
|
+
* import { defineMessages } from "@stridge/kit/i18n";
|
|
47
|
+
*
|
|
48
|
+
* const fr = defineMessages({
|
|
49
|
+
* Continue: "Suivant",
|
|
50
|
+
* "Deposit {symbol}": "Dépôt de {symbol}",
|
|
51
|
+
* "{count, plural, one {# item} other {# items}}":
|
|
52
|
+
* "{count, plural, one {# article} other {# articles}}",
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // Add a brand-new locale:
|
|
56
|
+
* <KitProvider i18n={{ locale: "fr", messages: { fr } }} />;
|
|
57
|
+
*
|
|
58
|
+
* // Override one key on a shipped locale (spread to preserve the rest):
|
|
59
|
+
* <KitProvider i18n={{ locale: "es", messages: { es: { ...es, ...defineMessages({ Continue: "Adelante" }) } } }} />;
|
|
60
|
+
*
|
|
61
|
+
* // Override source English:
|
|
62
|
+
* <KitProvider i18n={{ locale: "en", messages: { en: defineMessages({ Deposit: "Top up" }) } }} />;
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare function defineMessages(translations: Partial<Record<KitTranslatableKey, string>>): Messages;
|
|
10
66
|
/**
|
|
11
67
|
* Public-facing i18n configuration. Pass the whole object to `<KitProvider i18n={…}>` —
|
|
12
|
-
* `locale` selects the active locale, `
|
|
13
|
-
* against. Locales not present in `
|
|
68
|
+
* `locale` selects the active locale, `messages` lists the catalogs the kit can resolve
|
|
69
|
+
* against. Locales not present in `messages` fall back to the source English string per leaf.
|
|
14
70
|
*/
|
|
15
71
|
interface KitI18nConfig {
|
|
16
|
-
/** Active locale code. Defaults to `"en"`. */
|
|
17
|
-
locale?: string;
|
|
18
72
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
|
|
73
|
+
* Active locale code. Defaults to `"en"`. Autocompletes on shipped locales (`"en"`, `"es"`,
|
|
74
|
+
* `"ar"`) but accepts any other BCP-47 tag for host-supplied catalogs.
|
|
75
|
+
*/
|
|
76
|
+
locale?: KitLocale;
|
|
77
|
+
/**
|
|
78
|
+
* Locale catalogs the kit can resolve against. Each value is a hash-keyed lingui
|
|
79
|
+
* `Messages` map — either deep-imported from `@stridge/kit/i18n/locales/<code>` (shipped
|
|
80
|
+
* locales: `en`, `es`, `ar`) or produced by {@link defineMessages} from a plain
|
|
81
|
+
* English-keyed map (host-authored locales and per-key overrides). Same-locale entries
|
|
82
|
+
* merge per-key — spread a shipped catalog and overlay specific keys via `defineMessages`
|
|
83
|
+
* to override individual phrases without touching the rest.
|
|
22
84
|
*/
|
|
23
|
-
|
|
85
|
+
messages?: KitMessages;
|
|
24
86
|
}
|
|
25
87
|
/**
|
|
26
88
|
* Build a fresh {@link I18n} instance for one render tree (one `KitProvider` mount, one SSR
|
|
27
|
-
* request). Loads `
|
|
89
|
+
* request). Loads each entry of `messages`, registers the runtime message compiler, and
|
|
90
|
+
* activates `locale`.
|
|
28
91
|
*
|
|
29
92
|
* Per-request instances are the SSR-safe alternative to mutating a process-wide singleton. The
|
|
30
|
-
* kit's {@link KitProvider} calls this on every render that changes `locale` or `
|
|
93
|
+
* kit's {@link KitProvider} calls this on every render that changes `locale` or `messages`.
|
|
31
94
|
*
|
|
32
95
|
* `setupI18n` ships its own no-op compiler in production builds; we override with the real
|
|
33
96
|
* `compileMessage` so ICU placeholders (`{symbol}`) and plurals (`{count, plural, one {…}
|
|
@@ -35,7 +98,7 @@ interface KitI18nConfig {
|
|
|
35
98
|
*/
|
|
36
99
|
declare function createKitI18n({
|
|
37
100
|
locale,
|
|
38
|
-
|
|
101
|
+
messages
|
|
39
102
|
}?: KitI18nConfig): I18n;
|
|
40
103
|
//#endregion
|
|
41
|
-
export {
|
|
104
|
+
export { KitI18nConfig, KitLocale, KitMessages, createKitI18n, defineMessages };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{setupI18n as e}from"@lingui/core";import{compileMessage as t}from"@lingui/message-utils/compileMessage";function n({locale:n=`en`,
|
|
1
|
+
import{setupI18n as e}from"@lingui/core";import{compileMessage as t}from"@lingui/message-utils/compileMessage";import{generateMessageId as n}from"@lingui/message-utils/generateMessageId";function r(e){let t={};for(let[r,i]of Object.entries(e))!r||typeof i!=`string`||(t[n(r)]=i);return t}function i({locale:n=`en`,messages:r}={}){let i=e();if(i.setMessagesCompiler(t),i.load(`en`,{}),r)for(let[e,t]of Object.entries(r))t&&i.load(e,t);return i.activate(n),i}export{i as createKitI18n,r as defineMessages};
|
|
@@ -2,7 +2,15 @@ import { ComponentType } from "react";
|
|
|
2
2
|
import { I18n } from "@lingui/core";
|
|
3
3
|
|
|
4
4
|
//#region src/shared/i18n/useLingui.d.ts
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Shape of the value returned by the kit's {@link useLingui}. Mirrors Lingui's own
|
|
7
|
+
* `LinguiContextValue` (`{ i18n, _, defaultComponent? }`) so the macro's rewrite of `` t`…` ``
|
|
8
|
+
* into `_({ id, message })` calls type-checks against this surface.
|
|
9
|
+
*
|
|
10
|
+
* Exported alongside {@link useLingui} so power users wrapping the hook can name the return
|
|
11
|
+
* type without reaching back into Lingui internals.
|
|
12
|
+
*/
|
|
13
|
+
interface KitLinguiContextValue {
|
|
6
14
|
i18n: I18n;
|
|
7
15
|
defaultComponent?: ComponentType<{
|
|
8
16
|
id: string;
|
|
@@ -30,6 +38,6 @@ interface LinguiContextValue {
|
|
|
30
38
|
* Callers shouldn't import this directly — they should write `import { useLingui } from
|
|
31
39
|
* "@lingui/react/macro"` and let the build pipeline rewire the runtime target.
|
|
32
40
|
*/
|
|
33
|
-
declare function useLingui():
|
|
41
|
+
declare function useLingui(): KitLinguiContextValue;
|
|
34
42
|
//#endregion
|
|
35
|
-
export { useLingui };
|
|
43
|
+
export { KitLinguiContextValue, useLingui };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SVGProps } from "react";
|
|
2
|
+
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/shared/icons/LogoIcon.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Stridge brand mark. Path is the optimized 18×18 variant used in social cards, scaled to
|
|
7
|
+
* whatever `width`/`height` the caller passes (defaults to 14×14 for inline use). Decorative
|
|
8
|
+
* when paired with the "Stridge" wordmark — mark it `aria-hidden` in those compositions so
|
|
9
|
+
* screen readers announce the wordmark only once.
|
|
10
|
+
*/
|
|
11
|
+
declare function LogoIcon(props: SVGProps<SVGSVGElement>): _$react_jsx_runtime0.JSX.Element;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { LogoIcon };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";function t(t){return e(`svg`,{fill:`currentColor`,height:`14`,viewBox:`0 0 18 18`,width:`14`,xmlns:`http://www.w3.org/2000/svg`,...t,children:e(`path`,{clipRule:`evenodd`,d:`M0 9a9 9 0 0 0 9 9A9 9 0 1 0 9 0a9 9 0 0 0-9 9Zm11.675 1.953a.88.88 0 0 0-.742.198 5.311 5.311 0 0 1-3.998 1.807C-.985 12.958.955 1.742 9 1.742a7.24 7.24 0 0 1 5.374 2.379 7.042 7.042 0 0 0-3.309-.82A7.048 7.048 0 0 0 5.76 5.697.879.879 0 0 0 7.068 6.85a5.31 5.31 0 0 1 3.998-1.807c7.92 0 5.98 11.216-2.066 11.216a7.237 7.237 0 0 1-5.373-2.379 7.035 7.035 0 0 0 3.308.821 7.044 7.044 0 0 0 5.306-2.398.878.878 0 0 0-.566-1.349Z`,fillRule:`evenodd`})})}export{t as LogoIcon};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as e}from"react";function
|
|
1
|
+
import{useEffect as e,useRef as t}from"react";function n(n,r,i){let a=t(r);a.current=r,e(()=>{let e=a.current;if(e==null)return;let t=new AbortController;return n.watchSettlement(e,()=>void 0,t.signal),()=>t.abort()},[n,i])}export{n as useSettlementWatcher};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{toSafeHref as e}from"../../ui/ExternalLink/toSafeHref.js";import{ExternalLink as t}from"../../ui/ExternalLink/ExternalLink.js";import"../../ui/ExternalLink/index.js";import{ExternalLinkIcon as n}from"../../icons/ExternalLinkIcon.js";import"../../../icons/index.js";import{LtrAtom as r}from"../../ui/LtrAtom/LtrAtom.js";import"../../ui/LtrAtom/index.js";import{text as i}from"../../ui/Text/Text.js";import"../../ui/Text/index.js";import{TX_HASH_VALUE_SLOTS as a}from"./TxHashValue.slots.js";import{styles as o}from"./TxHashValue.styles.js";import{jsx as s}from"react/jsx-runtime";import*as c from"@stylexjs/stylex";function l({hash:l,explorerUrl:u,linkColor:d=`var(--stridge-kit-primary)`}){let f=e(u),p=c.props(o.root),m=s(i.span,{size:`xs`,fontWeight:`medium`,leading:`tight`,tracking:`normal`,font:`mono`,color:`inherit`,children:s(r,{children:l})});return f?s(t,{dir:`ltr`,href:f,suffix:s(n,{"aria-hidden":!0}),"data-stridge-slot":a.root,className:p.className,style:{...p.style,color:d},children:m}):s(`span`,{dir:`ltr`,"data-stridge-slot":a.root,className:p.className,style:p.style,children:m})}export{l as TxHashValue};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{styles as e}from"../ui/ExternalLink/ExternalLink.styles.js";import{joinClassNames as t}from"../utils/joinClassNames.js";import{cloneElement as n,isValidElement as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import*as o from"@stylexjs/stylex";function s({children:n,suffix:r,className:s,style:d,...f}){let p=r!=null&&r!==!1,m=o.props(e.root,l.button),h=t(m.className,s),g=o.props(e.iconSlot,e.suffixSpacing);return a(`button`,{"data-stridge-slot":u.root,type:`button`,...f,className:h,style:{...m.style,...d},children:[n,p?i(`span`,{"data-icon":`inline-end`,...g,children:c(r)}):null]})}function c(t){if(!r(t))return t;let i=o.props(e.iconSvg);return n(t,{className:[t.props.className,i.className].filter(Boolean).join(` `),style:{...t.props.style,...i.style}})}const l={button:{"SupportButton__supportButtonStyles.button":`SupportButton__supportButtonStyles.button`,"appearance-kysU6D":`xjyslct`,"padding-kmVPX3":`x1717udv`,"font-kVVagm":`xln7xf2`,"color-kMwMTN":`x1heor9g`,"cursor-kkrTdU":`x1ypdohk`,"textAlign-k9WMMc":`x16tdsg8`,$$css:`@stridge/kit:src/shared/support/SupportButton.tsx:52`}},u={root:`support-button`};export{s as SupportButton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{createContext as e,use as t}from"react";const n=e({config:void 0,merchantContext:null});n.displayName=`SupportConfigContext`;function r(){return t(n)}export{n as SupportConfigContext,r as useSupportConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { CSSProperties, MouseEventHandler, ReactNode } from "react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useSupportConfig as e}from"./SupportConfigContext.js";import{resolveSupport as t}from"./resolveSupport.js";import{SupportButton as n}from"./SupportButton.js";import{BRAND_LINKS as r}from"../constants/brand-links.js";import{ExternalLink as i}from"../ui/ExternalLink/ExternalLink.js";import"../ui/ExternalLink/index.js";import{SupportSpinner as a}from"./SupportSpinner.js";import{useSupportTrigger as o}from"./useSupportTrigger.js";import{useCallback as s}from"react";import{jsx as c}from"react/jsx-runtime";const l={cursor:`not-allowed`,opacity:.6,pointerEvents:`none`};function u(n){let{config:r,merchantContext:i}=e(),a=t(r);return a.kind===`stridge`?c(d,{...n}):a.kind===`url`?c(f,{...n,url:a.url}):c(p,{...n,url:a.url,onOpen:a.onOpen,merchantContext:i})}function d({children:e,suffix:t,onClick:n,style:u,...d}){let f=o(),p=f.status===`loading`,m=s(e=>{n?.(e),!e.defaultPrevented&&e.button===0&&(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),f.open()))},[f,n]),h=p?{...u,...l}:u;return c(i,{...d,href:r.support,suffix:p?c(a,{}):t,onClick:m,"aria-busy":p||void 0,"aria-disabled":p||void 0,style:h,children:e})}function f({url:e,children:t,...n}){return c(i,{...n,href:e,children:t})}function p({url:e,onOpen:t,merchantContext:r,children:a,suffix:o,onClick:l,...u}){let d=s(e=>{l?.(e),!e.defaultPrevented&&e.button===0&&(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),t({event:e,...m(r)})))},[l,t,r]),f=s(e=>{l?.(e),!e.defaultPrevented&&t({event:e,...m(r)})},[l,t,r]);return e?c(i,{...u,href:e,suffix:o,onClick:d,children:a}):c(n,{...u,suffix:o,onClick:f,children:a})}function m(e){return e??{gatewayKey:``,environment:``,assetChain:``,assetSymbol:``}}export{u as SupportLink};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LoaderIcon as e}from"../icons/LoaderIcon.js";import"../../icons/index.js";import{jsx as t}from"react/jsx-runtime";function n(){return t(e,{"aria-hidden":!0,role:`img`,"aria-label":`Loading`,className:`SupportSpinner__styles.spinning x1aerksh xof6966 x1esw782 xa4qsjk x1g0ag68 x1764fhq`,"data-style-src":`@stridge/kit:src/shared/support/SupportSpinner.tsx:12`})}export{n as SupportSpinner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./SupportConfigContext.js";import"./intercom-loader.js";import"./resolveSupport.js";import"./SupportButton.js";import"./SupportSpinner.js";import"./useSupportTrigger.js";import"./SupportLink.js";import"./useIntercomMerchantContext.js";import"./useIntercomShutdownOnUnmount.js";import"./useMerchantContext.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/shared/support/intercom-loader.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Messenger command dispatcher exposed at `window.Intercom`. The vendor accepts arbitrary
|
|
4
|
+
* command tuples (`["boot", settings]`, `["onShow", callback]`, `["show"]`, …); our calls
|
|
5
|
+
* are funneled through {@link openIntercom} / {@link shutdownIntercom}.
|
|
6
|
+
*/
|
|
7
|
+
type IntercomFn = (...args: unknown[]) => void;
|
|
8
|
+
declare global {
|
|
9
|
+
interface Window {
|
|
10
|
+
Intercom?: IntercomFn;
|
|
11
|
+
intercomSettings?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns `true` when the vendor's real dispatcher is mounted on `window.Intercom`. Used by
|
|
16
|
+
* {@link useSupportTrigger} as a hint for whether a subsequent click can skip the spinner.
|
|
17
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BRAND_INTERCOM as e}from"../constants/brand-intercom.js";const t=`__stridgeKitShim__`;let n=null,r=!1;function i(e){return e[t]===!0}function a(){if(typeof window>`u`)return!1;let t=window.intercomSettings?.app_id,n=!1;if(typeof t==`string`&&t!==e.appId)n=!0;else{let e=window.Intercom;typeof e==`function`&&!i(e)&&t===void 0&&(n=!0)}return n&&o(),n}function o(){r||process.env.NODE_ENV!==`production`&&(r=!0,console.warn("[@stridge/kit] Detected a foreign Intercom workspace already mounted on this page. The kit's support link will fall back to opening the static support URL in a new tab. Configure `<StridgeProvider support={{ url: '...' }} />` or `<StridgeProvider support={{ onOpen: ... }} />` to silence this warning and customize the behavior."))}function s(){let e=window;if(typeof e.Intercom==`function`)return e.Intercom;let n=[],r=Object.assign((...e)=>{n.push(e)},{q:n,c:e=>{n.push(e)},[t]:!0});return e.Intercom=r,r}function c(){return n||(typeof document>`u`?Promise.reject(Error(`Intercom can only load in a browser`)):(n=new Promise((t,r)=>{let a=document.createElement(`script`);a.type=`text/javascript`,a.async=!0,a.src=`https://widget.intercom.io/widget/${e.appId}`,a.dataset.stridgeIntercom=`true`,a.addEventListener(`load`,()=>t()),a.addEventListener(`error`,()=>{n=null,a.remove(),typeof window<`u`&&window.Intercom&&i(window.Intercom)&&delete window.Intercom,r(Error(`Failed to load Intercom widget script`))}),document.head.appendChild(a)}),n))}function l(){if(typeof window>`u`)return!1;let e=window.Intercom;return typeof e==`function`&&!i(e)}function u(){return typeof window>`u`?Promise.reject(Error(`Intercom can only load in a browser`)):a()?Promise.reject(Error(`Another Intercom workspace is already mounted; falling back to web link`)):new Promise((t,n)=>{let r=window;r.intercomSettings={...r.intercomSettings,app_id:e.appId,hide_default_launcher:!0};let i=s(),a=!1,o,l=e=>{a||(a=!0,o!==void 0&&clearTimeout(o),e())};i(`boot`,{...r.intercomSettings,app_id:e.appId,hide_default_launcher:!0}),i(`onShow`,()=>{l(()=>t())}),i(`onHide`,()=>{d()}),i(`show`),o=setTimeout(()=>{l(()=>n(Error(`Intercom messenger did not display within timeout`)))},1e4),c().catch(e=>{l(()=>n(e))})})}function d(){if(typeof window>`u`)return;let e=window.Intercom;if(typeof e==`function`&&!i(e))try{e(`shutdown`)}catch{}}export{l as isIntercomReady,u as openIntercom,d as shutdownIntercom};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e?.onOpen?e.url?{kind:`custom`,onOpen:e.onOpen,url:e.url}:{kind:`custom`,onOpen:e.onOpen}:e?.url?{kind:`url`,url:e.url}:{kind:`stridge`}}export{e as resolveSupport};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { IntercomMerchantContext } from "./useIntercomMerchantContext.js";
|
|
2
|
+
import { MouseEvent } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/shared/support/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Configures the kit's in-dialog "Get help" entry point.
|
|
7
|
+
*
|
|
8
|
+
* Omit `support` to boot Stridge's hosted messenger on plain left-click and fall back to
|
|
9
|
+
* {@link https://stridge.com/contact-us | the support URL}. Provide `url`, `onOpen`, or both
|
|
10
|
+
* to use merchant-owned support; either field opts out of Stridge messenger globals. Empty
|
|
11
|
+
* values (`{}` or `{ url: "" }`) fall back to the Stridge default.
|
|
12
|
+
*
|
|
13
|
+
* Treated as static across the kit's lifetime. Switching the mode after mount (e.g. from
|
|
14
|
+
* Stridge to merchant-owned support) is not supported — the kit will not shut down an
|
|
15
|
+
* already-booted Stridge messenger or clear `window.intercomSettings` on the transition.
|
|
16
|
+
* Resolve support configuration before the first render of `<StridgeProvider>`.
|
|
17
|
+
*/
|
|
18
|
+
interface SupportConfig {
|
|
19
|
+
/**
|
|
20
|
+
* URL used as the "Get help" anchor `href`.
|
|
21
|
+
*
|
|
22
|
+
* Empty string is treated as if the field were omitted.
|
|
23
|
+
*/
|
|
24
|
+
url?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Custom click handler invoked instead of the default Stridge messenger.
|
|
27
|
+
*
|
|
28
|
+
* Fires on plain left-click with the click event and the merchant/user triage metadata.
|
|
29
|
+
* Modified clicks keep anchor navigation when `url` is set.
|
|
30
|
+
*/
|
|
31
|
+
onOpen?: (ctx: SupportOpenContext) => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Represents the argument passed to {@link SupportConfig.onOpen}.
|
|
35
|
+
*
|
|
36
|
+
* Combines the click event with the same triage metadata used by the Stridge messenger.
|
|
37
|
+
*/
|
|
38
|
+
interface SupportOpenContext extends IntercomMerchantContext {
|
|
39
|
+
/** React synthetic event for the click that triggered support. */
|
|
40
|
+
event: MouseEvent<HTMLElement>;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { SupportConfig, SupportOpenContext };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/shared/support/useIntercomMerchantContext.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Merchant, asset, and end-user triage metadata the kit attaches to support requests.
|
|
4
|
+
*
|
|
5
|
+
* Stridge's hosted messenger reads these fields via `window.intercomSettings` so support
|
|
6
|
+
* agents can route an incoming conversation without asking the user for context. Merchant-
|
|
7
|
+
* owned support entry points receive the same shape via
|
|
8
|
+
* {@link SupportOpenContext}, so triage data carries through verbatim into custom handlers.
|
|
9
|
+
*/
|
|
10
|
+
interface IntercomMerchantContext {
|
|
11
|
+
/** Stridge gateway key — primary key uniquely identifying which integrating business the user is coming through. */
|
|
12
|
+
gatewayKey: string;
|
|
13
|
+
/** Stridge API environment the kit is talking to. Goes alongside the gateway key for support triage. */
|
|
14
|
+
environment: string;
|
|
15
|
+
/** Stridge `network_id` of the settlement asset (e.g. `"60"`, `"9006"`). */
|
|
16
|
+
assetChain: string;
|
|
17
|
+
/** Settlement asset symbol (e.g. `"USDC"`). */
|
|
18
|
+
assetSymbol: string;
|
|
19
|
+
/** Connected wallet address — best-effort end-user identifier in a web3 context. */
|
|
20
|
+
userAddress?: string;
|
|
21
|
+
/** Merchant display name resolved from `gateway/start.metadata.brand_name`. Async; undefined pre-bootstrap. */
|
|
22
|
+
brandName?: string;
|
|
23
|
+
/** Optional secondary line from `gateway/start.metadata.checkout_item_title`. */
|
|
24
|
+
checkoutItemTitle?: string;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { IntercomMerchantContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{BRAND_INTERCOM as e}from"../constants/brand-intercom.js";import{useEffect as t}from"react";function n(n){let r=n?.gatewayKey,i=n?.environment,a=n?.assetChain,o=n?.assetSymbol,s=n?.userAddress,c=n?.brandName,l=n?.checkoutItemTitle;t(()=>{if(!r||!i||!a||!o||typeof window>`u`)return;let t=window.intercomSettings?.app_id;if(typeof t==`string`&&t!==e.appId)return;let n={company_id:r,environment:i,asset_chain:a,asset_symbol:o};c&&(n.name=c),l&&(n.checkout_item_title=l);let u={...window.intercomSettings,app_id:e.appId,hide_default_launcher:!0,company:n};if(s&&(u.user_id=s,u.wallet_address=s),window.intercomSettings=u,typeof window.Intercom==`function`)try{window.Intercom(`update`,u)}catch{}},[r,i,a,o,s,c,l])}export{n as useIntercomMerchantContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{shutdownIntercom as e}from"./intercom-loader.js";import{useEffect as t}from"react";function n(){t(()=>()=>{e()},[])}export{n as useIntercomShutdownOnUnmount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useSyncExternalStore as e}from"react";function t({gatewayKey:t,environment:n,assetChain:r,assetSymbol:i,userAddress:a,depositDriver:o}){let s=e(e=>o?.subscribe(e)??(()=>{}),()=>{if(!o)return;let e=o.getSnapshot();if(e.brand.status===`ready`||e.brand.status===`stale`)return e.brand.payload.name},()=>void 0),c=e(e=>o?.subscribe(e)??(()=>{}),()=>{if(!o)return;let e=o.getSnapshot();if(e.brand.status===`ready`||e.brand.status===`stale`)return e.brand.payload.checkoutItemTitle},()=>void 0);return{gatewayKey:t,environment:n,assetChain:r,assetSymbol:i,...a?{userAddress:a}:{},...s?{brandName:s}:{},...c?{checkoutItemTitle:c}:{}}}export{t as useMerchantContext};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{isIntercomReady as e,openIntercom as t}from"./intercom-loader.js";import{BRAND_LINKS as n}from"../constants/brand-links.js";import{useCallback as r,useRef as i,useState as a}from"react";function o(){let[n,o]=a(()=>e()?`ready`:`idle`),c=i(!1);return{status:n,open:r(()=>{c.current||(c.current=!0,o(`loading`),t().then(()=>{c.current=!1,o(`ready`)},()=>{c.current=!1,s(),o(`error`)}))},[])}}function s(){typeof window>`u`||window.open(n.support,`_blank`,`noopener,noreferrer`)}export{o as useSupportTrigger};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{styles as e}from"../ui/ExternalLink/ExternalLink.styles.js";import{joinClassNames as t}from"../utils/joinClassNames.js";import{jsx as n}from"react/jsx-runtime";import*as r from"@stylexjs/stylex";function i({children:i,className:s,style:c,...l}){let u=r.props(e.root,a.button),d=t(u.className,s);return n(`button`,{"data-stridge-slot":o.root,type:`button`,...l,className:d,style:{...u.style,...c},children:i})}const a={button:{"TermsButton__termsButtonStyles.button":`TermsButton__termsButtonStyles.button`,"appearance-kysU6D":`xjyslct`,"padding-kmVPX3":`x1717udv`,"font-kVVagm":`xln7xf2`,"color-kMwMTN":`x1heor9g`,"cursor-kkrTdU":`x1ypdohk`,"textAlign-k9WMMc":`x16tdsg8`,$$css:`@stridge/kit:src/shared/terms/TermsButton.tsx:28`}},o={root:`terms-button`};export{i as TermsButton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{createContext as e,use as t}from"react";const n=e({config:void 0});n.displayName=`TermsConfigContext`;function r(){return t(n)}export{n as TermsConfigContext,r as useTermsConfig};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { CSSProperties, MouseEventHandler, ReactNode } from "react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useTermsConfig as e}from"./TermsConfigContext.js";import{BRAND_LINKS as t}from"../constants/brand-links.js";import{ExternalLink as n}from"../ui/ExternalLink/ExternalLink.js";import"../ui/ExternalLink/index.js";import{resolveTerms as r}from"./resolveTerms.js";import{TermsButton as i}from"./TermsButton.js";import{useCallback as a}from"react";import{jsx as o}from"react/jsx-runtime";function s(t){let{config:n}=e(),i=r(n);return i.kind===`stridge`?o(c,{...t}):i.kind===`url`?o(l,{...t,url:i.url}):o(u,{...t,url:i.url,onSelect:i.onSelect})}function c(e){return o(n,{...e,href:t.terms})}function l({url:e,...t}){return o(n,{...t,href:e})}function u({url:e,onSelect:t,children:r,onClick:s,...c}){let l=a(e=>{s?.(e),!e.defaultPrevented&&e.button===0&&(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),t({event:e})))},[s,t]),u=a(e=>{s?.(e),!e.defaultPrevented&&t({event:e})},[s,t]);return e?o(n,{...c,href:e,onClick:l,children:r}):o(i,{...c,onClick:u,children:r})}export{s as TermsLink};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { TermsConfig, TermsSelectContext } from "./types.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./TermsConfigContext.js";import"./resolveTerms.js";import"./TermsButton.js";import"./TermsLink.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e?.onSelect?e.url?{kind:`custom`,onSelect:e.onSelect,url:e.url}:{kind:`custom`,onSelect:e.onSelect}:e?.url?{kind:`url`,url:e.url}:{kind:`stridge`}}export{e as resolveTerms};
|