@cirkay-eng/cirkay-components 0.7.2 → 0.7.4
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/base/magic/MagicAPI.d.ts.map +1 -1
- package/dist/base/magic/MagicAPI.js +4 -3
- package/dist/base/magic/MagicAPI.js.map +1 -1
- package/dist/base/n3xus/N3xusAPI.d.ts +8 -5
- package/dist/base/n3xus/N3xusAPI.d.ts.map +1 -1
- package/dist/base/n3xus/N3xusAPI.js +110 -49
- package/dist/base/n3xus/N3xusAPI.js.map +1 -1
- package/dist/base/n3xus/types.d.ts +67 -24
- package/dist/base/n3xus/types.d.ts.map +1 -1
- package/dist/base/n3xus/types.js +1 -0
- package/dist/base/n3xus/types.js.map +1 -1
- package/dist/components/connected/connected.d.ts +33 -0
- package/dist/components/connected/connected.d.ts.map +1 -0
- package/dist/components/connected/connected.js +586 -0
- package/dist/components/connected/connected.js.map +1 -0
- package/dist/components/connected/index.d.ts +8 -0
- package/dist/components/connected/index.d.ts.map +1 -0
- package/dist/components/connected/index.js +6 -0
- package/dist/components/connected/index.js.map +1 -0
- package/dist/components/error-screen/error-screen.d.ts +4 -3
- package/dist/components/error-screen/error-screen.d.ts.map +1 -1
- package/dist/components/error-screen/error-screen.js +6 -11
- package/dist/components/error-screen/error-screen.js.map +1 -1
- package/dist/components/error-screen/index.d.ts +6 -1
- package/dist/components/error-screen/index.d.ts.map +1 -1
- package/dist/components/error-screen/index.js +6 -0
- package/dist/components/error-screen/index.js.map +1 -0
- package/dist/components/fan-pass-claim/fan-pass-claim.d.ts +32 -14
- package/dist/components/fan-pass-claim/fan-pass-claim.d.ts.map +1 -1
- package/dist/components/fan-pass-claim/fan-pass-claim.js +749 -322
- package/dist/components/fan-pass-claim/fan-pass-claim.js.map +1 -1
- package/dist/components/fan-pass-claim/index.d.ts +8 -2
- package/dist/components/fan-pass-claim/index.d.ts.map +1 -1
- package/dist/components/fan-pass-claim/index.js +6 -0
- package/dist/components/fan-pass-claim/index.js.map +1 -0
- package/dist/components/fan-pass-claim/types.d.ts +7 -0
- package/dist/components/fan-pass-claim/types.d.ts.map +1 -1
- package/dist/components/fan-pass-claim/types.js +9 -1
- package/dist/components/fan-pass-claim/types.js.map +1 -1
- package/dist/components/fan-pass-unlock/fan-pass-unlock.d.ts +31 -17
- package/dist/components/fan-pass-unlock/fan-pass-unlock.d.ts.map +1 -1
- package/dist/components/fan-pass-unlock/fan-pass-unlock.js +539 -198
- package/dist/components/fan-pass-unlock/fan-pass-unlock.js.map +1 -1
- package/dist/components/fan-pass-unlock/index.d.ts +8 -2
- package/dist/components/fan-pass-unlock/index.d.ts.map +1 -1
- package/dist/components/fan-pass-unlock/index.js +6 -0
- package/dist/components/fan-pass-unlock/index.js.map +1 -0
- package/dist/components/frame/frame.d.ts +1 -0
- package/dist/components/frame/frame.d.ts.map +1 -1
- package/dist/components/frame/frame.js +48 -20
- package/dist/components/frame/frame.js.map +1 -1
- package/dist/components/frame/index.d.ts +6 -1
- package/dist/components/frame/index.d.ts.map +1 -1
- package/dist/components/frame/index.js +6 -0
- package/dist/components/frame/index.js.map +1 -0
- package/dist/components/index.d.ts +4 -3
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +7 -3
- package/dist/components/index.js.map +1 -1
- package/dist/components/login/index.d.ts +6 -1
- package/dist/components/login/index.d.ts.map +1 -1
- package/dist/components/login/index.js +6 -0
- package/dist/components/login/index.js.map +1 -0
- package/dist/components/login/login.d.ts +4 -3
- package/dist/components/login/login.d.ts.map +1 -1
- package/dist/components/login/login.js +97 -38
- package/dist/components/login/login.js.map +1 -1
- package/dist/components/login/types.d.ts +4 -0
- package/dist/components/login/types.d.ts.map +1 -1
- package/dist/components/mobile-pass/index.d.ts +8 -0
- package/dist/components/mobile-pass/index.d.ts.map +1 -0
- package/dist/components/mobile-pass/index.js +6 -0
- package/dist/components/mobile-pass/index.js.map +1 -0
- package/dist/components/mobile-pass/mobile-pass.d.ts +20 -0
- package/dist/components/mobile-pass/mobile-pass.d.ts.map +1 -0
- package/dist/components/mobile-pass/mobile-pass.js +150 -0
- package/dist/components/mobile-pass/mobile-pass.js.map +1 -0
- package/dist/constants/components.d.ts +1 -1
- package/dist/constants/components.d.ts.map +1 -1
- package/dist/constants/components.js +1 -1
- package/dist/controllers/LoginController.d.ts +33 -5
- package/dist/controllers/LoginController.d.ts.map +1 -1
- package/dist/controllers/LoginController.js +38 -24
- package/dist/controllers/LoginController.js.map +1 -1
- package/dist/docs/error-screen/designTokens.d.ts +1 -3
- package/dist/docs/error-screen/designTokens.d.ts.map +1 -1
- package/dist/docs/fan-pass-claim/designTokens.d.ts.map +1 -1
- package/dist/docs/fan-pass-claim/fan-pass-claim.stories.d.ts +1 -1
- package/dist/docs/fan-pass-claim/fan-pass-claim.stories.d.ts.map +1 -1
- package/dist/docs/fan-pass-unlock/designTokens.d.ts.map +1 -1
- package/dist/docs/fan-pass-unlock/fan-pass-unlock.stories.d.ts +1 -1
- package/dist/docs/fan-pass-unlock/fan-pass-unlock.stories.d.ts.map +1 -1
- package/dist/docs/login/designTokens.d.ts +1 -3
- package/dist/docs/login/designTokens.d.ts.map +1 -1
- package/dist/docs/login/login.stories.d.ts +1 -1
- package/dist/docs/login/login.stories.d.ts.map +1 -1
- package/dist/docs/mobile-pass/designTokens.d.ts +3 -0
- package/dist/docs/mobile-pass/designTokens.d.ts.map +1 -0
- package/dist/docs/mobile-pass/mobile-pass.stories.d.ts +6 -0
- package/dist/docs/mobile-pass/mobile-pass.stories.d.ts.map +1 -0
- package/dist/events/claim.d.ts +2 -1
- package/dist/events/claim.d.ts.map +1 -1
- package/dist/events/claim.js.map +1 -1
- package/dist/events/login.d.ts +8 -1
- package/dist/events/login.d.ts.map +1 -1
- package/dist/events/login.js +1 -0
- package/dist/events/login.js.map +1 -1
- package/dist/events/unlock.d.ts +15 -1
- package/dist/events/unlock.d.ts.map +1 -1
- package/dist/events/unlock.js +2 -0
- package/dist/events/unlock.js.map +1 -1
- package/dist/internal/CirkayElement.d.ts.map +1 -1
- package/dist/internal/CirkayElement.js +0 -2
- package/dist/internal/CirkayElement.js.map +1 -1
- package/dist/node_modules/.pnpm/@magic-sdk_provider@28.20.0_localforage@1.10.0/node_modules/@magic-sdk/provider/dist/es/index.js +10 -0
- package/dist/node_modules/.pnpm/@magic-sdk_provider@28.20.0_localforage@1.10.0/node_modules/@magic-sdk/provider/dist/es/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@magic-sdk_types@24.18.0/node_modules/@magic-sdk/types/dist/es/index.js +4 -0
- package/dist/node_modules/.pnpm/@magic-sdk_types@24.18.0/node_modules/@magic-sdk/types/dist/es/index.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 → @rollup_plugin-typescript@12.1.2_rollup@4.34.6_tslib@2.8.1_typescript@5.7.3}/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.34.8_tslib@2.8.1_typescript@5.7.3/node_modules/tslib/tslib.es6.js +31 -0
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.34.8_tslib@2.8.1_typescript@5.7.3/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/node_modules/.pnpm/magic-sdk@28.21.1/node_modules/magic-sdk/dist/es/index.js +9 -0
- package/dist/node_modules/.pnpm/magic-sdk@28.21.1/node_modules/magic-sdk/dist/es/index.js.map +1 -0
- package/dist/utils/helpers.d.ts +26 -2
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/helpers.js +65 -7
- package/dist/utils/helpers.js.map +1 -1
- package/package.json +21 -16
- package/dist/_virtual/_commonjsHelpers.js +0 -6
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/_virtual/index.js +0 -8
- package/dist/_virtual/index.js.map +0 -1
- package/dist/node_modules/.pnpm/axios-rate-limit@1.4.0_axios@1.7.9/node_modules/axios-rate-limit/src/index.js +0 -182
- package/dist/node_modules/.pnpm/axios-rate-limit@1.4.0_axios@1.7.9/node_modules/axios-rate-limit/src/index.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/adapters.js +0 -82
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/adapters.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/fetch.js +0 -230
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/fetch.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/xhr.js +0 -200
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/adapters/xhr.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/axios.js +0 -87
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/axios.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/CancelToken.js +0 -134
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/CancelToken.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/CanceledError.js +0 -24
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/CanceledError.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/isCancel.js +0 -6
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/cancel/isCancel.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/Axios.js +0 -232
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/Axios.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/AxiosError.js +0 -102
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/AxiosError.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/AxiosHeaders.js +0 -301
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/AxiosHeaders.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/InterceptorManager.js +0 -70
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/InterceptorManager.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/buildFullPath.js +0 -22
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/buildFullPath.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/dispatchRequest.js +0 -82
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/dispatchRequest.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/mergeConfig.js +0 -107
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/mergeConfig.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/settle.js +0 -28
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/settle.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/transformData.js +0 -29
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/core/transformData.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/defaults/index.js +0 -160
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/defaults/index.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/defaults/transitional.js +0 -8
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/defaults/transitional.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/env/data.js +0 -4
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/env/data.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -57
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/AxiosURLSearchParams.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -72
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/HttpStatusCode.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/bind.js +0 -8
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/bind.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/buildURL.js +0 -70
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/buildURL.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/combineURLs.js +0 -16
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/combineURLs.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/composeSignals.js +0 -49
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/composeSignals.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/cookies.js +0 -44
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/cookies.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/formDataToJSON.js +0 -94
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/formDataToJSON.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -16
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isAbsoluteURL.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isAxiosError.js +0 -15
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isAxiosError.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -17
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/isURLSameOrigin.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/null.js +0 -5
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/null.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/parseHeaders.js +0 -56
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/parseHeaders.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/parseProtocol.js +0 -7
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/parseProtocol.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/progressEventReducer.js +0 -47
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/progressEventReducer.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/resolveConfig.js +0 -59
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/resolveConfig.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/speedometer.js +0 -54
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/speedometer.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/spread.js +0 -29
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/spread.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/throttle.js +0 -45
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/throttle.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/toFormData.js +0 -216
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/toFormData.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/toURLEncodedForm.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/trackStream.js +0 -89
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/trackStream.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/validator.js +0 -100
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/helpers/validator.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -4
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/Blob.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -4
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/FormData.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -6
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/index.js +0 -16
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/browser/index.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/common/utils.js +0 -46
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/common/utils.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/index.js +0 -10
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/platform/index.js.map +0 -1
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/utils.js +0 -761
- package/dist/node_modules/.pnpm/axios@1.7.9/node_modules/axios/lib/utils.js.map +0 -1
- package/dist/utils/settings.js +0 -7
- package/dist/utils/settings.js.map +0 -1
- /package/dist/node_modules/.pnpm/{@rollup_plugin-typescript@12.1.2_rollup@4.29.1_tslib@2.8.1_typescript@5.7.2 → @rollup_plugin-typescript@12.1.2_rollup@4.34.6_tslib@2.8.1_typescript@5.7.3}/node_modules/tslib/tslib.es6.js +0 -0
|
@@ -1,30 +1,36 @@
|
|
|
1
|
-
import { __decorate } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.
|
|
1
|
+
import { __decorate } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.1.2_rollup@4.34.8_tslib@2.8.1_typescript@5.7.3/node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
|
-
import { property,
|
|
3
|
+
import { property, query } from 'lit/decorators.js';
|
|
4
4
|
import { state } from 'lit/decorators/state.js';
|
|
5
5
|
import '@pushengineering/push-web-components/button';
|
|
6
6
|
import '@pushengineering/push-web-components/button-icon';
|
|
7
7
|
import '@pushengineering/push-web-components/text';
|
|
8
8
|
import '@pushengineering/push-web-components/vertical-stack';
|
|
9
9
|
import '@pushengineering/push-web-components/overlay';
|
|
10
|
-
import {
|
|
10
|
+
import { styleMap } from 'lit/directives/style-map.js';
|
|
11
|
+
import { preloadLogos, getLatestSession, addSession } from '../../utils/helpers.js';
|
|
11
12
|
import N3xusApi from '../../base/n3xus/N3xusAPI.js';
|
|
12
13
|
import { ClaimEvents } from '../../events/claim.js';
|
|
14
|
+
import { LoginEvents } from '../../events/login.js';
|
|
13
15
|
import CirkayElement from '../../internal/CirkayElement.js';
|
|
16
|
+
import '../login/index.js';
|
|
14
17
|
import { MintStatus } from '../../base/n3xus/types.js';
|
|
15
|
-
import '../
|
|
16
|
-
import '../
|
|
17
|
-
import '../
|
|
18
|
-
import
|
|
18
|
+
import '../frame/index.js';
|
|
19
|
+
import '../error-screen/index.js';
|
|
20
|
+
import '../mobile-pass/index.js';
|
|
21
|
+
import '../connected/index.js';
|
|
22
|
+
import { ClaimStateTypes, PromotionState, LoginState } from './types.js';
|
|
19
23
|
import { LoginController } from '../../controllers/LoginController.js';
|
|
20
|
-
import {
|
|
21
|
-
import { styleMap } from 'lit/directives/style-map.js';
|
|
24
|
+
import { LoginStateTypes } from '../login/types.js';
|
|
22
25
|
|
|
23
|
-
|
|
26
|
+
class FanPassClaim extends CirkayElement {
|
|
24
27
|
constructor() {
|
|
25
28
|
super();
|
|
26
29
|
this.loginController = null;
|
|
27
30
|
this.nexusAPI = undefined;
|
|
31
|
+
this.walletCheckResponse = null;
|
|
32
|
+
this.loginFlow = false;
|
|
33
|
+
this.checkInterval = null;
|
|
28
34
|
this.apiKey = '';
|
|
29
35
|
this.logoSet = {
|
|
30
36
|
large: {
|
|
@@ -39,12 +45,15 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
39
45
|
alt: 'Cirkay Logo',
|
|
40
46
|
};
|
|
41
47
|
this.fanPassTitle = 'Fan Pass';
|
|
42
|
-
this.
|
|
48
|
+
this.redeemCode = '';
|
|
49
|
+
this.availiblePromotion = false;
|
|
50
|
+
this.promotionId = null;
|
|
43
51
|
this.modal = false;
|
|
44
52
|
this.validateAfterModal = false;
|
|
45
|
-
this.staging =
|
|
53
|
+
this.staging = false;
|
|
46
54
|
this.debugLogging = false;
|
|
47
|
-
this.successUrl = '
|
|
55
|
+
this.successUrl = '';
|
|
56
|
+
this.promotionUrl = window.location.href;
|
|
48
57
|
this.autoRedirect = false;
|
|
49
58
|
this.showRedeemInput = false;
|
|
50
59
|
this.success = false;
|
|
@@ -53,15 +62,27 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
53
62
|
this.btnTextColor = '#FFFFFF';
|
|
54
63
|
this.faqUrl = 'https://cirkay.com/faq/';
|
|
55
64
|
this._claimState = ClaimStateTypes.validating;
|
|
65
|
+
this._promotionState = PromotionState.available;
|
|
56
66
|
this._pageNumber = 1;
|
|
57
67
|
this._user = undefined;
|
|
58
68
|
this._loginState = LoginState.initialising;
|
|
59
|
-
this.
|
|
60
|
-
const
|
|
61
|
-
|
|
69
|
+
this._codeStatus = null;
|
|
70
|
+
const imgApple = new Image();
|
|
71
|
+
imgApple.src = 'https://cdn.n3xus.services/production/assets/images/US-UK_Add_to_Apple_Wallet_RGB_101421.svg';
|
|
72
|
+
const imgGoogle = new Image();
|
|
73
|
+
imgGoogle.src = 'https://cdn.n3xus.services/production/assets/images/enGB_add_to_google_wallet_wallet-button.svg';
|
|
74
|
+
const imgCirkay = new Image();
|
|
75
|
+
imgCirkay.src = 'https://n3xus-store.s3.eu-west-2.amazonaws.com/staging/assets/cirkay-logo-transparent-no-padding.webp';
|
|
62
76
|
}
|
|
63
77
|
connectedCallback() {
|
|
64
78
|
super.connectedCallback();
|
|
79
|
+
try {
|
|
80
|
+
preloadLogos(this.logoSet);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.warn('Error loading logo images', error);
|
|
84
|
+
}
|
|
85
|
+
this._claimState = ClaimStateTypes.validating;
|
|
65
86
|
const magicApiOptions = {
|
|
66
87
|
staging: this.staging,
|
|
67
88
|
};
|
|
@@ -72,246 +93,461 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
72
93
|
stagging: this.staging,
|
|
73
94
|
};
|
|
74
95
|
this.nexusAPI = new N3xusApi(n3xusOptions);
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this._claimState = ClaimStateTypes.
|
|
82
|
-
|
|
96
|
+
const session = getLatestSession(this.apiKey);
|
|
97
|
+
const minutesAgo = Date.now() - 3.5 * 60 * 1000;
|
|
98
|
+
if (session &&
|
|
99
|
+
this.loginController.loginInit &&
|
|
100
|
+
this.loginController.loggedIn &&
|
|
101
|
+
!(session.issueTS < minutesAgo)) {
|
|
102
|
+
this._claimState = ClaimStateTypes.redeemedCheckingSession;
|
|
103
|
+
}
|
|
104
|
+
this.setUpdateState();
|
|
105
|
+
}
|
|
106
|
+
async handleMintType() {
|
|
107
|
+
this.logging('handleMintType');
|
|
108
|
+
this.logging('Promotion ID', this.promotionId);
|
|
109
|
+
if (this.promotionId) {
|
|
110
|
+
const promotion = await this.getPromotionInformation(this.promotionId);
|
|
111
|
+
this.logging('PROMOTION details', promotion);
|
|
112
|
+
const currentDate = new Date();
|
|
113
|
+
const startDate = promotion.start_date ? (new Date(promotion.start_date)) : null;
|
|
114
|
+
const endDate = promotion.end_date ? (new Date(promotion.end_date)) : null;
|
|
115
|
+
if (promotion.limit <= promotion.used_count) {
|
|
116
|
+
this._promotionState = PromotionState.noFanPassesLeft;
|
|
117
|
+
this.error = `${this.fanPassTitle} can no longer be claimed`;
|
|
118
|
+
this._claimState = ClaimStateTypes.error;
|
|
119
|
+
this._codeStatus = {
|
|
120
|
+
status: MintStatus.unavailable,
|
|
121
|
+
available: promotion.limit - promotion.used_count,
|
|
122
|
+
promotion: promotion
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
else if (endDate && currentDate > endDate) {
|
|
126
|
+
this._promotionState = PromotionState.promotionOver;
|
|
127
|
+
this.error = 'This claim is no longer available';
|
|
128
|
+
this._claimState = ClaimStateTypes.error;
|
|
129
|
+
this._codeStatus = {
|
|
130
|
+
status: MintStatus.unavailable,
|
|
131
|
+
available: promotion.limit - promotion.used_count,
|
|
132
|
+
promotion: promotion
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
else if (startDate && currentDate < startDate) {
|
|
136
|
+
const timeDiff = startDate.getTime() - currentDate.getTime();
|
|
137
|
+
const totalHours = Math.floor(timeDiff / (1000 * 60 * 60));
|
|
138
|
+
const days = Math.floor(totalHours / 24);
|
|
139
|
+
const remainingHours = totalHours % 24;
|
|
140
|
+
let text;
|
|
141
|
+
if (days > 0) {
|
|
142
|
+
text = `Access to this claim goes live in ${days} ${days === 1 ? 'day' : 'days'} and ${remainingHours} ${remainingHours === 1 ? 'hour' : 'hours'}`;
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
text = `Access to this claim goes live in ${totalHours} ${totalHours === 1 ? 'hour' : 'hours'}`;
|
|
146
|
+
}
|
|
147
|
+
this._promotionState = PromotionState.promotionNotBegun;
|
|
148
|
+
this.error = text;
|
|
149
|
+
this._claimState = ClaimStateTypes.error;
|
|
150
|
+
this._codeStatus = {
|
|
151
|
+
status: MintStatus.unavailable,
|
|
152
|
+
available: promotion.limit - promotion.used_count,
|
|
153
|
+
promotion: promotion
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
this._codeStatus = {
|
|
158
|
+
status: MintStatus.available,
|
|
159
|
+
available: promotion.limit - promotion.used_count,
|
|
160
|
+
promotion: promotion
|
|
161
|
+
};
|
|
162
|
+
this.availiblePromotion = true;
|
|
163
|
+
this.promotionUrl = promotion.promotion_url;
|
|
164
|
+
if (this.loginController?.loginInit) {
|
|
165
|
+
this._claimState = ClaimStateTypes.availableLoggedIn;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
83
168
|
}
|
|
84
|
-
|
|
85
|
-
|
|
169
|
+
else {
|
|
170
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
171
|
+
const urlRedeemCode = this.redeemCode.trim() === '' && !this.redeemCode
|
|
172
|
+
? urlParams.get('code')
|
|
173
|
+
: this.redeemCode;
|
|
174
|
+
if (!urlRedeemCode) {
|
|
175
|
+
this.setPromotionStatus().then(() => {
|
|
176
|
+
if (!this.availiblePromotion) {
|
|
177
|
+
this.error = "Seems like you're link is invalid, try again or contact support";
|
|
178
|
+
this._claimState = ClaimStateTypes.error;
|
|
179
|
+
}
|
|
180
|
+
else if (this.loginController?.loginInit) {
|
|
181
|
+
this._claimState = ClaimStateTypes.available;
|
|
182
|
+
}
|
|
183
|
+
else ;
|
|
184
|
+
return;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
this.setCodeStatus(null, urlRedeemCode);
|
|
189
|
+
}
|
|
86
190
|
}
|
|
87
|
-
this._claimState = ClaimStateTypes.validating;
|
|
88
191
|
}
|
|
89
|
-
|
|
192
|
+
willUpdate(changedProperties) {
|
|
90
193
|
try {
|
|
91
|
-
|
|
194
|
+
if (changedProperties.has('apiKey')) {
|
|
195
|
+
const n3xusOptions = {
|
|
196
|
+
apiKey: this.apiKey,
|
|
197
|
+
stagging: this.staging,
|
|
198
|
+
};
|
|
199
|
+
this.nexusAPI = new N3xusApi(n3xusOptions);
|
|
200
|
+
}
|
|
201
|
+
if (changedProperties.has('promotionId') || changedProperties.has('apiKey')) {
|
|
202
|
+
this.handleMintType();
|
|
203
|
+
}
|
|
92
204
|
this.setUpdateState();
|
|
93
205
|
}
|
|
94
206
|
catch (error) {
|
|
95
207
|
console.error('Error in update', error);
|
|
96
208
|
}
|
|
97
209
|
}
|
|
98
|
-
setUpdateState() {
|
|
210
|
+
async setUpdateState() {
|
|
211
|
+
if (this._claimState === ClaimStateTypes.redeemedCheckingSession
|
|
212
|
+
&& this.loginController?.loginInit
|
|
213
|
+
&& this.loginController?.loggedIn) {
|
|
214
|
+
const walletCheckResponse = await this.setSessionToken();
|
|
215
|
+
if (walletCheckResponse && walletCheckResponse.data?.holds) {
|
|
216
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
217
|
+
}
|
|
218
|
+
else if (walletCheckResponse && !walletCheckResponse.data?.holds) {
|
|
219
|
+
this._claimState = ClaimStateTypes.availableLoggedIn;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
this._claimState = ClaimStateTypes.error;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
99
225
|
if (this.loginController?.loginInit &&
|
|
100
226
|
this._claimState === ClaimStateTypes.validating &&
|
|
101
227
|
!this.loginController?.loggedIn &&
|
|
102
|
-
this.
|
|
228
|
+
this._codeStatus?.status === MintStatus.redeemed) {
|
|
103
229
|
this._claimState = ClaimStateTypes.redeemedLoggedout;
|
|
104
230
|
}
|
|
105
231
|
else if (this.loginController?.loginInit &&
|
|
106
|
-
this.
|
|
232
|
+
this._codeStatus?.status === MintStatus.redeemed &&
|
|
107
233
|
this._claimState === ClaimStateTypes.validating &&
|
|
108
234
|
this.loginController?.loggedIn &&
|
|
109
235
|
this.loginController?.user?.walletAddress ===
|
|
110
|
-
this.
|
|
111
|
-
this.
|
|
112
|
-
|
|
236
|
+
this._codeStatus?.wallet) {
|
|
237
|
+
this.setSessionToken().then(() => {
|
|
238
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
239
|
+
});
|
|
113
240
|
}
|
|
114
241
|
else if (this.loginController?.loginInit &&
|
|
115
242
|
this._claimState === ClaimStateTypes.validating &&
|
|
116
|
-
this.
|
|
243
|
+
this._codeStatus?.status === MintStatus.redeemed &&
|
|
117
244
|
this.loginController?.loggedIn &&
|
|
118
245
|
this.loginController?.user?.walletAddress !==
|
|
119
|
-
this.
|
|
246
|
+
this._codeStatus?.wallet) {
|
|
120
247
|
this._claimState = ClaimStateTypes.redeemedLoggedInInvalid;
|
|
121
248
|
}
|
|
122
249
|
else if (this.loginController?.loginInit &&
|
|
123
|
-
this.
|
|
124
|
-
this.
|
|
125
|
-
this.
|
|
126
|
-
this.
|
|
250
|
+
this.loginController?.loggedIn &&
|
|
251
|
+
this._claimState === ClaimStateTypes.available &&
|
|
252
|
+
this._codeStatus?.status === MintStatus.available &&
|
|
253
|
+
this.loginFlow) {
|
|
254
|
+
this.handleClaim();
|
|
127
255
|
}
|
|
128
256
|
else if (this.loginController?.loginInit &&
|
|
257
|
+
this.loginController?.loggedIn &&
|
|
258
|
+
this._claimState != ClaimStateTypes.redeemedLogin &&
|
|
259
|
+
this._claimState !== ClaimStateTypes.minting) {
|
|
260
|
+
const walletCheckResponse = await this.setSessionToken();
|
|
261
|
+
if (walletCheckResponse && walletCheckResponse.data?.holds) {
|
|
262
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
263
|
+
}
|
|
264
|
+
else if (!walletCheckResponse) {
|
|
265
|
+
this._claimState = ClaimStateTypes.availableLoggedIn;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
else if (this.loginController?.loginInit &&
|
|
269
|
+
!this.loginController?.loggedIn &&
|
|
129
270
|
this._claimState === ClaimStateTypes.validating &&
|
|
130
|
-
this.
|
|
271
|
+
this._codeStatus?.status === MintStatus.available &&
|
|
131
272
|
!this.loginController?.loggedIn) {
|
|
273
|
+
this.loginFlow = true;
|
|
132
274
|
this._claimState = ClaimStateTypes.available;
|
|
133
275
|
}
|
|
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
276
|
if (this.loginController?.loginInit &&
|
|
141
277
|
this._claimState === ClaimStateTypes.redeemedLoggedout &&
|
|
142
278
|
this.loginController?.loggedIn &&
|
|
143
279
|
this.loginController?.user?.walletAddress ===
|
|
144
|
-
this.
|
|
145
|
-
this.
|
|
146
|
-
|
|
280
|
+
this._codeStatus?.wallet) {
|
|
281
|
+
this.setSessionToken().then(() => {
|
|
282
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
283
|
+
});
|
|
147
284
|
}
|
|
148
285
|
else if (this.loginController?.loginInit &&
|
|
149
286
|
this._claimState === ClaimStateTypes.redeemedLoggedout &&
|
|
150
287
|
this.loginController?.loggedIn &&
|
|
151
288
|
this.loginController?.user?.walletAddress !==
|
|
152
|
-
this.
|
|
289
|
+
this._codeStatus?.wallet) {
|
|
153
290
|
this._claimState = ClaimStateTypes.redeemedLoggedInInvalid;
|
|
154
291
|
}
|
|
292
|
+
if ((this._claimState === ClaimStateTypes.redeemedLogin ||
|
|
293
|
+
this._claimState === ClaimStateTypes.availableLoggedIn) && this.loginController?.loginInit
|
|
294
|
+
&& !this.loginController?.loggedIn) {
|
|
295
|
+
this.loginFlow = true;
|
|
296
|
+
this.walletCheckResponse = null;
|
|
297
|
+
if (this._codeStatus?.status === MintStatus.available) {
|
|
298
|
+
this._claimState = ClaimStateTypes.available;
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
this._claimState = ClaimStateTypes.invalid;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
155
304
|
}
|
|
156
|
-
async
|
|
305
|
+
async setCodeStatus(issueId = null, redeemCode = null) {
|
|
157
306
|
if (!this.nexusAPI) {
|
|
158
307
|
throw new Error('Nexus API is not initialized');
|
|
159
308
|
}
|
|
160
|
-
|
|
309
|
+
let status;
|
|
310
|
+
if (issueId) {
|
|
311
|
+
status = await this.nexusAPI.checkIssueStatus((issueId = issueId), (redeemCode = null));
|
|
312
|
+
}
|
|
313
|
+
else if (redeemCode) {
|
|
314
|
+
this.redeemCode = redeemCode;
|
|
315
|
+
status = await this.nexusAPI.checkIssueStatus((issueId = null), (redeemCode = redeemCode));
|
|
316
|
+
}
|
|
161
317
|
if (!status) {
|
|
162
|
-
this.
|
|
163
|
-
|
|
318
|
+
this.logging('Code status updated', status);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
this.logging('setCodeStatus', issueId);
|
|
322
|
+
this._codeStatus = status.data;
|
|
323
|
+
this.logging('Code Status', status);
|
|
324
|
+
if (!status.ok) {
|
|
325
|
+
this._claimState = ClaimStateTypes.error;
|
|
326
|
+
}
|
|
327
|
+
switch (status.data?.status) {
|
|
328
|
+
case MintStatus.available:
|
|
329
|
+
if (this.loginController?.loginInit &&
|
|
330
|
+
this.loginController?.loggedIn) {
|
|
331
|
+
this.setSessionToken().then(() => {
|
|
332
|
+
this._claimState = ClaimStateTypes.availableLoggedIn;
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
else if (this.loginController?.loginInit &&
|
|
336
|
+
!this.loginController?.loggedIn) {
|
|
337
|
+
this._claimState = ClaimStateTypes.validating;
|
|
338
|
+
}
|
|
339
|
+
break;
|
|
340
|
+
case MintStatus.redeemed:
|
|
341
|
+
if (!this.loginController?.loginInit) {
|
|
342
|
+
this._claimState = ClaimStateTypes.validating;
|
|
343
|
+
}
|
|
344
|
+
else if (this.loginController?.loginInit &&
|
|
345
|
+
this.loginController?.loggedIn &&
|
|
346
|
+
this.loginController?.user?.walletAddress ===
|
|
347
|
+
status.data?.wallet) {
|
|
348
|
+
this.setSessionToken().then(() => {
|
|
349
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
else if (this.loginController?.loginInit &&
|
|
353
|
+
this.loginController?.loggedIn &&
|
|
354
|
+
this.loginController?.user?.walletAddress !==
|
|
355
|
+
status.data?.wallet) {
|
|
356
|
+
this._claimState =
|
|
357
|
+
ClaimStateTypes.redeemedLoggedInInvalid;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
this._claimState =
|
|
361
|
+
ClaimStateTypes.redeemedLoggedInInvalid;
|
|
362
|
+
}
|
|
363
|
+
break;
|
|
364
|
+
case MintStatus.minting:
|
|
365
|
+
this._claimState = ClaimStateTypes.minting;
|
|
366
|
+
break;
|
|
367
|
+
case MintStatus.error:
|
|
368
|
+
this._claimState = ClaimStateTypes.mintingError;
|
|
369
|
+
break;
|
|
370
|
+
default:
|
|
371
|
+
this.error = "Seems like you're link is invalid, try again or contact support";
|
|
372
|
+
this._claimState = ClaimStateTypes.invalid;
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
164
375
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
376
|
+
}
|
|
377
|
+
async getPromotionInformation(promotionId) {
|
|
378
|
+
try {
|
|
379
|
+
const { data, error } = (await this.nexusAPI?.getPromotionInformation(promotionId)) || {};
|
|
380
|
+
if (error || !data) {
|
|
381
|
+
this.error = error || 'An error occurred while fetching promotion information';
|
|
382
|
+
this._claimState = ClaimStateTypes.error;
|
|
383
|
+
throw new Error(this.error);
|
|
384
|
+
}
|
|
385
|
+
return data;
|
|
386
|
+
}
|
|
387
|
+
catch (err) {
|
|
388
|
+
this.error =
|
|
389
|
+
err instanceof Error ? err.message : 'An error occurred while fetching promotion information';
|
|
169
390
|
this._claimState = ClaimStateTypes.error;
|
|
170
|
-
|
|
391
|
+
throw err;
|
|
171
392
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
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;
|
|
393
|
+
}
|
|
394
|
+
async setPromotionStatus() {
|
|
395
|
+
const validation = await this.nexusAPI?.checkPromotion(this.promotionUrl);
|
|
396
|
+
if (!validation) {
|
|
397
|
+
this.error = 'an error occured';
|
|
398
|
+
this._claimState = ClaimStateTypes.error;
|
|
399
|
+
throw new Error('error occured');
|
|
400
|
+
}
|
|
401
|
+
if (validation.ok && validation.data.available) {
|
|
402
|
+
this.availiblePromotion = true;
|
|
215
403
|
}
|
|
216
|
-
return status;
|
|
217
404
|
}
|
|
218
|
-
validateMint(interval, maxAttempts) {
|
|
405
|
+
validateMint(interval, maxAttempts, issueId) {
|
|
219
406
|
let attempts = 0;
|
|
220
|
-
|
|
407
|
+
this.checkInterval = setInterval(async () => {
|
|
221
408
|
attempts++;
|
|
222
|
-
const status = await this.
|
|
223
|
-
if (status
|
|
224
|
-
|
|
225
|
-
this._claimState = ClaimStateTypes.
|
|
226
|
-
|
|
227
|
-
clearInterval(checkInterval);
|
|
228
|
-
this.emit(ClaimEvents.Claimed, { bubbles: false });
|
|
229
|
-
this.success = true;
|
|
409
|
+
const status = await this.nexusAPI?.checkIssueStatus(issueId, null);
|
|
410
|
+
if (!status) {
|
|
411
|
+
this.error = 'an error occured';
|
|
412
|
+
this._claimState = ClaimStateTypes.error;
|
|
413
|
+
throw new Error('error occured');
|
|
230
414
|
}
|
|
231
|
-
else
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
415
|
+
else {
|
|
416
|
+
if (status.ok === true &&
|
|
417
|
+
status.data?.status === MintStatus.redeemed) {
|
|
418
|
+
clearInterval(this.checkInterval);
|
|
419
|
+
this.walletCheckResponse = await this.setSessionToken();
|
|
420
|
+
this.emit(ClaimEvents.Claimed, {
|
|
421
|
+
bubbles: true,
|
|
422
|
+
composed: true,
|
|
423
|
+
detail: {
|
|
424
|
+
sessionToken: this.walletCheckResponse?.data?.sessionToken,
|
|
425
|
+
email: this.walletCheckResponse?.data?.email,
|
|
426
|
+
apiKey: this.apiKey,
|
|
427
|
+
holds: this.walletCheckResponse?.data?.holds,
|
|
428
|
+
mobileWallet: this.walletCheckResponse?.data?.mobilePasses,
|
|
429
|
+
},
|
|
430
|
+
});
|
|
431
|
+
this.success = true;
|
|
432
|
+
if (this.loginController?.loginInit &&
|
|
433
|
+
this.loginController?.loggedIn) {
|
|
434
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
this._claimState = ClaimStateTypes.redeemedLoggedout;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
else if (attempts >= maxAttempts) {
|
|
441
|
+
this._claimState = ClaimStateTypes.mintingError;
|
|
442
|
+
clearInterval(this.checkInterval);
|
|
443
|
+
this.error = 'Claim failed. Please try again later.';
|
|
444
|
+
}
|
|
235
445
|
}
|
|
236
446
|
}, interval);
|
|
237
447
|
}
|
|
238
448
|
async handleClaim() {
|
|
449
|
+
this._claimState = ClaimStateTypes.minting;
|
|
239
450
|
let didToken = this.loginController?.user?.did?.token;
|
|
240
451
|
if (didToken === undefined) {
|
|
241
452
|
await this.loginController?.getDidToken();
|
|
242
453
|
didToken = this.loginController?.user?.did?.token;
|
|
243
|
-
console.log(didToken);
|
|
244
|
-
}
|
|
245
|
-
if (this.redeemToken === '') {
|
|
246
|
-
this.error = 'No redeemtoken provided';
|
|
247
454
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
455
|
+
try {
|
|
456
|
+
if (this.redeemCode === '' && !this.availiblePromotion) {
|
|
457
|
+
this.error = "Seems like you're link is invalid, try again or contact support";
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
const response = await this.nexusAPI?.mint(didToken, this.redeemCode || undefined, this.availiblePromotion ? this.promotionUrl : undefined, this.promotionId || undefined);
|
|
461
|
+
if (!response) {
|
|
462
|
+
this.error = 'an error occured';
|
|
463
|
+
this._claimState = ClaimStateTypes.error;
|
|
464
|
+
throw new Error('error occured');
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
const issueId = response.issueId;
|
|
253
468
|
const interval = 10000;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
this.validateMint(interval, maxAttempts);
|
|
469
|
+
const estimate = response.estimate_seconds;
|
|
470
|
+
const minAttempts = 3;
|
|
471
|
+
const maxAttempts = estimate
|
|
472
|
+
? Math.max(minAttempts, Math.ceil((estimate * 2) / (interval / 1000)))
|
|
473
|
+
: minAttempts;
|
|
474
|
+
this.validateMint(interval, maxAttempts, issueId);
|
|
262
475
|
}
|
|
263
|
-
|
|
264
|
-
|
|
476
|
+
}
|
|
477
|
+
catch (error) {
|
|
478
|
+
switch (error.message) {
|
|
479
|
+
case 'Issuance code not available':
|
|
480
|
+
this._claimState = ClaimStateTypes.error;
|
|
265
481
|
this.error = 'This code not available or already used!';
|
|
266
|
-
|
|
267
|
-
|
|
482
|
+
break;
|
|
483
|
+
case 'Promotion does not exist':
|
|
484
|
+
this._claimState = ClaimStateTypes.error;
|
|
485
|
+
this.error = 'Use a code to claim your FanPasss';
|
|
486
|
+
break;
|
|
487
|
+
case 'Failed to fetch code status: You already have this promotion':
|
|
488
|
+
this._claimState = ClaimStateTypes.redeemedLogin;
|
|
489
|
+
break;
|
|
490
|
+
default:
|
|
491
|
+
this._claimState = ClaimStateTypes.error;
|
|
268
492
|
this.error =
|
|
269
493
|
'An error occurred while claiming the Fan Pass. Please try again later.';
|
|
270
|
-
}
|
|
271
494
|
}
|
|
272
495
|
}
|
|
273
496
|
}
|
|
274
497
|
async setSessionToken() {
|
|
275
|
-
if (this.
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
if (checkResponse.data?.holds) {
|
|
304
|
-
setStoredSession(JSON.stringify({
|
|
305
|
-
token: checkResponse.data.sessionToken,
|
|
306
|
-
issueTS: Date.now(),
|
|
307
|
-
}));
|
|
308
|
-
}
|
|
498
|
+
if (!this.loginController?.loginInit) {
|
|
499
|
+
return null;
|
|
500
|
+
}
|
|
501
|
+
if (!this.loginController?.loggedIn) {
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
504
|
+
if (!this.nexusAPI) {
|
|
505
|
+
const n3xusOptions = {
|
|
506
|
+
apiKey: this.apiKey,
|
|
507
|
+
stagging: this.staging,
|
|
508
|
+
};
|
|
509
|
+
this.nexusAPI = new N3xusApi(n3xusOptions);
|
|
510
|
+
}
|
|
511
|
+
if (!this.loginController?.user) {
|
|
512
|
+
await this.loginController?.getUserInfo();
|
|
513
|
+
}
|
|
514
|
+
if (!this.loginController?.user?.did?.token) {
|
|
515
|
+
await this.loginController?.getDidToken();
|
|
516
|
+
}
|
|
517
|
+
if (!this.loginController?.user?.did?.token) {
|
|
518
|
+
console.error('No DID token found');
|
|
519
|
+
return null;
|
|
520
|
+
}
|
|
521
|
+
this.walletCheckResponse = await this.nexusAPI.checkWalletForNft('', this.loginController?.user?.did?.token);
|
|
522
|
+
if (!this.walletCheckResponse.ok) {
|
|
523
|
+
console.error('Check wallet for NFT failed');
|
|
524
|
+
return null;
|
|
309
525
|
}
|
|
526
|
+
if (this.walletCheckResponse.data?.holds && this.loginController?.loggedIn) {
|
|
527
|
+
addSession({
|
|
528
|
+
didToken: this.loginController?.user?.did?.token,
|
|
529
|
+
issueTS: Date.now(),
|
|
530
|
+
token: this.walletCheckResponse.data.sessionToken,
|
|
531
|
+
apiKey: this.apiKey,
|
|
532
|
+
mobilePass: this.walletCheckResponse.data.mobilePasses,
|
|
533
|
+
});
|
|
534
|
+
return this.walletCheckResponse;
|
|
535
|
+
}
|
|
536
|
+
return null;
|
|
310
537
|
}
|
|
311
538
|
async logout() {
|
|
312
|
-
|
|
539
|
+
this.walletCheckResponse = null;
|
|
540
|
+
this.loginFlow = true;
|
|
313
541
|
this._claimState = ClaimStateTypes.available;
|
|
314
542
|
this._pageNumber = 1;
|
|
543
|
+
this.emit(LoginEvents.Logout, {
|
|
544
|
+
bubbles: true,
|
|
545
|
+
composed: true,
|
|
546
|
+
detail: {
|
|
547
|
+
LoggedIn: false,
|
|
548
|
+
},
|
|
549
|
+
});
|
|
550
|
+
await this.loginController?.logout();
|
|
315
551
|
}
|
|
316
552
|
closeOverlay(e) {
|
|
317
553
|
const overlay = this.shadowRoot?.getElementById('fb-modal');
|
|
@@ -323,11 +559,9 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
323
559
|
const overlay = this.shadowRoot?.getElementById('fb-modal');
|
|
324
560
|
const triggerButton = e.target;
|
|
325
561
|
triggerButton?.setAttribute('aria-expanded', 'true');
|
|
326
|
-
if (
|
|
327
|
-
|
|
328
|
-
this.setTokenStatus(this.redeemToken);
|
|
562
|
+
if (overlay) {
|
|
563
|
+
overlay.openOverlay();
|
|
329
564
|
}
|
|
330
|
-
overlay?.openOverlay();
|
|
331
565
|
}
|
|
332
566
|
logging(message, ...optionalParams) {
|
|
333
567
|
if (this.debugLogging) {
|
|
@@ -343,6 +577,24 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
343
577
|
};
|
|
344
578
|
return styles;
|
|
345
579
|
}
|
|
580
|
+
renderMobilePass() {
|
|
581
|
+
if (this.walletCheckResponse?.data?.mobilePasses
|
|
582
|
+
&& Array.isArray(this.walletCheckResponse?.data?.mobilePasses)
|
|
583
|
+
&& this.walletCheckResponse?.data?.mobilePasses.length > 0
|
|
584
|
+
&& !this.walletCheckResponse?.data?.mobilePasses[this.walletCheckResponse?.data?.mobilePasses.length - 1].isActivated) {
|
|
585
|
+
const mobilePass = this.walletCheckResponse?.data?.mobilePasses[this.walletCheckResponse?.data?.mobilePasses.length - 1];
|
|
586
|
+
return html `
|
|
587
|
+
<fp-mobile-pass
|
|
588
|
+
.fanPassTitle=${this.fanPassTitle}
|
|
589
|
+
.androidLink=${mobilePass?.androidWalletUri}
|
|
590
|
+
.appleLink=${mobilePass?.iPhoneWalletUri}
|
|
591
|
+
.downloadLink=${mobilePass?.downloadLink}
|
|
592
|
+
.displayIntro=${false}
|
|
593
|
+
></fp-mobile-pass>
|
|
594
|
+
`;
|
|
595
|
+
}
|
|
596
|
+
return html ``;
|
|
597
|
+
}
|
|
346
598
|
renderClaimSuccess() {
|
|
347
599
|
return html `
|
|
348
600
|
<pu-vertical-stack spacing="24" mobileSpacing="24">
|
|
@@ -351,46 +603,68 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
351
603
|
You've claimed your ${this.fanPassTitle}!
|
|
352
604
|
</pu-text>
|
|
353
605
|
<pu-vertical-stack spacing="8" mobileSpacing="8">
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
fullWidth
|
|
377
|
-
buttonstyle="solid"
|
|
378
|
-
>
|
|
379
|
-
<pu-text as="p" variant="bodyMd" withoutMargin>
|
|
380
|
-
Disconnect
|
|
381
|
-
</pu-text>
|
|
382
|
-
</pu-button>
|
|
606
|
+
${this.successUrl !== ''
|
|
607
|
+
? html `
|
|
608
|
+
<pu-button
|
|
609
|
+
class="button"
|
|
610
|
+
style="${styleMap(this.buttonStyles())}"
|
|
611
|
+
url=${this.successUrl}
|
|
612
|
+
size="large"
|
|
613
|
+
fullWidth
|
|
614
|
+
buttonstyle="solid"
|
|
615
|
+
>
|
|
616
|
+
<pu-text
|
|
617
|
+
as="p"
|
|
618
|
+
variant="bodyMd"
|
|
619
|
+
withoutMargin
|
|
620
|
+
>
|
|
621
|
+
Check out your perks!
|
|
622
|
+
</pu-text>
|
|
623
|
+
</pu-button>
|
|
624
|
+
`
|
|
625
|
+
: null}
|
|
626
|
+
|
|
627
|
+
${this.renderMobilePass()}
|
|
383
628
|
</pu-vertical-stack>
|
|
384
629
|
</pu-vertical-stack>
|
|
385
630
|
`;
|
|
386
631
|
}
|
|
632
|
+
setPageNumber(number) {
|
|
633
|
+
if (number !== undefined) {
|
|
634
|
+
this._pageNumber = number;
|
|
635
|
+
return;
|
|
636
|
+
}
|
|
637
|
+
const loginState = this._loginComponent?.getCurrentState();
|
|
638
|
+
switch (loginState) {
|
|
639
|
+
case LoginStateTypes.initialising:
|
|
640
|
+
case LoginStateTypes.initialised:
|
|
641
|
+
this._pageNumber = 1;
|
|
642
|
+
break;
|
|
643
|
+
case LoginStateTypes.requestCode:
|
|
644
|
+
case LoginStateTypes.enterLoginCode:
|
|
645
|
+
this._pageNumber = 2;
|
|
646
|
+
break;
|
|
647
|
+
case LoginStateTypes.optCodeSubmited:
|
|
648
|
+
case LoginStateTypes.isLoggedInLoading:
|
|
649
|
+
this._pageNumber = 3;
|
|
650
|
+
break;
|
|
651
|
+
case LoginStateTypes.optFailed:
|
|
652
|
+
case LoginStateTypes.isLoggedIn:
|
|
653
|
+
this._pageNumber = 3;
|
|
654
|
+
break;
|
|
655
|
+
default:
|
|
656
|
+
this._pageNumber = 1;
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
387
660
|
renderContent() {
|
|
661
|
+
this.setPageNumber();
|
|
388
662
|
switch (this._claimState) {
|
|
389
663
|
case ClaimStateTypes.redeemedLogin:
|
|
390
|
-
this.
|
|
664
|
+
this.setPageNumber(3);
|
|
391
665
|
return this.renderClaimSuccess();
|
|
392
666
|
case ClaimStateTypes.redeemedLoggedout:
|
|
393
|
-
this.
|
|
667
|
+
this.setPageNumber(3);
|
|
394
668
|
return html `
|
|
395
669
|
<pu-vertical-stack
|
|
396
670
|
spacing="24"
|
|
@@ -398,25 +672,14 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
398
672
|
mobileAlign="center"
|
|
399
673
|
>
|
|
400
674
|
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
401
|
-
|
|
675
|
+
This ${this.fanPassTitle} has already been claimed
|
|
402
676
|
</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
677
|
</pu-vertical-stack>
|
|
415
678
|
`;
|
|
679
|
+
case ClaimStateTypes.redeemedCheckingSession:
|
|
416
680
|
case ClaimStateTypes.validating:
|
|
417
|
-
this._pageNumber = 1;
|
|
418
681
|
return html `
|
|
419
|
-
<pu-text as="p" variant="bodyLg">
|
|
682
|
+
<pu-text as="p" variant="bodyLg"> Initializing... </pu-text>
|
|
420
683
|
<svg
|
|
421
684
|
class="loading__spinner"
|
|
422
685
|
width="16"
|
|
@@ -433,7 +696,7 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
433
696
|
</svg>
|
|
434
697
|
`;
|
|
435
698
|
case ClaimStateTypes.invalid:
|
|
436
|
-
this.
|
|
699
|
+
this.setPageNumber(3);
|
|
437
700
|
return html `
|
|
438
701
|
<fp-error-screen
|
|
439
702
|
errorText=${this.error}
|
|
@@ -441,7 +704,6 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
441
704
|
></fp-error-screen>
|
|
442
705
|
`;
|
|
443
706
|
case ClaimStateTypes.availableLoggedIn:
|
|
444
|
-
this._pageNumber = 1;
|
|
445
707
|
return html `
|
|
446
708
|
<pu-vertical-stack
|
|
447
709
|
class=""
|
|
@@ -455,6 +717,7 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
455
717
|
<pu-text as="p" variant="bodyMd" withoutMargin>
|
|
456
718
|
Logged in as ${this.loginController?.user?.email}
|
|
457
719
|
</pu-text>
|
|
720
|
+
|
|
458
721
|
<pu-vertical-stack
|
|
459
722
|
class=""
|
|
460
723
|
spacing="8"
|
|
@@ -485,7 +748,6 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
485
748
|
</pu-vertical-stack>
|
|
486
749
|
`;
|
|
487
750
|
case ClaimStateTypes.available:
|
|
488
|
-
this._pageNumber = 1;
|
|
489
751
|
return html `
|
|
490
752
|
<pu-vertical-stack
|
|
491
753
|
class=""
|
|
@@ -493,9 +755,9 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
493
755
|
align="center"
|
|
494
756
|
mobileAlign="center"
|
|
495
757
|
>
|
|
496
|
-
|
|
758
|
+
${this._pageNumber === 1 ? html `<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
497
759
|
Claim your ${this.fanPassTitle}
|
|
498
|
-
</pu-text
|
|
760
|
+
</pu-text>` : html ``}
|
|
499
761
|
<fp-login
|
|
500
762
|
id="login"
|
|
501
763
|
buttonLabel="Claim"
|
|
@@ -503,17 +765,20 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
503
765
|
btnBackgroundColor=${this.btnBackgroundColor}
|
|
504
766
|
btnTextColor=${this.btnTextColor}
|
|
505
767
|
?hidden=${false}
|
|
506
|
-
?staging=${
|
|
507
|
-
?debugLogging=${
|
|
768
|
+
?staging=${this.staging}
|
|
769
|
+
?debugLogging=${this.debugLogging}
|
|
508
770
|
?showLoaderAfterLogin=${true}
|
|
509
|
-
|
|
771
|
+
>
|
|
772
|
+
<form slot="form-content">
|
|
773
|
+
<slot name="form-content-claim"></slot>
|
|
774
|
+
</form>
|
|
775
|
+
</fp-login>
|
|
510
776
|
</pu-vertical-stack>
|
|
511
777
|
`;
|
|
512
778
|
case ClaimStateTypes.minting:
|
|
513
|
-
this._pageNumber = 3;
|
|
514
779
|
return html `
|
|
515
780
|
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
516
|
-
|
|
781
|
+
Claiming...
|
|
517
782
|
</pu-text>
|
|
518
783
|
<svg
|
|
519
784
|
class="loading__spinner"
|
|
@@ -531,10 +796,10 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
531
796
|
</svg>
|
|
532
797
|
`;
|
|
533
798
|
case ClaimStateTypes.redeemedLoggedInInvalid:
|
|
534
|
-
this.
|
|
799
|
+
this.setPageNumber(3);
|
|
535
800
|
return html `
|
|
536
801
|
<fp-error-screen
|
|
537
|
-
errorText="This
|
|
802
|
+
errorText="This Code has already been used"
|
|
538
803
|
>
|
|
539
804
|
<pu-button
|
|
540
805
|
slot="button"
|
|
@@ -559,8 +824,8 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
559
824
|
</fp-error-screen>
|
|
560
825
|
`;
|
|
561
826
|
case ClaimStateTypes.redeemed:
|
|
562
|
-
if (this.
|
|
563
|
-
this.
|
|
827
|
+
if (!this.loginController?.loginInit) {
|
|
828
|
+
this.setPageNumber(2);
|
|
564
829
|
return html `
|
|
565
830
|
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
566
831
|
Loading...
|
|
@@ -581,8 +846,7 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
581
846
|
</svg>
|
|
582
847
|
`;
|
|
583
848
|
}
|
|
584
|
-
if (this.
|
|
585
|
-
this._pageNumber = 1;
|
|
849
|
+
if (!this.loginController?.loggedIn) {
|
|
586
850
|
return html `
|
|
587
851
|
<fp-login
|
|
588
852
|
id="login"
|
|
@@ -591,14 +855,14 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
591
855
|
btnBackgroundColor=${this.btnBackgroundColor}
|
|
592
856
|
btnTextColor=${this.btnTextColor}
|
|
593
857
|
?hidden=${false}
|
|
594
|
-
?staging=${
|
|
595
|
-
?debugLogging=${
|
|
596
|
-
?showLoaderAfterLogin=${
|
|
858
|
+
?staging=${this.staging}
|
|
859
|
+
?debugLogging=${this.debugLogging}
|
|
860
|
+
?showLoaderAfterLogin=${true}
|
|
597
861
|
></fp-login>
|
|
598
862
|
`;
|
|
599
863
|
}
|
|
600
|
-
if (this.
|
|
601
|
-
this.
|
|
864
|
+
else if (this._codeStatus?.wallet == this._user?.walletAddress) {
|
|
865
|
+
this.setPageNumber(3);
|
|
602
866
|
return html `
|
|
603
867
|
<pu-vertical-stack spacing="24">
|
|
604
868
|
<pu-text as="p" variant="bodyLg" withoutMargin>
|
|
@@ -610,7 +874,7 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
610
874
|
</pu-vertical-stack>
|
|
611
875
|
`;
|
|
612
876
|
}
|
|
613
|
-
this.
|
|
877
|
+
this.setPageNumber(3);
|
|
614
878
|
return html `
|
|
615
879
|
<fp-error-screen
|
|
616
880
|
errorText="Invalid ${this.fanPassTitle}"
|
|
@@ -618,7 +882,6 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
618
882
|
></fp-error-screen>
|
|
619
883
|
`;
|
|
620
884
|
case ClaimStateTypes.mintingError:
|
|
621
|
-
this._pageNumber = 3;
|
|
622
885
|
return html `
|
|
623
886
|
<fp-error-screen
|
|
624
887
|
errorText=${this.error}
|
|
@@ -627,58 +890,85 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
627
890
|
`;
|
|
628
891
|
case ClaimStateTypes.error:
|
|
629
892
|
default:
|
|
630
|
-
this.
|
|
893
|
+
this.setPageNumber(3);
|
|
631
894
|
return html `
|
|
632
895
|
<fp-error-screen
|
|
633
|
-
errorText
|
|
896
|
+
errorText=${this.error || 'Claiming error'}
|
|
634
897
|
faqUrl=${this.faqUrl}
|
|
635
898
|
>
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
899
|
+
${this._promotionState == PromotionState.available
|
|
900
|
+
? html `
|
|
901
|
+
<pu-button
|
|
902
|
+
slot="button"
|
|
903
|
+
style="${styleMap(this.buttonStyles())}"
|
|
904
|
+
@click="${this.logout}"
|
|
905
|
+
type="button"
|
|
906
|
+
class="button"
|
|
907
|
+
name="disconnect"
|
|
908
|
+
size="large"
|
|
909
|
+
buttonstyle="solid"
|
|
910
|
+
>
|
|
911
|
+
<pu-text
|
|
912
|
+
as="span"
|
|
913
|
+
variant="bodyMd"
|
|
914
|
+
fontWeight="regular"
|
|
915
|
+
withoutMargin
|
|
916
|
+
spacing="loose"
|
|
917
|
+
>
|
|
918
|
+
Start over
|
|
919
|
+
</pu-text>
|
|
920
|
+
</pu-button>
|
|
921
|
+
`
|
|
922
|
+
: ''}
|
|
656
923
|
</fp-error-screen>
|
|
657
924
|
`;
|
|
658
925
|
}
|
|
659
926
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
927
|
+
renderClaimButton() {
|
|
928
|
+
let buttonLabel = 'Claim';
|
|
929
|
+
switch (this._claimState) {
|
|
930
|
+
case ClaimStateTypes.redeemedLogin:
|
|
931
|
+
this._pageNumber = 3;
|
|
932
|
+
buttonLabel = 'Claimed';
|
|
933
|
+
break;
|
|
934
|
+
case ClaimStateTypes.redeemedLoggedout:
|
|
935
|
+
buttonLabel = 'Claimed';
|
|
936
|
+
this._pageNumber = 1;
|
|
937
|
+
break;
|
|
938
|
+
case ClaimStateTypes.validating:
|
|
939
|
+
this._pageNumber = 1;
|
|
940
|
+
buttonLabel = 'Initializing...';
|
|
941
|
+
break;
|
|
942
|
+
case ClaimStateTypes.minting:
|
|
943
|
+
this._pageNumber = 2;
|
|
944
|
+
buttonLabel = 'Claiming...';
|
|
945
|
+
break;
|
|
946
|
+
case ClaimStateTypes.mintingError:
|
|
947
|
+
this._pageNumber = 3;
|
|
948
|
+
buttonLabel = 'Claim';
|
|
949
|
+
break;
|
|
950
|
+
case ClaimStateTypes.error:
|
|
951
|
+
this._pageNumber = 3;
|
|
952
|
+
buttonLabel = 'Claim';
|
|
953
|
+
break;
|
|
954
|
+
default:
|
|
955
|
+
this._pageNumber = 1;
|
|
956
|
+
buttonLabel = 'Claim';
|
|
957
|
+
break;
|
|
958
|
+
}
|
|
959
|
+
return html `
|
|
960
|
+
<div class="claim-button-container">
|
|
674
961
|
<pu-button
|
|
675
|
-
class="button"
|
|
962
|
+
class="button claim-button"
|
|
676
963
|
style="${styleMap(this.buttonStyles())}"
|
|
677
964
|
@click=${this.openOverlay}
|
|
678
965
|
type="button"
|
|
679
966
|
name="claim"
|
|
680
967
|
size="large"
|
|
968
|
+
fullWidth
|
|
681
969
|
buttonstyle="solid"
|
|
970
|
+
?disabled=${this._claimState === ClaimStateTypes.validating || this._claimState === ClaimStateTypes.redeemedCheckingSession}
|
|
971
|
+
?loading=${this._claimState === ClaimStateTypes.validating || this._claimState === ClaimStateTypes.redeemedCheckingSession}
|
|
682
972
|
>
|
|
683
973
|
<pu-text
|
|
684
974
|
as="span"
|
|
@@ -687,49 +977,131 @@ let FanPassClaim = class FanPassClaim extends CirkayElement {
|
|
|
687
977
|
withoutMargin
|
|
688
978
|
spacing="loose"
|
|
689
979
|
>
|
|
690
|
-
|
|
980
|
+
${buttonLabel}
|
|
691
981
|
</pu-text>
|
|
692
982
|
</pu-button>
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
983
|
+
</div>
|
|
984
|
+
`;
|
|
985
|
+
}
|
|
986
|
+
render() {
|
|
987
|
+
this.logging('render', 'claimState', this._claimState);
|
|
988
|
+
if (this.modal) {
|
|
989
|
+
return html `
|
|
990
|
+
${this.walletCheckResponse && this.loginController?.loggedIn ? html `
|
|
991
|
+
<fp-connected
|
|
992
|
+
displayText=${this.walletCheckResponse.data?.holds ? "You're connected!" : `Claim your ${this.fanPassTitle}`}
|
|
993
|
+
fanPassTitle=${this.fanPassTitle}
|
|
994
|
+
apiKey=${this.apiKey}
|
|
995
|
+
?stagging=${this.staging}
|
|
996
|
+
?debugLogging=${this.debugLogging}
|
|
997
|
+
?ownsFp=${this.walletCheckResponse.data?.holds ? true : false}
|
|
698
998
|
>
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
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"
|
|
999
|
+
<div slot="inner-content">${this.renderClaimButton()}</div>
|
|
1000
|
+
</fp-connected>
|
|
1001
|
+
` : html `
|
|
1002
|
+
${this.renderClaimButton()}
|
|
1003
|
+
`}
|
|
1004
|
+
|
|
1005
|
+
<pu-overlay id="fb-modal" class="fb-modal">
|
|
1006
|
+
<pu-box
|
|
1007
|
+
slot="content"
|
|
1008
|
+
class="modalContentBox"
|
|
1009
|
+
padding=${100}
|
|
1010
|
+
mobilePadding='60, 0'
|
|
717
1011
|
>
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
1012
|
+
<pu-vertical-stack
|
|
1013
|
+
spacing="40"
|
|
1014
|
+
align="center"
|
|
1015
|
+
mobileAlign="center"
|
|
1016
|
+
justify="center"
|
|
1017
|
+
mobileJustify="center"
|
|
1018
|
+
class="flowContainer"
|
|
1019
|
+
>
|
|
1020
|
+
<fp-frame
|
|
1021
|
+
fanPassTitle=${this.fanPassTitle}
|
|
1022
|
+
maxPages=${3}
|
|
1023
|
+
currentPageNumber=${this._pageNumber}
|
|
1024
|
+
.logoSet=${this.logoSet}
|
|
1025
|
+
>
|
|
1026
|
+
${this.renderContent()}
|
|
1027
|
+
</fp-frame>
|
|
1028
|
+
</pu-vertical-stack>
|
|
1029
|
+
<button
|
|
1030
|
+
part="button-icon"
|
|
1031
|
+
class="button-icon"
|
|
1032
|
+
style="position: absolute; top: 1rem; right: 1rem; z-index: 501"
|
|
1033
|
+
type="button"
|
|
1034
|
+
aria-label="Close modal"
|
|
1035
|
+
aria-controls="overlay"
|
|
1036
|
+
@click=${this.closeOverlay}
|
|
1037
|
+
>
|
|
1038
|
+
<svg
|
|
1039
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
1040
|
+
id="close"
|
|
1041
|
+
class="icon"
|
|
1042
|
+
width="1em"
|
|
1043
|
+
height="1em"
|
|
1044
|
+
viewBox="0 0 384 512"
|
|
1045
|
+
role="presentation"
|
|
1046
|
+
aria-hidden="true"
|
|
1047
|
+
focusable="false"
|
|
1048
|
+
fill="currentColor"
|
|
1049
|
+
>
|
|
1050
|
+
<path
|
|
1051
|
+
d="M192 233.4L59.5 100.9 36.9 123.5 169.4 256 36.9 388.5l22.6 22.6L192 278.6 324.5 411.1l22.6-22.6L214.6 256 347.1 123.5l-22.6-22.6L192 233.4z"
|
|
1052
|
+
/>
|
|
1053
|
+
</svg>
|
|
1054
|
+
</button>
|
|
1055
|
+
</pu-box>
|
|
1056
|
+
</pu-overlay>
|
|
721
1057
|
`;
|
|
722
1058
|
}
|
|
723
|
-
return
|
|
1059
|
+
return html `
|
|
1060
|
+
${this.walletCheckResponse && this.loginController?.loggedIn ? html `
|
|
1061
|
+
<fp-connected
|
|
1062
|
+
displayText=${this.walletCheckResponse.data?.holds ? "You already have this ${this.fanPassTitle}" : "Claim your ${this.fanPassTitle}"}
|
|
1063
|
+
fanPassTitle=${this.fanPassTitle}
|
|
1064
|
+
apiKey=${this.apiKey}
|
|
1065
|
+
?stagging=${this.staging}
|
|
1066
|
+
?debugLogging=${this.debugLogging}
|
|
1067
|
+
?ownsFp=${this.walletCheckResponse.data?.holds ? true : false}
|
|
1068
|
+
>
|
|
1069
|
+
<slot></slot>
|
|
1070
|
+
</fp-connected>
|
|
1071
|
+
` : html ``}
|
|
1072
|
+
<fp-frame
|
|
1073
|
+
fanPassTitle=${this.fanPassTitle}
|
|
1074
|
+
maxPages=${3}
|
|
1075
|
+
currentPageNumber=${this._pageNumber}
|
|
1076
|
+
.logoSet=${this.logoSet}
|
|
1077
|
+
>
|
|
1078
|
+
${this.renderContent()}
|
|
1079
|
+
</fp-frame>
|
|
1080
|
+
`;
|
|
724
1081
|
}
|
|
725
|
-
}
|
|
1082
|
+
}
|
|
726
1083
|
FanPassClaim.styles = css `
|
|
1084
|
+
.claim-button-container {
|
|
1085
|
+
width: 200px;
|
|
1086
|
+
max-width: 200px;
|
|
1087
|
+
}
|
|
727
1088
|
/* Add your component styles here */
|
|
1089
|
+
.fb-modal {
|
|
1090
|
+
--pu-color-overlay-background: rgba(0, 0, 0, 0.2);
|
|
1091
|
+
position: fixed;
|
|
1092
|
+
z-index: 999999;
|
|
1093
|
+
width: 100%;
|
|
1094
|
+
height: 100%;
|
|
1095
|
+
top: 0;
|
|
1096
|
+
left: 0;
|
|
1097
|
+
right: 0;
|
|
1098
|
+
pointer-events: none;
|
|
1099
|
+
bottom: 0;
|
|
1100
|
+
}
|
|
728
1101
|
.modalContentBox {
|
|
729
1102
|
background-color: #fff;
|
|
730
1103
|
position: relative;
|
|
731
|
-
height:
|
|
732
|
-
/* max-height: 800px; */
|
|
1104
|
+
height: 100vh;
|
|
733
1105
|
|
|
734
1106
|
@media only screen and (min-width: 48.06rem) {
|
|
735
1107
|
--pu-border-base-corner-radius: var(
|
|
@@ -739,6 +1111,8 @@ FanPassClaim.styles = css `
|
|
|
739
1111
|
border-radius: var(--pu-border-base-corner-radius);
|
|
740
1112
|
box-shadow: 4px 4px 20px rgba(0, 0, 0, 0.25);
|
|
741
1113
|
max-width: 800px;
|
|
1114
|
+
height: max-content;
|
|
1115
|
+
|
|
742
1116
|
}
|
|
743
1117
|
}
|
|
744
1118
|
|
|
@@ -746,6 +1120,47 @@ FanPassClaim.styles = css `
|
|
|
746
1120
|
--pu-border-button-corner-radius: var(--pu-border-radius-20, 12px);
|
|
747
1121
|
}
|
|
748
1122
|
|
|
1123
|
+
.button-icon {
|
|
1124
|
+
cursor: pointer;
|
|
1125
|
+
border: none;
|
|
1126
|
+
border-radius: var(
|
|
1127
|
+
--pu-border-icon-corner-radius,
|
|
1128
|
+
var(--pu-border-base-corner-radius, 0)
|
|
1129
|
+
);
|
|
1130
|
+
font-size: var(--pu-font-size-icon, 1.5rem);
|
|
1131
|
+
padding: 0;
|
|
1132
|
+
color: var(--pu-color-icon-text, inherit);
|
|
1133
|
+
background-color: var(--pu-color-icon-background, inherit);
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
@supports (color: rgb(from white r g b)) {
|
|
1137
|
+
.button-icon {
|
|
1138
|
+
color: rgb(
|
|
1139
|
+
from var(--pu-color-icon-text, inherit) r g b / alpha
|
|
1140
|
+
);
|
|
1141
|
+
background-color: rgb(
|
|
1142
|
+
from var(--pu-color-icon-background, inherit) r g b / alpha
|
|
1143
|
+
);
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
.button-icon > * {
|
|
1148
|
+
position: relative;
|
|
1149
|
+
display: block;
|
|
1150
|
+
padding: var(
|
|
1151
|
+
--pu-space-icon-padding,
|
|
1152
|
+
var(--pu-space-padding, 0.5rem)
|
|
1153
|
+
);
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
.button-icon:hover {
|
|
1157
|
+
opacity: 0.7;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
.button-icon[disabled]:hover {
|
|
1161
|
+
opacity: 0.7;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
749
1164
|
.loading__spinner {
|
|
750
1165
|
animation-name: spin;
|
|
751
1166
|
animation-duration: 500ms;
|
|
@@ -777,7 +1192,13 @@ __decorate([
|
|
|
777
1192
|
], FanPassClaim.prototype, "fanPassTitle", void 0);
|
|
778
1193
|
__decorate([
|
|
779
1194
|
property({ type: String })
|
|
780
|
-
], FanPassClaim.prototype, "
|
|
1195
|
+
], FanPassClaim.prototype, "redeemCode", void 0);
|
|
1196
|
+
__decorate([
|
|
1197
|
+
property({ type: Boolean })
|
|
1198
|
+
], FanPassClaim.prototype, "availiblePromotion", void 0);
|
|
1199
|
+
__decorate([
|
|
1200
|
+
property({ type: Number })
|
|
1201
|
+
], FanPassClaim.prototype, "promotionId", void 0);
|
|
781
1202
|
__decorate([
|
|
782
1203
|
property({ type: Boolean })
|
|
783
1204
|
], FanPassClaim.prototype, "modal", void 0);
|
|
@@ -793,6 +1214,9 @@ __decorate([
|
|
|
793
1214
|
__decorate([
|
|
794
1215
|
property({ type: String })
|
|
795
1216
|
], FanPassClaim.prototype, "successUrl", void 0);
|
|
1217
|
+
__decorate([
|
|
1218
|
+
property({ type: String })
|
|
1219
|
+
], FanPassClaim.prototype, "promotionUrl", void 0);
|
|
796
1220
|
__decorate([
|
|
797
1221
|
property({ type: Boolean })
|
|
798
1222
|
], FanPassClaim.prototype, "autoRedirect", void 0);
|
|
@@ -817,6 +1241,9 @@ __decorate([
|
|
|
817
1241
|
__decorate([
|
|
818
1242
|
state()
|
|
819
1243
|
], FanPassClaim.prototype, "_claimState", void 0);
|
|
1244
|
+
__decorate([
|
|
1245
|
+
state()
|
|
1246
|
+
], FanPassClaim.prototype, "_promotionState", void 0);
|
|
820
1247
|
__decorate([
|
|
821
1248
|
state()
|
|
822
1249
|
], FanPassClaim.prototype, "_pageNumber", void 0);
|
|
@@ -828,10 +1255,10 @@ __decorate([
|
|
|
828
1255
|
], FanPassClaim.prototype, "_loginState", void 0);
|
|
829
1256
|
__decorate([
|
|
830
1257
|
state()
|
|
831
|
-
], FanPassClaim.prototype, "
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
], FanPassClaim);
|
|
1258
|
+
], FanPassClaim.prototype, "_codeStatus", void 0);
|
|
1259
|
+
__decorate([
|
|
1260
|
+
query('fp-login')
|
|
1261
|
+
], FanPassClaim.prototype, "_loginComponent", void 0);
|
|
835
1262
|
|
|
836
|
-
export { FanPassClaim };
|
|
1263
|
+
export { FanPassClaim as default };
|
|
837
1264
|
//# sourceMappingURL=fan-pass-claim.js.map
|