@frak-labs/core-sdk 0.1.1 → 0.2.0
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 +58 -0
- package/cdn/bundle.js +14 -0
- package/dist/actions.cjs +1 -1
- package/dist/actions.d.cts +3 -3
- package/dist/actions.d.ts +3 -3
- package/dist/actions.js +1 -1
- package/dist/bundle.cjs +1 -1
- package/dist/bundle.d.cts +4 -6
- package/dist/bundle.d.ts +4 -6
- package/dist/bundle.js +1 -1
- package/dist/{index-CRsQWnTs.d.cts → computeLegacyProductId-BkyJ4rEY.d.ts} +197 -10
- package/dist/{index-Ck1hudEi.d.ts → computeLegacyProductId-Raks6FXg.d.cts} +197 -10
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +1 -1
- package/dist/{openSso-D--Airj6.d.cts → openSso-BCJGchIb.d.cts} +135 -131
- package/dist/{openSso-DsKJ4y0j.d.ts → openSso-DG-_9CED.d.ts} +135 -131
- package/dist/setupClient-CQrMDGyZ.js +13 -0
- package/dist/setupClient-Ccv3XxwL.cjs +13 -0
- package/dist/{index-d8xS4ryI.d.ts → siweAuthenticate-BH7Dn7nZ.d.cts} +90 -65
- package/dist/siweAuthenticate-BJHbtty4.js +1 -0
- package/dist/{index-C6FxkWPC.d.cts → siweAuthenticate-Btem4QHs.d.ts} +90 -65
- package/dist/siweAuthenticate-Cwj3HP0m.cjs +1 -0
- package/dist/trackEvent-M2RLTQ2p.js +1 -0
- package/dist/trackEvent-T_R9ER2S.cjs +1 -0
- package/package.json +11 -22
- package/src/actions/displayEmbeddedWallet.ts +1 -0
- package/src/actions/displayModal.test.ts +12 -11
- package/src/actions/displayModal.ts +7 -18
- package/src/actions/ensureIdentity.ts +68 -0
- package/src/actions/{getProductInformation.test.ts → getMerchantInformation.test.ts} +33 -50
- package/src/actions/getMerchantInformation.ts +16 -0
- package/src/actions/index.ts +3 -2
- package/src/actions/openSso.ts +4 -2
- package/src/actions/referral/processReferral.test.ts +42 -151
- package/src/actions/referral/processReferral.ts +18 -42
- package/src/actions/referral/referralInteraction.test.ts +1 -7
- package/src/actions/referral/referralInteraction.ts +1 -6
- package/src/actions/sendInteraction.ts +46 -22
- package/src/actions/trackPurchaseStatus.test.ts +354 -141
- package/src/actions/trackPurchaseStatus.ts +48 -11
- package/src/actions/watchWalletStatus.ts +2 -3
- package/src/actions/wrapper/modalBuilder.test.ts +0 -14
- package/src/actions/wrapper/modalBuilder.ts +3 -12
- package/src/bundle.ts +0 -1
- package/src/clients/createIFrameFrakClient.ts +10 -5
- package/src/clients/transports/iframeLifecycleManager.test.ts +163 -4
- package/src/clients/transports/iframeLifecycleManager.ts +172 -33
- package/src/constants/interactionTypes.ts +12 -41
- package/src/index.ts +24 -16
- package/src/types/config.ts +6 -0
- package/src/types/index.ts +13 -10
- package/src/types/lifecycle/client.ts +24 -1
- package/src/types/lifecycle/iframe.ts +6 -0
- package/src/types/rpc/displayModal.ts +2 -4
- package/src/types/rpc/embedded/index.ts +2 -2
- package/src/types/rpc/interaction.ts +26 -39
- package/src/types/rpc/merchantInformation.ts +77 -0
- package/src/types/rpc/modal/index.ts +0 -4
- package/src/types/rpc/modal/login.ts +5 -1
- package/src/types/rpc/walletStatus.ts +1 -7
- package/src/types/rpc.ts +22 -30
- package/src/types/tracking.ts +60 -0
- package/src/utils/backendUrl.test.ts +83 -0
- package/src/utils/backendUrl.ts +62 -0
- package/src/utils/clientId.test.ts +41 -0
- package/src/utils/clientId.ts +43 -0
- package/src/utils/compression/compress.test.ts +1 -1
- package/src/utils/compression/compress.ts +2 -2
- package/src/utils/compression/decompress.test.ts +8 -4
- package/src/utils/compression/decompress.ts +2 -2
- package/src/utils/{computeProductId.ts → computeLegacyProductId.ts} +2 -2
- package/src/utils/constants.ts +5 -0
- package/src/utils/deepLinkWithFallback.test.ts +243 -0
- package/src/utils/deepLinkWithFallback.ts +103 -0
- package/src/utils/formatAmount.ts +6 -0
- package/src/utils/iframeHelper.test.ts +18 -5
- package/src/utils/iframeHelper.ts +10 -3
- package/src/utils/index.ts +16 -1
- package/src/utils/merchantId.test.ts +653 -0
- package/src/utils/merchantId.ts +143 -0
- package/src/utils/sso.ts +18 -11
- package/src/utils/trackEvent.test.ts +23 -5
- package/src/utils/trackEvent.ts +13 -0
- package/cdn/bundle.iife.js +0 -14
- package/dist/actions-B5j-i1p0.cjs +0 -1
- package/dist/actions-q090Z0oR.js +0 -1
- package/dist/index-7OZ39x1U.d.ts +0 -195
- package/dist/index-zDq-VlKx.d.cts +0 -195
- package/dist/interaction-DMJ3ZfaF.d.cts +0 -45
- package/dist/interaction-KX1h9a7V.d.ts +0 -45
- package/dist/interactions-DnfM3oe0.js +0 -1
- package/dist/interactions-EIXhNLf6.cjs +0 -1
- package/dist/interactions.cjs +0 -1
- package/dist/interactions.d.cts +0 -2
- package/dist/interactions.d.ts +0 -2
- package/dist/interactions.js +0 -1
- package/dist/productTypes-BUkXJKZ7.cjs +0 -1
- package/dist/productTypes-CGb1MmBF.js +0 -1
- package/dist/src-1LQ4eLq5.js +0 -13
- package/dist/src-hW71KjPN.cjs +0 -13
- package/dist/trackEvent-CHnYa85W.js +0 -1
- package/dist/trackEvent-GuQm_1Nm.cjs +0 -1
- package/src/actions/getProductInformation.ts +0 -14
- package/src/actions/openSso.test.ts +0 -407
- package/src/actions/sendInteraction.test.ts +0 -219
- package/src/constants/interactionTypes.test.ts +0 -128
- package/src/constants/productTypes.test.ts +0 -130
- package/src/constants/productTypes.ts +0 -33
- package/src/interactions/index.ts +0 -5
- package/src/interactions/pressEncoder.test.ts +0 -215
- package/src/interactions/pressEncoder.ts +0 -53
- package/src/interactions/purchaseEncoder.test.ts +0 -291
- package/src/interactions/purchaseEncoder.ts +0 -99
- package/src/interactions/referralEncoder.test.ts +0 -170
- package/src/interactions/referralEncoder.ts +0 -47
- package/src/interactions/retailEncoder.test.ts +0 -107
- package/src/interactions/retailEncoder.ts +0 -37
- package/src/interactions/webshopEncoder.test.ts +0 -56
- package/src/interactions/webshopEncoder.ts +0 -30
- package/src/types/rpc/modal/openSession.ts +0 -25
- package/src/types/rpc/productInformation.ts +0 -59
- package/src/utils/computeProductId.test.ts +0 -80
- package/src/utils/sso.test.ts +0 -361
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { r as SendInteractionReturnType, t as PreparedInteraction } from "./interaction-DMJ3ZfaF.cjs";
|
|
2
1
|
import { OpenPanel } from "@openpanel/web";
|
|
3
2
|
import { LifecycleMessage, RpcClient } from "@frak-labs/frame-connector";
|
|
4
3
|
import { Address, Hex } from "viem";
|
|
@@ -33,6 +32,12 @@ type FrakWalletSdkConfig = {
|
|
|
33
32
|
* Your application name (will be displayed in a few modals and in SSO)
|
|
34
33
|
*/
|
|
35
34
|
name: string;
|
|
35
|
+
/**
|
|
36
|
+
* Your merchant ID from the Frak dashboard (UUID format)
|
|
37
|
+
* Used for referral tracking and analytics
|
|
38
|
+
* If not provided, will be auto-fetched from the backend using your domain
|
|
39
|
+
*/
|
|
40
|
+
merchantId?: string;
|
|
36
41
|
/**
|
|
37
42
|
* Language to display in the modal
|
|
38
43
|
* If undefined, will default to the browser language
|
|
@@ -118,7 +123,7 @@ type LocalizedI18nConfig = `${string}.css` | {
|
|
|
118
123
|
* Event related to the iframe lifecycle
|
|
119
124
|
* @ignore
|
|
120
125
|
*/
|
|
121
|
-
type ClientLifecycleEvent = CustomCssEvent | CustomI18nEvent | RestoreBackupEvent | HearbeatEvent | HandshakeResponse | SsoRedirectCompleteEvent;
|
|
126
|
+
type ClientLifecycleEvent = CustomCssEvent | CustomI18nEvent | RestoreBackupEvent | HearbeatEvent | HandshakeResponse | SsoRedirectCompleteEvent | DeepLinkFailedEvent;
|
|
122
127
|
type CustomCssEvent = {
|
|
123
128
|
clientLifecycle: "modal-css";
|
|
124
129
|
data: {
|
|
@@ -146,6 +151,23 @@ type HandshakeResponse = {
|
|
|
146
151
|
data: {
|
|
147
152
|
token: string;
|
|
148
153
|
currentUrl: string;
|
|
154
|
+
/**
|
|
155
|
+
* Pending merge token extracted from URL (?fmt= parameter)
|
|
156
|
+
* When present, listener should execute identity merge in background
|
|
157
|
+
* URL is cleaned after handshake response is sent
|
|
158
|
+
*/
|
|
159
|
+
pendingMergeToken?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Client ID for identity tracking (belt & suspenders fallback)
|
|
162
|
+
* Primary delivery is via iframe URL query param; handshake is backup for SSR
|
|
163
|
+
*/
|
|
164
|
+
clientId?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Explicit domain from SDK config (FrakWalletSdkConfig.domain)
|
|
167
|
+
* When present, listener should prefer this over URL-derived domain
|
|
168
|
+
* for merchant resolution (handles proxied/tunneled environments)
|
|
169
|
+
*/
|
|
170
|
+
configDomain?: string;
|
|
149
171
|
};
|
|
150
172
|
};
|
|
151
173
|
type SsoRedirectCompleteEvent = {
|
|
@@ -154,6 +176,12 @@ type SsoRedirectCompleteEvent = {
|
|
|
154
176
|
compressed: string;
|
|
155
177
|
};
|
|
156
178
|
};
|
|
179
|
+
type DeepLinkFailedEvent = {
|
|
180
|
+
clientLifecycle: "deep-link-failed";
|
|
181
|
+
data: {
|
|
182
|
+
originalUrl: string;
|
|
183
|
+
};
|
|
184
|
+
};
|
|
157
185
|
//#endregion
|
|
158
186
|
//#region src/types/lifecycle/iframe.d.ts
|
|
159
187
|
/**
|
|
@@ -184,48 +212,27 @@ type RedirectRequestEvent = {
|
|
|
184
212
|
* If it contain a query param `u`, the client need will suffix the current url to the base url
|
|
185
213
|
*/
|
|
186
214
|
baseRedirectUrl: string;
|
|
215
|
+
/**
|
|
216
|
+
* Optional merge token for anonymous identity merging
|
|
217
|
+
* When provided, appended as ?fmt= query parameter to the final redirect URL
|
|
218
|
+
* Used when redirecting out of social browsers to preserve identity across contexts
|
|
219
|
+
*/
|
|
220
|
+
mergeToken?: string;
|
|
187
221
|
};
|
|
188
222
|
};
|
|
189
223
|
//#endregion
|
|
190
224
|
//#region src/constants/interactionTypes.d.ts
|
|
191
225
|
/**
|
|
192
|
-
* The
|
|
193
|
-
*
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
*
|
|
226
|
+
* The supported interaction type keys
|
|
227
|
+
*
|
|
228
|
+
* - `referral` - User arrived via a referral link
|
|
229
|
+
* - `create_referral_link` - User created/shared a referral link
|
|
230
|
+
* - `purchase` - User completed a purchase
|
|
231
|
+
* - `custom.${string}` - Custom interaction type defined per campaign
|
|
232
|
+
*
|
|
198
233
|
* @inline
|
|
199
234
|
*/
|
|
200
|
-
type
|
|
201
|
-
/**
|
|
202
|
-
* Each interactions types according to the product types
|
|
203
|
-
*/
|
|
204
|
-
declare const interactionTypes: {
|
|
205
|
-
readonly press: {
|
|
206
|
-
readonly openArticle: "0xc0a24ffb";
|
|
207
|
-
readonly readArticle: "0xd5bd0fbe";
|
|
208
|
-
};
|
|
209
|
-
readonly dapp: {
|
|
210
|
-
readonly proofVerifiableStorageUpdate: "0x2ab2aeef";
|
|
211
|
-
readonly callableVerifiableStorageUpdate: "0xa07da986";
|
|
212
|
-
};
|
|
213
|
-
readonly webshop: {
|
|
214
|
-
readonly open: "0xb311798f";
|
|
215
|
-
};
|
|
216
|
-
readonly referral: {
|
|
217
|
-
readonly referred: "0x010cc3b9";
|
|
218
|
-
readonly createLink: "0xb2c0f17c";
|
|
219
|
-
};
|
|
220
|
-
readonly purchase: {
|
|
221
|
-
readonly started: "0xd87e90c3";
|
|
222
|
-
readonly completed: "0x8403aeb4";
|
|
223
|
-
readonly unsafeCompleted: "0x4d5b14e0";
|
|
224
|
-
};
|
|
225
|
-
readonly retail: {
|
|
226
|
-
readonly customerMeeting: "0x74489004";
|
|
227
|
-
};
|
|
228
|
-
};
|
|
235
|
+
type InteractionTypeKey = "referral" | "create_referral_link" | "purchase" | `custom.${string}`;
|
|
229
236
|
//#endregion
|
|
230
237
|
//#region src/types/rpc/modal/generic.d.ts
|
|
231
238
|
/**
|
|
@@ -404,28 +411,12 @@ type LoginWithoutSso = {
|
|
|
404
411
|
*/
|
|
405
412
|
type LoginModalStepType = GenericModalStepType<"login", LoginWithSso | LoginWithoutSso, {
|
|
406
413
|
wallet: Address;
|
|
414
|
+
webauthnProof?: {
|
|
415
|
+
challenge: Hex;
|
|
416
|
+
authenticatorResponse: string;
|
|
417
|
+
};
|
|
407
418
|
}>;
|
|
408
419
|
//#endregion
|
|
409
|
-
//#region src/types/rpc/modal/openSession.d.ts
|
|
410
|
-
/**
|
|
411
|
-
* Return type of the open session modal step
|
|
412
|
-
* @inline
|
|
413
|
-
* @ignore
|
|
414
|
-
*/
|
|
415
|
-
type OpenInteractionSessionReturnType = {
|
|
416
|
-
startTimestamp: number;
|
|
417
|
-
endTimestamp: number;
|
|
418
|
-
};
|
|
419
|
-
/**
|
|
420
|
-
* The open interaction session step for a Modal
|
|
421
|
-
*
|
|
422
|
-
* **Input**: None
|
|
423
|
-
* **Output**: The interactions session period (start and end timestamp)
|
|
424
|
-
*
|
|
425
|
-
* @group Modal Display
|
|
426
|
-
*/
|
|
427
|
-
type OpenInteractionSessionModalStepType = GenericModalStepType<"openSession", object, OpenInteractionSessionReturnType>;
|
|
428
|
-
//#endregion
|
|
429
420
|
//#region src/types/rpc/modal/siweAuthenticate.d.ts
|
|
430
421
|
/**
|
|
431
422
|
* Parameters used send a SIWE rpc request
|
|
@@ -487,7 +478,7 @@ type SendTransactionModalStepType = GenericModalStepType<"sendTransaction", {
|
|
|
487
478
|
* Generic type of steps we will display in the modal to the end user
|
|
488
479
|
* @group Modal Display
|
|
489
480
|
*/
|
|
490
|
-
type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType |
|
|
481
|
+
type ModalStepTypes = LoginModalStepType | SiweAuthenticateModalStepType | SendTransactionModalStepType | FinalModalStepType;
|
|
491
482
|
/**
|
|
492
483
|
* Type for the result of a modal request
|
|
493
484
|
* Just the `returns` type of each `ModalStepTypes`
|
|
@@ -518,7 +509,7 @@ type ModalRpcMetadata = {
|
|
|
518
509
|
title?: string;
|
|
519
510
|
icon?: string;
|
|
520
511
|
};
|
|
521
|
-
targetInteraction?:
|
|
512
|
+
targetInteraction?: InteractionTypeKey;
|
|
522
513
|
/**
|
|
523
514
|
* Some i18n override for the displayed modal (i.e. update the displayed text only for this modal)
|
|
524
515
|
*/
|
|
@@ -658,7 +649,7 @@ type DisplayEmbeddedWalletParamsType = {
|
|
|
658
649
|
/**
|
|
659
650
|
* The target interaction behind this modal
|
|
660
651
|
*/
|
|
661
|
-
targetInteraction?:
|
|
652
|
+
targetInteraction?: InteractionTypeKey;
|
|
662
653
|
/**
|
|
663
654
|
* The position of the component
|
|
664
655
|
*/
|
|
@@ -678,29 +669,34 @@ type DisplayEmbeddedWalletResultType = {
|
|
|
678
669
|
wallet: Address;
|
|
679
670
|
};
|
|
680
671
|
//#endregion
|
|
681
|
-
//#region src/
|
|
682
|
-
/**
|
|
683
|
-
* The keys for each product types
|
|
684
|
-
* @inline
|
|
685
|
-
*/
|
|
686
|
-
type ProductTypesKey = keyof typeof productTypes;
|
|
672
|
+
//#region src/types/rpc/interaction.d.ts
|
|
687
673
|
/**
|
|
688
|
-
*
|
|
674
|
+
* Parameters for sending interactions via RPC
|
|
675
|
+
*
|
|
676
|
+
* Note: merchantId and clientId come from WalletRpcContext
|
|
677
|
+
* and are NOT included in the params - they are resolved by the listener
|
|
678
|
+
*
|
|
679
|
+
* @group RPC Schema
|
|
689
680
|
*/
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
681
|
+
type SendInteractionParamsType = {
|
|
682
|
+
type: "arrival";
|
|
683
|
+
referrerWallet?: Address;
|
|
684
|
+
landingUrl?: string;
|
|
685
|
+
utmSource?: string;
|
|
686
|
+
utmMedium?: string;
|
|
687
|
+
utmCampaign?: string;
|
|
688
|
+
utmTerm?: string;
|
|
689
|
+
utmContent?: string;
|
|
690
|
+
} | {
|
|
691
|
+
type: "sharing";
|
|
692
|
+
} | {
|
|
693
|
+
type: "custom";
|
|
694
|
+
customType: string;
|
|
695
|
+
data?: Record<string, unknown>;
|
|
696
|
+
idempotencyKey?: string;
|
|
697
697
|
};
|
|
698
|
-
/**
|
|
699
|
-
* Bitmask for each product types
|
|
700
|
-
*/
|
|
701
|
-
declare const productTypesMask: Record<ProductTypesKey, bigint>;
|
|
702
698
|
//#endregion
|
|
703
|
-
//#region src/types/rpc/
|
|
699
|
+
//#region src/types/rpc/merchantInformation.d.ts
|
|
704
700
|
/**
|
|
705
701
|
* The type for the amount of tokens
|
|
706
702
|
*/
|
|
@@ -711,48 +707,62 @@ type TokenAmountType = {
|
|
|
711
707
|
gbpAmount: number;
|
|
712
708
|
};
|
|
713
709
|
/**
|
|
714
|
-
*
|
|
710
|
+
* A tier definition for tiered rewards
|
|
711
|
+
*/
|
|
712
|
+
type RewardTier = {
|
|
713
|
+
minValue: number;
|
|
714
|
+
maxValue?: number;
|
|
715
|
+
amount: TokenAmountType;
|
|
716
|
+
};
|
|
717
|
+
/**
|
|
718
|
+
* Estimated reward amount — discriminated union by payout type
|
|
719
|
+
*
|
|
720
|
+
* - `fixed`: A known token amount (with fiat equivalents)
|
|
721
|
+
* - `percentage`: A percent of a purchase field (e.g. 5% of purchase_amount), with optional min/max caps
|
|
722
|
+
* - `tiered`: Amount depends on a field value matching tier brackets
|
|
723
|
+
*/
|
|
724
|
+
type EstimatedReward = {
|
|
725
|
+
payoutType: "fixed";
|
|
726
|
+
amount: TokenAmountType;
|
|
727
|
+
} | {
|
|
728
|
+
payoutType: "percentage";
|
|
729
|
+
percent: number;
|
|
730
|
+
percentOf: string;
|
|
731
|
+
maxAmount?: TokenAmountType;
|
|
732
|
+
minAmount?: TokenAmountType;
|
|
733
|
+
} | {
|
|
734
|
+
payoutType: "tiered";
|
|
735
|
+
tierField: string;
|
|
736
|
+
tiers: RewardTier[];
|
|
737
|
+
};
|
|
738
|
+
/**
|
|
739
|
+
* Response of the `frak_getMerchantInformation` RPC method
|
|
715
740
|
* @group RPC Schema
|
|
716
741
|
*/
|
|
717
|
-
type
|
|
742
|
+
type GetMerchantInformationReturnType = {
|
|
718
743
|
/**
|
|
719
|
-
* Current
|
|
744
|
+
* Current merchant id
|
|
720
745
|
*/
|
|
721
|
-
id:
|
|
746
|
+
id: string;
|
|
722
747
|
/**
|
|
723
748
|
* Some metadata
|
|
724
749
|
*/
|
|
725
750
|
onChainMetadata: {
|
|
726
751
|
/**
|
|
727
|
-
* Name of the
|
|
752
|
+
* Name of the merchant on-chain
|
|
728
753
|
*/
|
|
729
754
|
name: string;
|
|
730
755
|
/**
|
|
731
|
-
* Domain of the
|
|
756
|
+
* Domain of the merchant on-chain
|
|
732
757
|
*/
|
|
733
758
|
domain: string;
|
|
734
|
-
/**
|
|
735
|
-
* The supported product types
|
|
736
|
-
*/
|
|
737
|
-
productTypes: ProductTypesKey[];
|
|
738
759
|
};
|
|
739
|
-
/**
|
|
740
|
-
* The max potential reward for the referrer
|
|
741
|
-
*/
|
|
742
|
-
maxReferrer?: TokenAmountType;
|
|
743
|
-
/**
|
|
744
|
-
* The max potential reward for the referee
|
|
745
|
-
*/
|
|
746
|
-
maxReferee?: TokenAmountType;
|
|
747
|
-
/**
|
|
748
|
-
* List of all the potentials reward arround this product
|
|
749
|
-
*/
|
|
750
760
|
rewards: {
|
|
751
|
-
token
|
|
752
|
-
|
|
753
|
-
interactionTypeKey:
|
|
754
|
-
referrer
|
|
755
|
-
referee
|
|
761
|
+
token?: Address;
|
|
762
|
+
campaignId: string;
|
|
763
|
+
interactionTypeKey: InteractionTypeKey;
|
|
764
|
+
referrer?: EstimatedReward;
|
|
765
|
+
referee?: EstimatedReward;
|
|
756
766
|
}[];
|
|
757
767
|
};
|
|
758
768
|
//#endregion
|
|
@@ -770,10 +780,6 @@ type WalletConnected = {
|
|
|
770
780
|
key: "connected";
|
|
771
781
|
wallet: Address;
|
|
772
782
|
interactionToken?: string;
|
|
773
|
-
interactionSession?: {
|
|
774
|
-
startTimestamp: number;
|
|
775
|
-
endTimestamp: number;
|
|
776
|
-
};
|
|
777
783
|
};
|
|
778
784
|
/**
|
|
779
785
|
* @ignore
|
|
@@ -783,7 +789,6 @@ type WalletNotConnected = {
|
|
|
783
789
|
key: "not-connected";
|
|
784
790
|
wallet?: never;
|
|
785
791
|
interactionToken?: never;
|
|
786
|
-
interactionSession?: never;
|
|
787
792
|
};
|
|
788
793
|
//#endregion
|
|
789
794
|
//#region src/types/rpc.d.ts
|
|
@@ -811,19 +816,14 @@ type WalletNotConnected = {
|
|
|
811
816
|
* - Returns: {@link ModalRpcStepsResultType}
|
|
812
817
|
* - Response Type: promise (one-shot)
|
|
813
818
|
*
|
|
814
|
-
* #### frak_sendInteraction
|
|
815
|
-
* - Params: [productId: Hex, interaction: {@link PreparedInteraction}, signature?: Hex]
|
|
816
|
-
* - Returns: {@link SendInteractionReturnType}
|
|
817
|
-
* - Response Type: promise (one-shot)
|
|
818
|
-
*
|
|
819
819
|
* #### frak_sso
|
|
820
820
|
* - Params: [params: {@link OpenSsoParamsType}, name: string, customCss?: string]
|
|
821
821
|
* - Returns: {@link OpenSsoReturnType}
|
|
822
822
|
* - Response Type: promise (one-shot)
|
|
823
823
|
*
|
|
824
|
-
* ####
|
|
824
|
+
* #### frak_getMerchantInformation
|
|
825
825
|
* - Params: None
|
|
826
|
-
* - Returns: {@link
|
|
826
|
+
* - Returns: {@link GetMerchantInformationReturnType}
|
|
827
827
|
* - Response Type: promise (one-shot)
|
|
828
828
|
*
|
|
829
829
|
* #### frak_displayEmbeddedWallet
|
|
@@ -850,15 +850,6 @@ type IFrameRpcSchema = [
|
|
|
850
850
|
Parameters: [requests: ModalRpcStepsInput, metadata: ModalRpcMetadata | undefined, configMetadata: FrakWalletSdkConfig["metadata"]];
|
|
851
851
|
ReturnType: ModalRpcStepsResultType;
|
|
852
852
|
},
|
|
853
|
-
/**
|
|
854
|
-
* Method to transmit a user interaction
|
|
855
|
-
* This is a one-shot request
|
|
856
|
-
*/
|
|
857
|
-
{
|
|
858
|
-
Method: "frak_sendInteraction";
|
|
859
|
-
Parameters: [productId: Hex, interaction: PreparedInteraction, signature?: Hex];
|
|
860
|
-
ReturnType: SendInteractionReturnType;
|
|
861
|
-
},
|
|
862
853
|
/**
|
|
863
854
|
* Method to prepare SSO (generate URL for popup)
|
|
864
855
|
* Returns the SSO URL that should be opened in a popup
|
|
@@ -881,16 +872,16 @@ type IFrameRpcSchema = [
|
|
|
881
872
|
ReturnType: OpenSsoReturnType;
|
|
882
873
|
},
|
|
883
874
|
/**
|
|
884
|
-
* Method to get current
|
|
885
|
-
* - Is
|
|
875
|
+
* Method to get current merchant information
|
|
876
|
+
* - Is merchant registered?
|
|
886
877
|
* - Does it have running campaign?
|
|
887
878
|
* - Estimated reward on actions
|
|
888
879
|
* This is a one-shot request
|
|
889
880
|
*/
|
|
890
881
|
{
|
|
891
|
-
Method: "
|
|
882
|
+
Method: "frak_getMerchantInformation";
|
|
892
883
|
Parameters?: undefined;
|
|
893
|
-
ReturnType:
|
|
884
|
+
ReturnType: GetMerchantInformationReturnType;
|
|
894
885
|
},
|
|
895
886
|
/**
|
|
896
887
|
* Method to show the embedded wallet, with potential customization
|
|
@@ -900,6 +891,19 @@ type IFrameRpcSchema = [
|
|
|
900
891
|
Method: "frak_displayEmbeddedWallet";
|
|
901
892
|
Parameters: [request: DisplayEmbeddedWalletParamsType, metadata: FrakWalletSdkConfig["metadata"]];
|
|
902
893
|
ReturnType: DisplayEmbeddedWalletResultType;
|
|
894
|
+
},
|
|
895
|
+
/**
|
|
896
|
+
* Method to send interactions (arrival, sharing, custom events)
|
|
897
|
+
* Fire-and-forget method - no return value expected
|
|
898
|
+
* merchantId is resolved from context
|
|
899
|
+
* clientId is passed via metadata as safeguard against handshake race condition
|
|
900
|
+
*/
|
|
901
|
+
{
|
|
902
|
+
Method: "frak_sendInteraction";
|
|
903
|
+
Parameters: [interaction: SendInteractionParamsType, metadata?: {
|
|
904
|
+
clientId?: string;
|
|
905
|
+
}];
|
|
906
|
+
ReturnType: undefined;
|
|
903
907
|
}];
|
|
904
908
|
//#endregion
|
|
905
909
|
//#region src/types/transport.d.ts
|
|
@@ -1015,4 +1019,4 @@ declare const ssoPopupName = "frak-sso";
|
|
|
1015
1019
|
*/
|
|
1016
1020
|
declare function openSso(client: FrakClient, args: OpenSsoParamsType): Promise<OpenSsoReturnType>;
|
|
1017
1021
|
//#endregion
|
|
1018
|
-
export { SiweAuthenticateReturnType as A,
|
|
1022
|
+
export { SiweAuthenticateReturnType as A, ModalStepMetadata as B, ModalRpcStepsInput as C, SendTransactionReturnType as D, SendTransactionModalStepType as E, PrepareSsoParamsType as F, FrakWalletSdkConfig as G, IFrameLifecycleEvent as H, PrepareSsoReturnType as I, LocalizedI18nConfig as J, I18nConfig as K, SsoMetadata as L, LoginModalStepType as M, OpenSsoParamsType as N, SendTransactionTxType as O, OpenSsoReturnType as P, FinalActionType as R, ModalRpcMetadata as S, ModalStepTypes as T, ClientLifecycleEvent as U, InteractionTypeKey as V, Currency as W, LoggedOutEmbeddedView as _, FrakClient as a, LoggedInEmbeddedView as b, IFrameRpcSchema as c, GetMerchantInformationReturnType as d, RewardTier as f, DisplayEmbeddedWalletResultType as g, DisplayEmbeddedWalletParamsType as h, FrakContext as i, SiweAuthenticationParams as j, SiweAuthenticateModalStepType as k, WalletStatusReturnType as l, SendInteractionParamsType as m, ssoPopupFeatures as n, FrakLifecycleEvent as o, TokenAmountType as p, Language as q, ssoPopupName as r, IFrameTransport as s, openSso as t, EstimatedReward as u, EmbeddedViewActionReferred as v, ModalRpcStepsResultType as w, DisplayModalParamsType as x, EmbeddedViewActionSharing as y, FinalModalStepType as z };
|