@stridge/kit 0.1.0-alpha.17 → 0.1.0-alpha.18
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/dist/KitProvider.d.ts +12 -0
- package/dist/KitProvider.js +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/package.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 -1
- package/dist/shared/support/SupportSpinner.d.ts +1 -0
- package/dist/shared/support/index.d.ts +2 -0
- package/dist/shared/support/index.js +1 -1
- package/dist/shared/support/intercom-loader.d.ts +17 -0
- package/dist/shared/support/intercom-loader.js +1 -1
- 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 -1
- package/dist/shared/support/useMerchantContext.d.ts +1 -0
- package/dist/shared/support/useMerchantContext.js +1 -0
- package/dist/shared/ui/ExternalLink/ExternalLink.js +1 -1
- package/dist/stridge/StridgeProvider.d.ts +9 -0
- package/dist/stridge/StridgeProvider.js +1 -1
- package/package.json +1 -1
package/dist/KitProvider.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { DepositDriver } from "./flows/deposit/driver/types.js";
|
|
|
2
2
|
import { WithdrawDriver } from "./flows/withdraw/driver/types.js";
|
|
3
3
|
import { KitScope } from "./scope/KitScope.js";
|
|
4
4
|
import { KitI18nConfig } from "./shared/i18n/createKitI18n.js";
|
|
5
|
+
import { IntercomMerchantContext } from "./shared/support/useIntercomMerchantContext.js";
|
|
6
|
+
import { SupportConfig } from "./shared/support/types.js";
|
|
5
7
|
import { KitStoragePersistence } from "./storage/types.js";
|
|
6
8
|
import * as _$react_jsx_runtime0 from "react/jsx-runtime";
|
|
7
9
|
|
|
@@ -48,6 +50,8 @@ declare function KitProvider({
|
|
|
48
50
|
withdraw,
|
|
49
51
|
storage,
|
|
50
52
|
storageNamespace,
|
|
53
|
+
support,
|
|
54
|
+
merchantContext,
|
|
51
55
|
attribution,
|
|
52
56
|
...scopeProps
|
|
53
57
|
}: KitProvider.Props): _$react_jsx_runtime0.JSX.Element;
|
|
@@ -86,6 +90,14 @@ declare namespace KitProvider {
|
|
|
86
90
|
* keep state isolated. Defaults to `stridge-kit:storage:v1`.
|
|
87
91
|
*/
|
|
88
92
|
storageNamespace?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Merchant-configurable in-dialog "Get help" override for direct `<KitProvider />` mounts.
|
|
95
|
+
*/
|
|
96
|
+
support?: SupportConfig;
|
|
97
|
+
/**
|
|
98
|
+
* Merchant and user triage metadata passed to merchant-owned support callbacks.
|
|
99
|
+
*/
|
|
100
|
+
merchantContext?: IntercomMerchantContext;
|
|
89
101
|
}
|
|
90
102
|
}
|
|
91
103
|
//#endregion
|
package/dist/KitProvider.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{KitStorageProvider as e}from"./storage/context.js";import"./storage/index.js";import{DepositDriverProvider as t}from"./flows/deposit/driver/context.js";import{getLocaleDirection as n}from"./shared/i18n/getLocaleDirection.js";import{KitI18nProvider as r}from"./shared/i18n/KitI18nProvider.js";import"./i18n/index.js";import{GatewayController as i}from"./flows/deposit/orchestrator/controller.js";import{WithdrawDriverProvider as a}from"./flows/withdraw/driver/context.js";import{WithdrawDialogBindingsProvider as o}from"./flows/withdraw/dialog/WithdrawDialogBindingsContext.js";import{WithdrawControllerProvider as s}from"./flows/withdraw/orchestrator/controller.js";import{KitScope as c}from"./scope/KitScope.js";import"./scope/index.js";import{
|
|
1
|
+
"use client";import{KitStorageProvider as e}from"./storage/context.js";import"./storage/index.js";import{DepositDriverProvider as t}from"./flows/deposit/driver/context.js";import{getLocaleDirection as n}from"./shared/i18n/getLocaleDirection.js";import{KitI18nProvider as r}from"./shared/i18n/KitI18nProvider.js";import"./i18n/index.js";import{GatewayController as i}from"./flows/deposit/orchestrator/controller.js";import{WithdrawDriverProvider as a}from"./flows/withdraw/driver/context.js";import{WithdrawDialogBindingsProvider as o}from"./flows/withdraw/dialog/WithdrawDialogBindingsContext.js";import{WithdrawControllerProvider as s}from"./flows/withdraw/orchestrator/controller.js";import{KitScope as c}from"./scope/KitScope.js";import"./scope/index.js";import{SupportConfigContext as l}from"./shared/support/SupportConfigContext.js";import{useMemo as u}from"react";import{jsx as d}from"react/jsx-runtime";function f({children:f,i18n:p,direction:m,deposit:h,withdraw:g,storage:_,storageNamespace:v,support:y,merchantContext:b,attribution:x=`visible`,...S}){let C=n(p?.locale),w=f;g&&(w=d(o,{children:d(a,{driver:g,children:d(s,{children:w})})})),h&&(w=d(t,{driver:h,children:d(i,{children:w})}));let T=u(()=>({config:y,merchantContext:b??null}),[y,b]),E=y!==void 0||b!==void 0,D=d(r,{locale:p?.locale,messages:p?.messages,children:d(c,{...S,direction:m??C,locale:p?.locale,attribution:x,children:d(e,{storage:_,namespace:v,children:w})})});return E?d(l.Provider,{value:T,children:D}):D}export{f as KitProvider};
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { WithdrawSnapshot } from "./flows/withdraw/driver/types.js";
|
|
|
5
5
|
import { useWithdrawSnapshot } from "./flows/withdraw/driver/context.js";
|
|
6
6
|
import { useKitConfig } from "./scope/context.js";
|
|
7
7
|
import { KitPortalScope } from "./scope/KitPortalScope.js";
|
|
8
|
+
import { IntercomMerchantContext } from "./shared/support/useIntercomMerchantContext.js";
|
|
9
|
+
import { SupportConfig, SupportOpenContext } from "./shared/support/types.js";
|
|
8
10
|
import { createLocalStorageAdapter, createMemoryStorageAdapter, createSessionStorageAdapter, resolveStorageAdapter } from "./storage/adapters.js";
|
|
9
11
|
import { createKitStorage } from "./storage/createKitStorage.js";
|
|
10
12
|
import { DEFAULT_KIT_STORAGE_NAMESPACE, KitStorageProvider, useKitStorage, useKitStorageValue } from "./storage/context.js";
|
|
@@ -23,4 +25,4 @@ import { useWithdrawState } from "./flows/withdraw/orchestrator/controller.js";
|
|
|
23
25
|
import { useWithdraw } from "./flows/withdraw/orchestrator/useWithdraw.js";
|
|
24
26
|
import { useOptionalStridge, useStridge } from "./stridge/StridgeContext.js";
|
|
25
27
|
import { StridgeAppearance, StridgeAsset, StridgeDepositDestination, StridgeDepositFlowConfig, StridgeFlowOwner, StridgeProvider, StridgeStorageConfig, StridgeWithdrawFlowConfig } from "./stridge/StridgeProvider.js";
|
|
26
|
-
export { type BannerAckBucket, type ChainInput, type ChainLogoInput, type ChainLogoMeta, type ChainSlug, DEFAULT_KIT_STORAGE_NAMESPACE, type DepositActions, type DepositController, type DepositMethod, type OpenInput as DepositOpenInput, type DepositSnapshot, type DepositState, type DepositStateName, type FailureInfo, KitPortalScope, KitStorageProvider, type LogosNamespace, type StridgeAppearance, type StridgeAsset, type StridgeDepositDestination, type StridgeDepositFlowConfig, type StridgeEnvironment, type StridgeFlowOwner, StridgeProvider, type StridgeStorageConfig, type StridgeWithdrawFlowConfig, type TokenLogoInput, type TxRef, type WithdrawActions, type WithdrawController, type WithdrawSnapshot, type WithdrawState, type WithdrawStateName, type WithdrawalFormSnapshot, bannerAckStorageKey, bucketFromSettlement, chains, createKitStorage, createLocalStorageAdapter, createMemoryStorageAdapter, createSessionStorageAdapter, logos, resolveStorageAdapter, useBannerAck, useBannerAckForSettlement, useDeposit, useDepositSnapshot, useDepositState, useKitConfig, useKitStorage, useKitStorageValue, useOptionalStridge, useStridge, useWithdraw, useWithdrawSnapshot, useWithdrawState };
|
|
28
|
+
export { type BannerAckBucket, type ChainInput, type ChainLogoInput, type ChainLogoMeta, type ChainSlug, DEFAULT_KIT_STORAGE_NAMESPACE, type DepositActions, type DepositController, type DepositMethod, type OpenInput as DepositOpenInput, type DepositSnapshot, type DepositState, type DepositStateName, type FailureInfo, type IntercomMerchantContext, KitPortalScope, KitStorageProvider, type LogosNamespace, type StridgeAppearance, type StridgeAsset, type StridgeDepositDestination, type StridgeDepositFlowConfig, type StridgeEnvironment, type StridgeFlowOwner, StridgeProvider, type StridgeStorageConfig, type StridgeWithdrawFlowConfig, type SupportConfig, type SupportOpenContext, type TokenLogoInput, type TxRef, type WithdrawActions, type WithdrawController, type WithdrawSnapshot, type WithdrawState, type WithdrawStateName, type WithdrawalFormSnapshot, bannerAckStorageKey, bucketFromSettlement, chains, createKitStorage, createLocalStorageAdapter, createMemoryStorageAdapter, createSessionStorageAdapter, logos, resolveStorageAdapter, useBannerAck, useBannerAckForSettlement, useDeposit, useDepositSnapshot, useDepositState, useKitConfig, useKitStorage, useKitStorageValue, useOptionalStridge, useStridge, useWithdraw, useWithdrawSnapshot, useWithdrawState };
|
package/dist/package.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`0.1.0-alpha.
|
|
1
|
+
var e=`0.1.0-alpha.18`;export{e as version};
|
|
@@ -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";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
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 { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./intercom-loader.js";import"./SupportSpinner.js";import"./useSupportTrigger.js";import"./SupportLink.js";import"./useIntercomMerchantContext.js";import"./useIntercomShutdownOnUnmount.js";
|
|
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
|
+
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BRAND_INTERCOM as e}from"../constants/brand-intercom.js";const t=`__stridgeKitShim__`;let n=null;function
|
|
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 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{BRAND_INTERCOM as e}from"../constants/brand-intercom.js";import{useEffect as t}from"react";function n({gatewayKey
|
|
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
|
+
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{styles as e}from"./ExternalLink.styles.js";import{joinClassNames as t}from"../../utils/joinClassNames.js";import{EXTERNAL_LINK_SLOTS as n}from"./ExternalLink.slots.js";import{toSafeHref as r}from"./toSafeHref.js";import{cloneElement as i,isValidElement as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";import*as c from"@stylexjs/stylex";function l({href:i,suffix:a,className:l,style:d,children:f,...p}){let m=r(i)??`#`,h=a!=null&&a!==!1,g=c.props(e.root),_=t(g.className,l),v=c.props(e.iconSlot,e.suffixSpacing);return s(`a`,{"data-stridge-slot":n.root,...p,href:m,target:`_blank`,rel:`noreferrer noopener`,className:_,style:{...g.style,...d},children:[f,h?o(`span`,{"data-icon":`inline-end`,...v,children:u(a)}):null]})}function u(t){if(!a(t))return t;let n=c.props(e.iconSvg);return i(t,{className:[t.props.className,n.className].filter(Boolean).join(` `),style:{...t.props.style,...n.style}})}export{l as ExternalLink};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { KitI18nConfig } from "../shared/i18n/createKitI18n.js";
|
|
2
|
+
import { SupportConfig } from "../shared/support/types.js";
|
|
2
3
|
import { StridgeEnvironment } from "../drivers/stridge/types.js";
|
|
3
4
|
import { ChainInput } from "../shared/chains/index.js";
|
|
4
5
|
import { Address } from "viem";
|
|
@@ -187,6 +188,13 @@ declare namespace StridgeProvider {
|
|
|
187
188
|
* prefix at the call site.
|
|
188
189
|
*/
|
|
189
190
|
dev?: StridgeDevConfig;
|
|
191
|
+
/**
|
|
192
|
+
* Customer-support entry point configuration.
|
|
193
|
+
*
|
|
194
|
+
* Omit to use Stridge Intercom. Provide `url`, `onOpen`, or both to use merchant-owned
|
|
195
|
+
* support and opt out of Stridge messenger globals.
|
|
196
|
+
*/
|
|
197
|
+
support?: SupportConfig;
|
|
190
198
|
/** Optional className applied to the kit's scope root `<div>`. */
|
|
191
199
|
className?: string;
|
|
192
200
|
children?: ReactNode;
|
|
@@ -226,6 +234,7 @@ declare function StridgeProvider({
|
|
|
226
234
|
i18n,
|
|
227
235
|
storage,
|
|
228
236
|
dev,
|
|
237
|
+
support,
|
|
229
238
|
className,
|
|
230
239
|
children
|
|
231
240
|
}: StridgeProvider.Props): _$react_jsx_runtime0.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{normalizeChainToNetworkId as e}from"../shared/chains/index.js";import{createKitI18n as t}from"../shared/i18n/createKitI18n.js";import"../i18n/index.js";import{StridgeContext as n}from"./StridgeContext.js";import{createStridgeDepositDriver as r}from"../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as i}from"../drivers/stridge/createStridgeWithdrawDriver.js";import"../_internal/drivers/stridge/index.js";import{KitProvider as a}from"../KitProvider.js";import{
|
|
1
|
+
"use client";import{normalizeChainToNetworkId as e}from"../shared/chains/index.js";import{createKitI18n as t}from"../shared/i18n/createKitI18n.js";import"../i18n/index.js";import{StridgeContext as n}from"./StridgeContext.js";import{createStridgeDepositDriver as r}from"../drivers/stridge/createStridgeDepositDriver.js";import{createStridgeWithdrawDriver as i}from"../drivers/stridge/createStridgeWithdrawDriver.js";import"../_internal/drivers/stridge/index.js";import{KitProvider as a}from"../KitProvider.js";import{resolveSupport as o}from"../shared/support/resolveSupport.js";import{useIntercomMerchantContext as s}from"../shared/support/useIntercomMerchantContext.js";import{useMerchantContext as c}from"../shared/support/useMerchantContext.js";import"../shared/support/index.js";import{useOptionalWagmi as l}from"./optionalWagmi.js";import{createStubDepositDriver as u,createStubWithdrawDriver as d}from"./stubs.js";import{useMemo as f,useRef as p,useSyncExternalStore as m}from"react";import{jsx as h}from"react/jsx-runtime";function g({gatewayKey:g,environment:_,asset:v,flows:y,appearance:b,i18n:x,storage:S,dev:C,support:w,className:T,children:E}){if(!y.deposit&&!y.withdraw)throw Error("<StridgeProvider /> requires at least one of `flows.deposit` or `flows.withdraw`.");if(!v)throw Error("<StridgeProvider /> requires `asset: { chain, symbol }`.");let{config:D,address:O}=l(),k=f(()=>t(x??{}),[x?.locale,x?.messages]),A=p(k);A.current=k;let j=f(()=>e(v.chain),[v.chain]),M=v.symbol,N=y.deposit,P=y.withdraw,F=N?.owner?.address??O??C?.userAddressOverride,I=P?.owner.address,L=f(()=>{if(!(!N||!F))return r({userAddress:F,projectKey:g,destination:{network_id:j,asset_symbol:M,to_address:N.destination.address},wagmiConfig:D,getI18n:()=>A.current,..._?{environment:_}:{},...N.minDepositUsd===void 0?{}:{minDepositUsd:N.minDepositUsd},...N.metadata?{metadata:N.metadata}:{}})},[N,F,g,_,j,M,D]),R=f(()=>u(),[]),z=N?L??R:void 0,B=f(()=>{if(!(!P||!I))return i({userAddress:I,projectKey:g,currency:{networkId:j,assetSymbol:M},wagmiConfig:D,getI18n:()=>A.current,..._?{environment:_}:{},...P.metadata?{metadata:P.metadata}:{}})},[P,I,g,_,j,M,D]),V=f(()=>d(),[]),H=P?B??V:void 0,U=L??B,W=m(e=>U?.subscribe(e)??(()=>{}),()=>{if(L){let e=L.getSnapshot();return e.brand.status===`ready`&&e.target.status===`ready`}return B?B.getSnapshot().receiveOptions.status===`ready`:!1},()=>!1),G=F??I,K=c({gatewayKey:g,environment:_??`production`,assetChain:j,assetSymbol:M,...G?{userAddress:G}:{},...L?{depositDriver:L}:{}});return s(o(w).kind===`stridge`?K:null),h(n,{value:f(()=>({isReady:W,driver:L}),[W,L]),children:h(a,{theme:b?.theme,accent:b?.accent,radius:b?.radius,direction:b?.direction,attribution:b?.attribution,i18n:x,storage:S?.driver,storageNamespace:S?.namespace,className:T,support:w,merchantContext:K,...z?{deposit:z}:{},...H?{withdraw:H}:{},children:E})})}export{g as StridgeProvider};
|