@cirkay-eng/cirkay-components 0.7.1
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 +87 -0
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/index.js +8 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/base/magic/MagicAPI.d.ts +7 -0
- package/dist/base/magic/MagicAPI.d.ts.map +1 -0
- package/dist/base/magic/MagicAPI.js +20 -0
- package/dist/base/magic/MagicAPI.js.map +1 -0
- package/dist/base/n3xus/N3xusAPI.d.ts +12 -0
- package/dist/base/n3xus/N3xusAPI.d.ts.map +1 -0
- package/dist/base/n3xus/N3xusAPI.js +121 -0
- package/dist/base/n3xus/N3xusAPI.js.map +1 -0
- package/dist/base/n3xus/types.d.ts +68 -0
- package/dist/base/n3xus/types.d.ts.map +1 -0
- package/dist/base/n3xus/types.js +10 -0
- package/dist/base/n3xus/types.js.map +1 -0
- package/dist/components/error-screen/error-screen.d.ts +14 -0
- package/dist/components/error-screen/error-screen.d.ts.map +1 -0
- package/dist/components/error-screen/error-screen.js +65 -0
- package/dist/components/error-screen/error-screen.js.map +1 -0
- package/dist/components/error-screen/index.d.ts +3 -0
- package/dist/components/error-screen/index.d.ts.map +1 -0
- package/dist/components/fan-pass-claim/fan-pass-claim.d.ts +63 -0
- package/dist/components/fan-pass-claim/fan-pass-claim.d.ts.map +1 -0
- package/dist/components/fan-pass-claim/fan-pass-claim.js +837 -0
- package/dist/components/fan-pass-claim/fan-pass-claim.js.map +1 -0
- package/dist/components/fan-pass-claim/index.d.ts +3 -0
- package/dist/components/fan-pass-claim/index.d.ts.map +1 -0
- package/dist/components/fan-pass-claim/types.d.ts +20 -0
- package/dist/components/fan-pass-claim/types.d.ts.map +1 -0
- package/dist/components/fan-pass-claim/types.js +24 -0
- package/dist/components/fan-pass-claim/types.js.map +1 -0
- package/dist/components/fan-pass-unlock/fan-pass-unlock.d.ts +52 -0
- package/dist/components/fan-pass-unlock/fan-pass-unlock.d.ts.map +1 -0
- package/dist/components/fan-pass-unlock/fan-pass-unlock.js +498 -0
- package/dist/components/fan-pass-unlock/fan-pass-unlock.js.map +1 -0
- package/dist/components/fan-pass-unlock/index.d.ts +3 -0
- package/dist/components/fan-pass-unlock/index.d.ts.map +1 -0
- package/dist/components/fan-pass-unlock/types.d.ts +12 -0
- package/dist/components/fan-pass-unlock/types.d.ts.map +1 -0
- package/dist/components/fan-pass-unlock/types.js +16 -0
- package/dist/components/fan-pass-unlock/types.js.map +1 -0
- package/dist/components/frame/frame.d.ts +21 -0
- package/dist/components/frame/frame.d.ts.map +1 -0
- package/dist/components/frame/frame.js +190 -0
- package/dist/components/frame/frame.js.map +1 -0
- package/dist/components/frame/index.d.ts +3 -0
- package/dist/components/frame/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/login/index.d.ts +3 -0
- package/dist/components/login/index.d.ts.map +1 -0
- package/dist/components/login/login.d.ts +72 -0
- package/dist/components/login/login.d.ts.map +1 -0
- package/dist/components/login/login.js +924 -0
- package/dist/components/login/login.js.map +1 -0
- package/dist/components/login/types.d.ts +22 -0
- package/dist/components/login/types.d.ts.map +1 -0
- package/dist/components/login/types.js +15 -0
- package/dist/components/login/types.js.map +1 -0
- package/dist/constants/apis.d.ts +12 -0
- package/dist/constants/apis.d.ts.map +1 -0
- package/dist/constants/apis.js +17 -0
- package/dist/constants/apis.js.map +1 -0
- package/dist/constants/components.d.ts +3 -0
- package/dist/constants/components.d.ts.map +1 -0
- package/dist/constants/components.js +4 -0
- package/dist/constants/components.js.map +1 -0
- package/dist/constants/magic.d.ts +15 -0
- package/dist/constants/magic.d.ts.map +1 -0
- package/dist/controllers/LoginController.d.ts +35 -0
- package/dist/controllers/LoginController.d.ts.map +1 -0
- package/dist/controllers/LoginController.js +218 -0
- package/dist/controllers/LoginController.js.map +1 -0
- package/dist/controllers/types.d.ts +9 -0
- package/dist/controllers/types.d.ts.map +1 -0
- package/dist/docs/error-screen/designTokens.d.ts +5 -0
- package/dist/docs/error-screen/designTokens.d.ts.map +1 -0
- package/dist/docs/error-screen/error-screen.stories.d.ts +6 -0
- package/dist/docs/error-screen/error-screen.stories.d.ts.map +1 -0
- package/dist/docs/fan-pass-claim/designTokens.d.ts +3 -0
- package/dist/docs/fan-pass-claim/designTokens.d.ts.map +1 -0
- package/dist/docs/fan-pass-claim/fan-pass-claim.stories.d.ts +6 -0
- package/dist/docs/fan-pass-claim/fan-pass-claim.stories.d.ts.map +1 -0
- package/dist/docs/fan-pass-unlock/designTokens.d.ts +3 -0
- package/dist/docs/fan-pass-unlock/designTokens.d.ts.map +1 -0
- package/dist/docs/fan-pass-unlock/fan-pass-unlock.stories.d.ts +6 -0
- package/dist/docs/fan-pass-unlock/fan-pass-unlock.stories.d.ts.map +1 -0
- package/dist/docs/login/designTokens.d.ts +5 -0
- package/dist/docs/login/designTokens.d.ts.map +1 -0
- package/dist/docs/login/login.stories.d.ts +7 -0
- package/dist/docs/login/login.stories.d.ts.map +1 -0
- package/dist/events/claim.d.ts +17 -0
- package/dist/events/claim.d.ts.map +1 -0
- package/dist/events/claim.js +8 -0
- package/dist/events/claim.js.map +1 -0
- package/dist/events/event.d.ts +15 -0
- package/dist/events/event.d.ts.map +1 -0
- package/dist/events/login.d.ts +31 -0
- package/dist/events/login.d.ts.map +1 -0
- package/dist/events/login.js +10 -0
- package/dist/events/login.js.map +1 -0
- package/dist/events/unlock.d.ts +17 -0
- package/dist/events/unlock.d.ts.map +1 -0
- package/dist/events/unlock.js +8 -0
- package/dist/events/unlock.js.map +1 -0
- package/dist/internal/CirkayElement.d.ts +10 -0
- package/dist/internal/CirkayElement.d.ts.map +1 -0
- package/dist/internal/CirkayElement.js +40 -0
- package/dist/internal/CirkayElement.js.map +1 -0
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.29.1_tslib@2.8.1_typescript@5.7.2/node_modules/tslib/tslib.es6.js +31 -0
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.29.1_tslib@2.8.1_typescript@5.7.2/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/node_modules/.pnpm/axios-rate-limit@1.4.0_axios@1.7.9/node_modules/axios-rate-limit/src/index.js +182 -0
- package/dist/node_modules/.pnpm/axios-rate-limit@1.4.0_axios@1.7.9/node_modules/axios-rate-limit/src/index.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/adapters.js +82 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/adapters.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/fetch.js +230 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/fetch.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/xhr.js +200 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/xhr.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/axios.js +87 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/axios.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/CancelToken.js +134 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/CancelToken.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/CanceledError.js +24 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/CanceledError.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/isCancel.js +6 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/isCancel.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/Axios.js +232 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/Axios.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/AxiosError.js +102 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/AxiosError.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/AxiosHeaders.js +301 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/AxiosHeaders.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/InterceptorManager.js +70 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/InterceptorManager.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/buildFullPath.js +22 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/buildFullPath.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/dispatchRequest.js +82 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/dispatchRequest.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/mergeConfig.js +107 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/mergeConfig.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/settle.js +28 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/settle.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/transformData.js +29 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/transformData.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/defaults/index.js +160 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/defaults/index.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/defaults/transitional.js +8 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/defaults/transitional.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/env/data.js +4 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/env/data.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +57 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/AxiosURLSearchParams.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/HttpStatusCode.js +72 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/HttpStatusCode.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/bind.js +8 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/bind.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/buildURL.js +70 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/buildURL.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/combineURLs.js +16 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/combineURLs.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/composeSignals.js +49 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/composeSignals.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/cookies.js +44 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/cookies.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/formDataToJSON.js +94 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/formDataToJSON.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isAbsoluteURL.js +16 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isAxiosError.js +15 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isAxiosError.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isURLSameOrigin.js +17 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/null.js +5 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/null.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/parseHeaders.js +56 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/parseHeaders.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/parseProtocol.js +7 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/parseProtocol.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/progressEventReducer.js +47 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/progressEventReducer.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/resolveConfig.js +59 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/resolveConfig.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/speedometer.js +54 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/speedometer.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/spread.js +29 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/spread.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/throttle.js +45 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/throttle.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/toFormData.js +216 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/toFormData.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/toURLEncodedForm.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/trackStream.js +89 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/trackStream.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/validator.js +100 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/validator.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/Blob.js +4 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/Blob.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/FormData.js +4 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/FormData.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +6 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/index.js +16 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/index.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/common/utils.js +46 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/common/utils.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/index.js +10 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/index.js.map +1 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/utils.js +761 -0
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/utils.js.map +1 -0
- package/dist/theme/global.d.ts +2 -0
- package/dist/theme/global.d.ts.map +1 -0
- package/dist/theme/global.js +25 -0
- package/dist/theme/global.js.map +1 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/utils/helpers.d.ts +5 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/helpers.js +49 -0
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/settings.d.ts +5 -0
- package/dist/utils/settings.d.ts.map +1 -0
- package/dist/utils/settings.js +7 -0
- package/dist/utils/settings.js.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,837 @@
|
|
|
1
|
+
import { __decorate } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.29.1_tslib@2.8.1_typescript@5.7.2/node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { css, html } from 'lit';
|
|
3
|
+
import { property, customElement } from 'lit/decorators.js';
|
|
4
|
+
import { state } from 'lit/decorators/state.js';
|
|
5
|
+
import '@pushengineering/push-web-components/button';
|
|
6
|
+
import '@pushengineering/push-web-components/button-icon';
|
|
7
|
+
import '@pushengineering/push-web-components/text';
|
|
8
|
+
import '@pushengineering/push-web-components/vertical-stack';
|
|
9
|
+
import '@pushengineering/push-web-components/overlay';
|
|
10
|
+
import { setBasePath } from '@pushengineering/push-web-components';
|
|
11
|
+
import N3xusApi from '../../base/n3xus/N3xusAPI.js';
|
|
12
|
+
import { ClaimEvents } from '../../events/claim.js';
|
|
13
|
+
import CirkayElement from '../../internal/CirkayElement.js';
|
|
14
|
+
import { MintStatus } from '../../base/n3xus/types.js';
|
|
15
|
+
import '../login/login.js';
|
|
16
|
+
import '../frame/frame.js';
|
|
17
|
+
import '../error-screen/error-screen.js';
|
|
18
|
+
import { ClaimStateTypes, LoginState } from './types.js';
|
|
19
|
+
import { LoginController } from '../../controllers/LoginController.js';
|
|
20
|
+
import { getStoredSession, setStoredSession } from '../../utils/helpers.js';
|
|
21
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
22
|
+
|
|
23
|
+
let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
this.loginController = null;
|
|
27
|
+
this.nexusAPI = undefined;
|
|
28
|
+
this.apiKey = '';
|
|
29
|
+
this.logoSet = {
|
|
30
|
+
large: {
|
|
31
|
+
src: 'https://n3xus-store.s3.eu-west-2.amazonaws.com/staging/assets/cirkay-logo-transparent-no-padding.webp',
|
|
32
|
+
},
|
|
33
|
+
medium: {
|
|
34
|
+
src: 'https://n3xus-store.s3.eu-west-2.amazonaws.com/staging/assets/cirkay-logo-transparent-no-padding.webp',
|
|
35
|
+
},
|
|
36
|
+
small: {
|
|
37
|
+
src: 'https://n3xus-store.s3.eu-west-2.amazonaws.com/staging/assets/cirkay-logo-transparent-no-padding.webp',
|
|
38
|
+
},
|
|
39
|
+
alt: 'Cirkay Logo',
|
|
40
|
+
};
|
|
41
|
+
this.fanPassTitle = 'Fan Pass';
|
|
42
|
+
this.redeemToken = '';
|
|
43
|
+
this.modal = false;
|
|
44
|
+
this.validateAfterModal = false;
|
|
45
|
+
this.staging = true;
|
|
46
|
+
this.debugLogging = false;
|
|
47
|
+
this.successUrl = 'https://cirkay.com';
|
|
48
|
+
this.autoRedirect = false;
|
|
49
|
+
this.showRedeemInput = false;
|
|
50
|
+
this.success = false;
|
|
51
|
+
this.error = '';
|
|
52
|
+
this.btnBackgroundColor = '#D60455';
|
|
53
|
+
this.btnTextColor = '#FFFFFF';
|
|
54
|
+
this.faqUrl = 'https://cirkay.com/faq/';
|
|
55
|
+
this._claimState = ClaimStateTypes.validating;
|
|
56
|
+
this._pageNumber = 1;
|
|
57
|
+
this._user = undefined;
|
|
58
|
+
this._loginState = LoginState.initialising;
|
|
59
|
+
this._tokenStatus = null;
|
|
60
|
+
const baseUrl = window.location.origin;
|
|
61
|
+
setBasePath(`${baseUrl}/icons`);
|
|
62
|
+
}
|
|
63
|
+
connectedCallback() {
|
|
64
|
+
super.connectedCallback();
|
|
65
|
+
const magicApiOptions = {
|
|
66
|
+
staging: this.staging,
|
|
67
|
+
};
|
|
68
|
+
this.loginController = LoginController.getInstance(magicApiOptions, this.debugLogging);
|
|
69
|
+
this.loginController.addHost(this);
|
|
70
|
+
const n3xusOptions = {
|
|
71
|
+
apiKey: this.apiKey,
|
|
72
|
+
stagging: this.staging,
|
|
73
|
+
};
|
|
74
|
+
this.nexusAPI = new N3xusApi(n3xusOptions);
|
|
75
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
76
|
+
const urlRedeemToken = this.redeemToken.trim() === '' && !this.redeemToken
|
|
77
|
+
? urlParams.get('code')
|
|
78
|
+
: this.redeemToken;
|
|
79
|
+
if (!urlRedeemToken) {
|
|
80
|
+
this.error = 'No token provided';
|
|
81
|
+
this._claimState = ClaimStateTypes.error;
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (!this.modal || (this.modal && !this.validateAfterModal)) {
|
|
85
|
+
this.setTokenStatus(urlRedeemToken);
|
|
86
|
+
}
|
|
87
|
+
this._claimState = ClaimStateTypes.validating;
|
|
88
|
+
}
|
|
89
|
+
update(changedProperties) {
|
|
90
|
+
try {
|
|
91
|
+
super.update(changedProperties);
|
|
92
|
+
this.setUpdateState();
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
console.error('Error in update', error);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
setUpdateState() {
|
|
99
|
+
if (this.loginController?.loginInit &&
|
|
100
|
+
this._claimState === ClaimStateTypes.validating &&
|
|
101
|
+
!this.loginController?.loggedIn &&
|
|
102
|
+
this._tokenStatus?.data?.status === MintStatus.redeemed) {
|
|
103
|
+
this._claimState = ClaimStateTypes.redeemedLoggedout;
|
|
104
|
+
}
|
|
105
|
+
else if (this.loginController?.loginInit &&
|
|
106
|
+
this._tokenStatus?.data?.status === MintStatus.redeemed &&
|
|
107
|
+
this._claimState === ClaimStateTypes.validating &&
|
|
108
|
+
this.loginController?.loggedIn &&
|
|
109
|
+
this.loginController?.user?.walletAddress ===
|
|
110
|
+
this._tokenStatus?.data?.wallet) {
|
|
111
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
112
|
+
this.setSessionToken();
|
|
113
|
+
}
|
|
114
|
+
else if (this.loginController?.loginInit &&
|
|
115
|
+
this._claimState === ClaimStateTypes.validating &&
|
|
116
|
+
this._tokenStatus?.data?.status === MintStatus.redeemed &&
|
|
117
|
+
this.loginController?.loggedIn &&
|
|
118
|
+
this.loginController?.user?.walletAddress !==
|
|
119
|
+
this._tokenStatus?.data?.wallet) {
|
|
120
|
+
this._claimState = ClaimStateTypes.redeemedLoggedInInvalid;
|
|
121
|
+
}
|
|
122
|
+
else if (this.loginController?.loginInit &&
|
|
123
|
+
this._claimState === ClaimStateTypes.validating &&
|
|
124
|
+
this._tokenStatus?.data?.status === MintStatus.available &&
|
|
125
|
+
this.loginController?.loggedIn) {
|
|
126
|
+
this._claimState = ClaimStateTypes.availableLoggedIn;
|
|
127
|
+
}
|
|
128
|
+
else if (this.loginController?.loginInit &&
|
|
129
|
+
this._claimState === ClaimStateTypes.validating &&
|
|
130
|
+
this._tokenStatus?.data?.status === MintStatus.available &&
|
|
131
|
+
!this.loginController?.loggedIn) {
|
|
132
|
+
this._claimState = ClaimStateTypes.available;
|
|
133
|
+
}
|
|
134
|
+
if (this._claimState === ClaimStateTypes.available &&
|
|
135
|
+
this.loginController?.loginInit &&
|
|
136
|
+
this.loginController?.loggedIn) {
|
|
137
|
+
this.handleClaim();
|
|
138
|
+
this.emit(ClaimEvents.Claiming, { bubbles: false, composed: true });
|
|
139
|
+
}
|
|
140
|
+
if (this.loginController?.loginInit &&
|
|
141
|
+
this._claimState === ClaimStateTypes.redeemedLoggedout &&
|
|
142
|
+
this.loginController?.loggedIn &&
|
|
143
|
+
this.loginController?.user?.walletAddress ===
|
|
144
|
+
this._tokenStatus?.data?.wallet) {
|
|
145
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
146
|
+
this.setSessionToken();
|
|
147
|
+
}
|
|
148
|
+
else if (this.loginController?.loginInit &&
|
|
149
|
+
this._claimState === ClaimStateTypes.redeemedLoggedout &&
|
|
150
|
+
this.loginController?.loggedIn &&
|
|
151
|
+
this.loginController?.user?.walletAddress !==
|
|
152
|
+
this._tokenStatus?.data?.wallet) {
|
|
153
|
+
this._claimState = ClaimStateTypes.redeemedLoggedInInvalid;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async setTokenStatus(token) {
|
|
157
|
+
if (!this.nexusAPI) {
|
|
158
|
+
throw new Error('Nexus API is not initialized');
|
|
159
|
+
}
|
|
160
|
+
const status = await this.nexusAPI.checkTokenStatus(token);
|
|
161
|
+
if (!status) {
|
|
162
|
+
this._tokenStatus = status;
|
|
163
|
+
this.logging('Token status updated', status);
|
|
164
|
+
}
|
|
165
|
+
this.logging('setTokenStatus', token);
|
|
166
|
+
this._tokenStatus = status;
|
|
167
|
+
this.logging('Token Status', status);
|
|
168
|
+
if (!status.ok) {
|
|
169
|
+
this._claimState = ClaimStateTypes.error;
|
|
170
|
+
return status;
|
|
171
|
+
}
|
|
172
|
+
switch (status.data?.status) {
|
|
173
|
+
case MintStatus.available:
|
|
174
|
+
this.redeemToken = token;
|
|
175
|
+
if (this.loginController?.loginInit &&
|
|
176
|
+
this.loginController?.loggedIn) {
|
|
177
|
+
this._claimState = ClaimStateTypes.availableLoggedIn;
|
|
178
|
+
}
|
|
179
|
+
else if (this.loginController?.loginInit &&
|
|
180
|
+
!this.loginController?.loggedIn) {
|
|
181
|
+
this._claimState = ClaimStateTypes.validating;
|
|
182
|
+
}
|
|
183
|
+
break;
|
|
184
|
+
case MintStatus.redeemed:
|
|
185
|
+
if (!this.loginController?.loginInit) {
|
|
186
|
+
this._claimState = ClaimStateTypes.validating;
|
|
187
|
+
}
|
|
188
|
+
else if (this.loginController?.loginInit &&
|
|
189
|
+
this.loginController?.loggedIn &&
|
|
190
|
+
this.loginController?.user?.walletAddress ===
|
|
191
|
+
status.data?.wallet) {
|
|
192
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
193
|
+
this.setSessionToken();
|
|
194
|
+
}
|
|
195
|
+
else if (this.loginController?.loginInit &&
|
|
196
|
+
this.loginController?.loggedIn &&
|
|
197
|
+
this.loginController?.user?.walletAddress !==
|
|
198
|
+
status.data?.wallet) {
|
|
199
|
+
this._claimState = ClaimStateTypes.redeemedLoggedInInvalid;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
this._claimState = ClaimStateTypes.redeemedLoggedInInvalid;
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
case MintStatus.minting:
|
|
206
|
+
this._claimState = ClaimStateTypes.minting;
|
|
207
|
+
break;
|
|
208
|
+
case MintStatus.error:
|
|
209
|
+
this._claimState = ClaimStateTypes.mintingError;
|
|
210
|
+
break;
|
|
211
|
+
default:
|
|
212
|
+
this.error = 'This code is invalid';
|
|
213
|
+
this._claimState = ClaimStateTypes.invalid;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
return status;
|
|
217
|
+
}
|
|
218
|
+
validateMint(interval, maxAttempts) {
|
|
219
|
+
let attempts = 0;
|
|
220
|
+
const checkInterval = setInterval(async () => {
|
|
221
|
+
attempts++;
|
|
222
|
+
const status = await this.setTokenStatus(this.redeemToken);
|
|
223
|
+
if (status.ok === true &&
|
|
224
|
+
status.data?.status === MintStatus.redeemed) {
|
|
225
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
226
|
+
this.setSessionToken();
|
|
227
|
+
clearInterval(checkInterval);
|
|
228
|
+
this.emit(ClaimEvents.Claimed, { bubbles: false });
|
|
229
|
+
this.success = true;
|
|
230
|
+
}
|
|
231
|
+
else if (attempts >= maxAttempts) {
|
|
232
|
+
this._claimState = ClaimStateTypes.mintingError;
|
|
233
|
+
clearInterval(checkInterval);
|
|
234
|
+
this.error = 'Claim failed. Please try again later.';
|
|
235
|
+
}
|
|
236
|
+
}, interval);
|
|
237
|
+
}
|
|
238
|
+
async handleClaim() {
|
|
239
|
+
let didToken = this.loginController?.user?.did?.token;
|
|
240
|
+
if (didToken === undefined) {
|
|
241
|
+
await this.loginController?.getDidToken();
|
|
242
|
+
didToken = this.loginController?.user?.did?.token;
|
|
243
|
+
console.log(didToken);
|
|
244
|
+
}
|
|
245
|
+
if (this.redeemToken === '') {
|
|
246
|
+
this.error = 'No redeemtoken provided';
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
try {
|
|
250
|
+
const response = await this.nexusAPI?.mint(didToken, this.redeemToken);
|
|
251
|
+
this._claimState = ClaimStateTypes.minting;
|
|
252
|
+
const estimate = response?.data?.estimate_seconds;
|
|
253
|
+
const interval = 10000;
|
|
254
|
+
let maxAttempts = 3;
|
|
255
|
+
if (estimate) {
|
|
256
|
+
maxAttempts = (estimate * 2) / (interval / 1000);
|
|
257
|
+
if (maxAttempts < 3) {
|
|
258
|
+
maxAttempts = 3;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
this.validateMint(interval, maxAttempts);
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
if (error.response.data.error === 'Issuance code not available') {
|
|
265
|
+
this.error = 'This code not available or already used!';
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
this.error =
|
|
269
|
+
'An error occurred while claiming the Fan Pass. Please try again later.';
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
async setSessionToken() {
|
|
275
|
+
if (this._claimState === ClaimStateTypes.redeemedLogin) {
|
|
276
|
+
const session = getStoredSession();
|
|
277
|
+
if (session) {
|
|
278
|
+
console.log(session);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (!this.nexusAPI) {
|
|
282
|
+
const n3xusOptions = {
|
|
283
|
+
apiKey: this.apiKey,
|
|
284
|
+
stagging: this.staging,
|
|
285
|
+
};
|
|
286
|
+
this.nexusAPI = new N3xusApi(n3xusOptions);
|
|
287
|
+
}
|
|
288
|
+
if (!this.loginController?.user) {
|
|
289
|
+
await this.loginController?.getUserInfo();
|
|
290
|
+
}
|
|
291
|
+
if (!this.loginController?.user?.did?.token) {
|
|
292
|
+
await this.loginController?.getDidToken();
|
|
293
|
+
}
|
|
294
|
+
if (!this.loginController?.user?.did?.token) {
|
|
295
|
+
console.error('No DID token found');
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
const checkResponse = await this.nexusAPI.checkWalletForNft(this.loginController?.user?.did?.token);
|
|
299
|
+
if (!checkResponse.ok) {
|
|
300
|
+
console.error('Check wallet for NFT failed');
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
if (checkResponse.data?.holds) {
|
|
304
|
+
setStoredSession(JSON.stringify({
|
|
305
|
+
token: checkResponse.data.sessionToken,
|
|
306
|
+
issueTS: Date.now(),
|
|
307
|
+
}));
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
async logout() {
|
|
312
|
+
await this.loginController?.logout();
|
|
313
|
+
this._claimState = ClaimStateTypes.available;
|
|
314
|
+
this._pageNumber = 1;
|
|
315
|
+
}
|
|
316
|
+
closeOverlay(e) {
|
|
317
|
+
const overlay = this.shadowRoot?.getElementById('fb-modal');
|
|
318
|
+
const triggerButton = e.target;
|
|
319
|
+
triggerButton?.setAttribute('aria-expanded', 'false');
|
|
320
|
+
overlay?.closeOverlay();
|
|
321
|
+
}
|
|
322
|
+
openOverlay(e) {
|
|
323
|
+
const overlay = this.shadowRoot?.getElementById('fb-modal');
|
|
324
|
+
const triggerButton = e.target;
|
|
325
|
+
triggerButton?.setAttribute('aria-expanded', 'true');
|
|
326
|
+
if (this._tokenStatus === null) {
|
|
327
|
+
this._claimState = ClaimStateTypes.validating;
|
|
328
|
+
this.setTokenStatus(this.redeemToken);
|
|
329
|
+
}
|
|
330
|
+
overlay?.openOverlay();
|
|
331
|
+
}
|
|
332
|
+
logging(message, ...optionalParams) {
|
|
333
|
+
if (this.debugLogging) {
|
|
334
|
+
console.log(message, optionalParams);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
buttonStyles() {
|
|
338
|
+
let styles = {};
|
|
339
|
+
styles = {
|
|
340
|
+
...styles,
|
|
341
|
+
'--pu-color-button-background': this.btnBackgroundColor,
|
|
342
|
+
'--pu-color-button-text': this.btnTextColor,
|
|
343
|
+
};
|
|
344
|
+
return styles;
|
|
345
|
+
}
|
|
346
|
+
renderClaimSuccess() {
|
|
347
|
+
return html `
|
|
348
|
+
<pu-vertical-stack spacing="24" mobileSpacing="24">
|
|
349
|
+
<!-- <slot name="claimSuccessContent"></slot> -->
|
|
350
|
+
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
351
|
+
You've claimed your ${this.fanPassTitle}!
|
|
352
|
+
</pu-text>
|
|
353
|
+
<pu-vertical-stack spacing="8" mobileSpacing="8">
|
|
354
|
+
<pu-button
|
|
355
|
+
class="button"
|
|
356
|
+
style="${styleMap(this.buttonStyles())}"
|
|
357
|
+
url=${this.successUrl}
|
|
358
|
+
size="large"
|
|
359
|
+
fullWidth
|
|
360
|
+
buttonstyle="solid"
|
|
361
|
+
>
|
|
362
|
+
<pu-text as="p" variant="bodyMd" withoutMargin>
|
|
363
|
+
Check out your perks!
|
|
364
|
+
</pu-text>
|
|
365
|
+
</pu-button>
|
|
366
|
+
<pu-button
|
|
367
|
+
class="button"
|
|
368
|
+
style="${styleMap(this.buttonStyles())}"
|
|
369
|
+
@click="${async () => {
|
|
370
|
+
if (await this.loginController?.logout()) {
|
|
371
|
+
this._claimState =
|
|
372
|
+
ClaimStateTypes.redeemedLoggedout;
|
|
373
|
+
}
|
|
374
|
+
}}"
|
|
375
|
+
size="large"
|
|
376
|
+
fullWidth
|
|
377
|
+
buttonstyle="solid"
|
|
378
|
+
>
|
|
379
|
+
<pu-text as="p" variant="bodyMd" withoutMargin>
|
|
380
|
+
Disconnect
|
|
381
|
+
</pu-text>
|
|
382
|
+
</pu-button>
|
|
383
|
+
</pu-vertical-stack>
|
|
384
|
+
</pu-vertical-stack>
|
|
385
|
+
`;
|
|
386
|
+
}
|
|
387
|
+
renderContent() {
|
|
388
|
+
switch (this._claimState) {
|
|
389
|
+
case ClaimStateTypes.redeemedLogin:
|
|
390
|
+
this._pageNumber = 4;
|
|
391
|
+
return this.renderClaimSuccess();
|
|
392
|
+
case ClaimStateTypes.redeemedLoggedout:
|
|
393
|
+
this._pageNumber = 1;
|
|
394
|
+
return html `
|
|
395
|
+
<pu-vertical-stack
|
|
396
|
+
spacing="24"
|
|
397
|
+
align="center"
|
|
398
|
+
mobileAlign="center"
|
|
399
|
+
>
|
|
400
|
+
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
401
|
+
Claim your ${this.fanPassTitle}
|
|
402
|
+
</pu-text>
|
|
403
|
+
<fp-login
|
|
404
|
+
id="login"
|
|
405
|
+
buttonLabel="Claim"
|
|
406
|
+
apiKey=${this.apiKey}
|
|
407
|
+
btnBackgroundColor=${this.btnBackgroundColor}
|
|
408
|
+
btnTextColor=${this.btnTextColor}
|
|
409
|
+
?hidden=${false}
|
|
410
|
+
?staging=${true}
|
|
411
|
+
?debugLogging=${this.debugLogging}
|
|
412
|
+
?showLoaderAfterLogin=${true}
|
|
413
|
+
></fp-login>
|
|
414
|
+
</pu-vertical-stack>
|
|
415
|
+
`;
|
|
416
|
+
case ClaimStateTypes.validating:
|
|
417
|
+
this._pageNumber = 1;
|
|
418
|
+
return html `
|
|
419
|
+
<pu-text as="p" variant="bodyLg"> Validating... </pu-text>
|
|
420
|
+
<svg
|
|
421
|
+
class="loading__spinner"
|
|
422
|
+
width="16"
|
|
423
|
+
height="16"
|
|
424
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
425
|
+
focusable="false"
|
|
426
|
+
role="presentation"
|
|
427
|
+
aria-hidden="true"
|
|
428
|
+
viewBox="0 0 512 512"
|
|
429
|
+
>
|
|
430
|
+
<path
|
|
431
|
+
d="M463.9 376c7.6 4.4 17.5 1.8 21.4-6.1c17.1-34.3 26.7-73 26.7-113.9C512 120 405.9 8.8 272 .5c-8.8-.5-16 6.7-16 15.5v0c0 8.8 7.2 15.9 16 16.6C388.2 40.8 480 137.7 480 256c0 35.1-8.1 68.3-22.5 97.9c-3.9 8-1.3 17.7 6.4 22.2v0z"
|
|
432
|
+
/>
|
|
433
|
+
</svg>
|
|
434
|
+
`;
|
|
435
|
+
case ClaimStateTypes.invalid:
|
|
436
|
+
this._pageNumber = 4;
|
|
437
|
+
return html `
|
|
438
|
+
<fp-error-screen
|
|
439
|
+
errorText=${this.error}
|
|
440
|
+
faqUrl=${this.faqUrl}
|
|
441
|
+
></fp-error-screen>
|
|
442
|
+
`;
|
|
443
|
+
case ClaimStateTypes.availableLoggedIn:
|
|
444
|
+
this._pageNumber = 1;
|
|
445
|
+
return html `
|
|
446
|
+
<pu-vertical-stack
|
|
447
|
+
class=""
|
|
448
|
+
spacing="24"
|
|
449
|
+
align="center"
|
|
450
|
+
mobileAlign="center"
|
|
451
|
+
>
|
|
452
|
+
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
453
|
+
Claim your ${this.fanPassTitle}
|
|
454
|
+
</pu-text>
|
|
455
|
+
<pu-text as="p" variant="bodyMd" withoutMargin>
|
|
456
|
+
Logged in as ${this.loginController?.user?.email}
|
|
457
|
+
</pu-text>
|
|
458
|
+
<pu-vertical-stack
|
|
459
|
+
class=""
|
|
460
|
+
spacing="8"
|
|
461
|
+
align="center"
|
|
462
|
+
mobileAlign="center"
|
|
463
|
+
>
|
|
464
|
+
<pu-button
|
|
465
|
+
class="button"
|
|
466
|
+
@click="${this.handleClaim}"
|
|
467
|
+
style="${styleMap(this.buttonStyles())}"
|
|
468
|
+
buttonStyle="solid"
|
|
469
|
+
size="large"
|
|
470
|
+
fullWidth
|
|
471
|
+
>
|
|
472
|
+
Claim to this account
|
|
473
|
+
</pu-button>
|
|
474
|
+
<pu-button
|
|
475
|
+
class="button"
|
|
476
|
+
@click="${this.logout}"
|
|
477
|
+
style="${styleMap(this.buttonStyles())}"
|
|
478
|
+
buttonStyle="solid"
|
|
479
|
+
size="large"
|
|
480
|
+
fullWidth
|
|
481
|
+
>
|
|
482
|
+
Change account
|
|
483
|
+
</pu-button>
|
|
484
|
+
</pu-vertical-stack>
|
|
485
|
+
</pu-vertical-stack>
|
|
486
|
+
`;
|
|
487
|
+
case ClaimStateTypes.available:
|
|
488
|
+
this._pageNumber = 1;
|
|
489
|
+
return html `
|
|
490
|
+
<pu-vertical-stack
|
|
491
|
+
class=""
|
|
492
|
+
spacing="24"
|
|
493
|
+
align="center"
|
|
494
|
+
mobileAlign="center"
|
|
495
|
+
>
|
|
496
|
+
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
497
|
+
Claim your ${this.fanPassTitle}
|
|
498
|
+
</pu-text>
|
|
499
|
+
<fp-login
|
|
500
|
+
id="login"
|
|
501
|
+
buttonLabel="Claim"
|
|
502
|
+
apiKey=${this.apiKey}
|
|
503
|
+
btnBackgroundColor=${this.btnBackgroundColor}
|
|
504
|
+
btnTextColor=${this.btnTextColor}
|
|
505
|
+
?hidden=${false}
|
|
506
|
+
?staging=${true}
|
|
507
|
+
?debugLogging=${false}
|
|
508
|
+
?showLoaderAfterLogin=${true}
|
|
509
|
+
></fp-login>
|
|
510
|
+
</pu-vertical-stack>
|
|
511
|
+
`;
|
|
512
|
+
case ClaimStateTypes.minting:
|
|
513
|
+
this._pageNumber = 3;
|
|
514
|
+
return html `
|
|
515
|
+
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
516
|
+
Minting...
|
|
517
|
+
</pu-text>
|
|
518
|
+
<svg
|
|
519
|
+
class="loading__spinner"
|
|
520
|
+
width="16"
|
|
521
|
+
height="16"
|
|
522
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
523
|
+
focusable="false"
|
|
524
|
+
role="presentation"
|
|
525
|
+
aria-hidden="true"
|
|
526
|
+
viewBox="0 0 512 512"
|
|
527
|
+
>
|
|
528
|
+
<path
|
|
529
|
+
d="M463.9 376c7.6 4.4 17.5 1.8 21.4-6.1c17.1-34.3 26.7-73 26.7-113.9C512 120 405.9 8.8 272 .5c-8.8-.5-16 6.7-16 15.5v0c0 8.8 7.2 15.9 16 16.6C388.2 40.8 480 137.7 480 256c0 35.1-8.1 68.3-22.5 97.9c-3.9 8-1.3 17.7 6.4 22.2v0z"
|
|
530
|
+
/>
|
|
531
|
+
</svg>
|
|
532
|
+
`;
|
|
533
|
+
case ClaimStateTypes.redeemedLoggedInInvalid:
|
|
534
|
+
this._pageNumber = 4;
|
|
535
|
+
return html `
|
|
536
|
+
<fp-error-screen
|
|
537
|
+
errorText="This Token has already been used"
|
|
538
|
+
>
|
|
539
|
+
<pu-button
|
|
540
|
+
slot="button"
|
|
541
|
+
style="${styleMap(this.buttonStyles())}"
|
|
542
|
+
@click="${this.logout}"
|
|
543
|
+
type="button"
|
|
544
|
+
class="button"
|
|
545
|
+
name="disconnect"
|
|
546
|
+
size="large"
|
|
547
|
+
buttonstyle="solid"
|
|
548
|
+
>
|
|
549
|
+
<pu-text
|
|
550
|
+
as="span"
|
|
551
|
+
variant="bodyMd"
|
|
552
|
+
fontWeight="regular"
|
|
553
|
+
withoutMargin
|
|
554
|
+
spacing="loose"
|
|
555
|
+
>
|
|
556
|
+
Start over
|
|
557
|
+
</pu-text>
|
|
558
|
+
</pu-button>
|
|
559
|
+
</fp-error-screen>
|
|
560
|
+
`;
|
|
561
|
+
case ClaimStateTypes.redeemed:
|
|
562
|
+
if (this._loginState === LoginState.initialising) {
|
|
563
|
+
this._pageNumber = 3;
|
|
564
|
+
return html `
|
|
565
|
+
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
566
|
+
Loading...
|
|
567
|
+
</pu-text>
|
|
568
|
+
<svg
|
|
569
|
+
class="loading__spinner"
|
|
570
|
+
width="16"
|
|
571
|
+
height="16"
|
|
572
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
573
|
+
focusable="false"
|
|
574
|
+
role="presentation"
|
|
575
|
+
aria-hidden="true"
|
|
576
|
+
viewBox="0 0 512 512"
|
|
577
|
+
>
|
|
578
|
+
<path
|
|
579
|
+
d="M463.9 376c7.6 4.4 17.5 1.8 21.4-6.1c17.1-34.3 26.7-73 26.7-113.9C512 120 405.9 8.8 272 .5c-8.8-.5-16 6.7-16 15.5v0c0 8.8 7.2 15.9 16 16.6C388.2 40.8 480 137.7 480 256c0 35.1-8.1 68.3-22.5 97.9c-3.9 8-1.3 17.7 6.4 22.2v0z"
|
|
580
|
+
/>
|
|
581
|
+
</svg>
|
|
582
|
+
`;
|
|
583
|
+
}
|
|
584
|
+
if (this._loginState === LoginState.loggedOut) {
|
|
585
|
+
this._pageNumber = 1;
|
|
586
|
+
return html `
|
|
587
|
+
<fp-login
|
|
588
|
+
id="login"
|
|
589
|
+
buttonLabel="Claim"
|
|
590
|
+
apiKey=${this.apiKey}
|
|
591
|
+
btnBackgroundColor=${this.btnBackgroundColor}
|
|
592
|
+
btnTextColor=${this.btnTextColor}
|
|
593
|
+
?hidden=${false}
|
|
594
|
+
?staging=${true}
|
|
595
|
+
?debugLogging=${false}
|
|
596
|
+
?showLoaderAfterLogin=${false}
|
|
597
|
+
></fp-login>
|
|
598
|
+
`;
|
|
599
|
+
}
|
|
600
|
+
if (this._tokenStatus?.data?.wallet == this._user?.walletAddress) {
|
|
601
|
+
this._pageNumber = 4;
|
|
602
|
+
return html `
|
|
603
|
+
<pu-vertical-stack spacing="24">
|
|
604
|
+
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
605
|
+
You've claimed your ${this.fanPassTitle}!
|
|
606
|
+
</pu-text>
|
|
607
|
+
<pu-button class="button" url=${this.successUrl}>
|
|
608
|
+
Check out your perks!
|
|
609
|
+
</pu-button>
|
|
610
|
+
</pu-vertical-stack>
|
|
611
|
+
`;
|
|
612
|
+
}
|
|
613
|
+
this._pageNumber = 1;
|
|
614
|
+
return html `
|
|
615
|
+
<fp-error-screen
|
|
616
|
+
errorText="Invalid ${this.fanPassTitle}"
|
|
617
|
+
faqUrl=${this.faqUrl}
|
|
618
|
+
></fp-error-screen>
|
|
619
|
+
`;
|
|
620
|
+
case ClaimStateTypes.mintingError:
|
|
621
|
+
this._pageNumber = 3;
|
|
622
|
+
return html `
|
|
623
|
+
<fp-error-screen
|
|
624
|
+
errorText=${this.error}
|
|
625
|
+
faqUrl=${this.faqUrl}
|
|
626
|
+
></fp-error-screen>
|
|
627
|
+
`;
|
|
628
|
+
case ClaimStateTypes.error:
|
|
629
|
+
default:
|
|
630
|
+
this._pageNumber = 4;
|
|
631
|
+
return html `
|
|
632
|
+
<fp-error-screen
|
|
633
|
+
errorText="Claiming error"
|
|
634
|
+
faqUrl=${this.faqUrl}
|
|
635
|
+
>
|
|
636
|
+
<pu-button
|
|
637
|
+
slot="button"
|
|
638
|
+
style="${styleMap(this.buttonStyles())}"
|
|
639
|
+
@click="${this.logout}"
|
|
640
|
+
type="button"
|
|
641
|
+
class="button"
|
|
642
|
+
name="disconnect"
|
|
643
|
+
size="large"
|
|
644
|
+
buttonstyle="solid"
|
|
645
|
+
>
|
|
646
|
+
<pu-text
|
|
647
|
+
as="span"
|
|
648
|
+
variant="bodyMd"
|
|
649
|
+
fontWeight="regular"
|
|
650
|
+
withoutMargin
|
|
651
|
+
spacing="loose"
|
|
652
|
+
>
|
|
653
|
+
Start over
|
|
654
|
+
</pu-text>
|
|
655
|
+
</pu-button>
|
|
656
|
+
</fp-error-screen>
|
|
657
|
+
`;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
renderFrame(innerContent) {
|
|
661
|
+
return html ` <fp-frame
|
|
662
|
+
fanPassTitle=${this.fanPassTitle}
|
|
663
|
+
maxPages=${4}
|
|
664
|
+
currentPageNumber=${this._pageNumber}
|
|
665
|
+
.logoSet=${this.logoSet}
|
|
666
|
+
>
|
|
667
|
+
${innerContent}
|
|
668
|
+
</fp-frame>`;
|
|
669
|
+
}
|
|
670
|
+
render() {
|
|
671
|
+
this.logging('render', 'claimState', this._claimState);
|
|
672
|
+
if (this.modal) {
|
|
673
|
+
return html `
|
|
674
|
+
<pu-button
|
|
675
|
+
class="button"
|
|
676
|
+
style="${styleMap(this.buttonStyles())}"
|
|
677
|
+
@click=${this.openOverlay}
|
|
678
|
+
type="button"
|
|
679
|
+
name="claim"
|
|
680
|
+
size="large"
|
|
681
|
+
buttonstyle="solid"
|
|
682
|
+
>
|
|
683
|
+
<pu-text
|
|
684
|
+
as="span"
|
|
685
|
+
variant="bodyMd"
|
|
686
|
+
fontWeight="regular"
|
|
687
|
+
withoutMargin
|
|
688
|
+
spacing="loose"
|
|
689
|
+
>
|
|
690
|
+
Claim
|
|
691
|
+
</pu-text>
|
|
692
|
+
</pu-button>
|
|
693
|
+
<pu-overlay id="fb-modal">
|
|
694
|
+
<pu-box
|
|
695
|
+
slot="content"
|
|
696
|
+
class="modalContentBox"
|
|
697
|
+
padding=${100}
|
|
698
|
+
>
|
|
699
|
+
<pu-vertical-stack
|
|
700
|
+
spacing="40"
|
|
701
|
+
align="center"
|
|
702
|
+
mobileAlign="center"
|
|
703
|
+
justify="center"
|
|
704
|
+
mobileJustify="center"
|
|
705
|
+
class="flowContainer"
|
|
706
|
+
>
|
|
707
|
+
${this.renderFrame(html `${this.renderContent()}`)}
|
|
708
|
+
</pu-vertical-stack>
|
|
709
|
+
<pu-button-icon
|
|
710
|
+
icon="close"
|
|
711
|
+
as="button"
|
|
712
|
+
for="overlay"
|
|
713
|
+
aria-expanded=${true}
|
|
714
|
+
size="large"
|
|
715
|
+
@click=${this.closeOverlay}
|
|
716
|
+
style="position: absolute; top: 1rem; right: 1rem; z-index: 501"
|
|
717
|
+
>
|
|
718
|
+
</pu-button-icon>
|
|
719
|
+
</pu-box>
|
|
720
|
+
</pu-overlay>
|
|
721
|
+
`;
|
|
722
|
+
}
|
|
723
|
+
return this.renderFrame(html `${this.renderContent()}`);
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
FanPassClaim.styles = css `
|
|
727
|
+
/* Add your component styles here */
|
|
728
|
+
.modalContentBox {
|
|
729
|
+
background-color: #fff;
|
|
730
|
+
position: relative;
|
|
731
|
+
height: max-content;
|
|
732
|
+
/* max-height: 800px; */
|
|
733
|
+
|
|
734
|
+
@media only screen and (min-width: 48.06rem) {
|
|
735
|
+
--pu-border-base-corner-radius: var(
|
|
736
|
+
--pu-border-radius-20,
|
|
737
|
+
12px
|
|
738
|
+
);
|
|
739
|
+
border-radius: var(--pu-border-base-corner-radius);
|
|
740
|
+
box-shadow: 4px 4px 20px rgba(0, 0, 0, 0.25);
|
|
741
|
+
max-width: 800px;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
.button::part(button) {
|
|
746
|
+
--pu-border-button-corner-radius: var(--pu-border-radius-20, 12px);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
.loading__spinner {
|
|
750
|
+
animation-name: spin;
|
|
751
|
+
animation-duration: 500ms;
|
|
752
|
+
animation-timing-function: cubic-bezier(0, 0, 1, 1);
|
|
753
|
+
animation-iteration-count: infinite;
|
|
754
|
+
fill: currentcolor;
|
|
755
|
+
color: var(--pu-color-base-text, rgb(160, 160, 160));
|
|
756
|
+
height: 3rem;
|
|
757
|
+
width: 3rem;
|
|
758
|
+
left: 50%;
|
|
759
|
+
top: 50%;
|
|
760
|
+
margin: calc(var(--pu-space-16, 1rem) / 2 * -1) 0 0
|
|
761
|
+
calc(var(--pu-space-16, 1rem) / 2 * -1);
|
|
762
|
+
}
|
|
763
|
+
@keyframes spin {
|
|
764
|
+
to {
|
|
765
|
+
transform: rotate(1turn);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
`;
|
|
769
|
+
__decorate([
|
|
770
|
+
property({ type: String })
|
|
771
|
+
], FanPassClaim.prototype, "apiKey", void 0);
|
|
772
|
+
__decorate([
|
|
773
|
+
property({ type: Object })
|
|
774
|
+
], FanPassClaim.prototype, "logoSet", void 0);
|
|
775
|
+
__decorate([
|
|
776
|
+
property({ type: String })
|
|
777
|
+
], FanPassClaim.prototype, "fanPassTitle", void 0);
|
|
778
|
+
__decorate([
|
|
779
|
+
property({ type: String })
|
|
780
|
+
], FanPassClaim.prototype, "redeemToken", void 0);
|
|
781
|
+
__decorate([
|
|
782
|
+
property({ type: Boolean })
|
|
783
|
+
], FanPassClaim.prototype, "modal", void 0);
|
|
784
|
+
__decorate([
|
|
785
|
+
property({ type: Boolean })
|
|
786
|
+
], FanPassClaim.prototype, "validateAfterModal", void 0);
|
|
787
|
+
__decorate([
|
|
788
|
+
property({ type: Boolean })
|
|
789
|
+
], FanPassClaim.prototype, "staging", void 0);
|
|
790
|
+
__decorate([
|
|
791
|
+
property({ type: Boolean })
|
|
792
|
+
], FanPassClaim.prototype, "debugLogging", void 0);
|
|
793
|
+
__decorate([
|
|
794
|
+
property({ type: String })
|
|
795
|
+
], FanPassClaim.prototype, "successUrl", void 0);
|
|
796
|
+
__decorate([
|
|
797
|
+
property({ type: Boolean })
|
|
798
|
+
], FanPassClaim.prototype, "autoRedirect", void 0);
|
|
799
|
+
__decorate([
|
|
800
|
+
property({ type: Boolean })
|
|
801
|
+
], FanPassClaim.prototype, "showRedeemInput", void 0);
|
|
802
|
+
__decorate([
|
|
803
|
+
property({ type: Boolean })
|
|
804
|
+
], FanPassClaim.prototype, "success", void 0);
|
|
805
|
+
__decorate([
|
|
806
|
+
property({ type: String })
|
|
807
|
+
], FanPassClaim.prototype, "error", void 0);
|
|
808
|
+
__decorate([
|
|
809
|
+
property({ type: String })
|
|
810
|
+
], FanPassClaim.prototype, "btnBackgroundColor", void 0);
|
|
811
|
+
__decorate([
|
|
812
|
+
property({ type: String })
|
|
813
|
+
], FanPassClaim.prototype, "btnTextColor", void 0);
|
|
814
|
+
__decorate([
|
|
815
|
+
property({ type: String })
|
|
816
|
+
], FanPassClaim.prototype, "faqUrl", void 0);
|
|
817
|
+
__decorate([
|
|
818
|
+
state()
|
|
819
|
+
], FanPassClaim.prototype, "_claimState", void 0);
|
|
820
|
+
__decorate([
|
|
821
|
+
state()
|
|
822
|
+
], FanPassClaim.prototype, "_pageNumber", void 0);
|
|
823
|
+
__decorate([
|
|
824
|
+
state()
|
|
825
|
+
], FanPassClaim.prototype, "_user", void 0);
|
|
826
|
+
__decorate([
|
|
827
|
+
state()
|
|
828
|
+
], FanPassClaim.prototype, "_loginState", void 0);
|
|
829
|
+
__decorate([
|
|
830
|
+
state()
|
|
831
|
+
], FanPassClaim.prototype, "_tokenStatus", void 0);
|
|
832
|
+
FanPassClaim = __decorate([
|
|
833
|
+
customElement('fan-pass-claim')
|
|
834
|
+
], FanPassClaim);
|
|
835
|
+
|
|
836
|
+
export { FanPassClaim };
|
|
837
|
+
//# sourceMappingURL=fan-pass-claim.js.map
|