@cirkay-eng/cirkay-components 0.9.22-beta.9 → 0.9.23-beta.2
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 +4 -0
- package/dist/base/magic/MagicAPI.js +2 -2
- package/dist/components/connected/connected.js +1 -1
- package/dist/components/connected/index.js +0 -2
- package/dist/components/connected/index.js.map +1 -1
- package/dist/components/error-screen/error-screen.js +1 -1
- package/dist/components/error-screen/index.js +0 -2
- package/dist/components/error-screen/index.js.map +1 -1
- package/dist/components/fan-pass-claim/fan-pass-claim.d.ts +10 -3
- package/dist/components/fan-pass-claim/fan-pass-claim.d.ts.map +1 -1
- package/dist/components/fan-pass-claim/fan-pass-claim.js +177 -61
- package/dist/components/fan-pass-claim/fan-pass-claim.js.map +1 -1
- package/dist/components/fan-pass-claim/fan-pass-claim.styles.d.ts.map +1 -1
- package/dist/components/fan-pass-claim/fan-pass-claim.styles.js +14 -0
- package/dist/components/fan-pass-claim/fan-pass-claim.styles.js.map +1 -1
- package/dist/components/fan-pass-unlock/fan-pass-unlock.d.ts +4 -0
- package/dist/components/fan-pass-unlock/fan-pass-unlock.d.ts.map +1 -1
- package/dist/components/fan-pass-unlock/fan-pass-unlock.js +31 -2
- package/dist/components/fan-pass-unlock/fan-pass-unlock.js.map +1 -1
- package/dist/components/frame/frame.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/login/login.d.ts +1 -0
- package/dist/components/login/login.d.ts.map +1 -1
- package/dist/components/login/login.js +10 -2
- package/dist/components/login/login.js.map +1 -1
- package/dist/components/mobile-pass/mobile-pass.js +1 -1
- package/dist/controllers/LoginController.js +7 -7
- package/dist/docs/fan-pass-claim/fan-pass-claim.stories.d.ts.map +1 -1
- package/dist/node_modules/.pnpm/@magic-sdk_provider@33.4.1_localforage@1.10.0/node_modules/@magic-sdk/provider/dist/es/index.js +10 -0
- package/dist/node_modules/.pnpm/@magic-sdk_provider@33.4.1_localforage@1.10.0/node_modules/@magic-sdk/provider/dist/es/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@magic-sdk_types@27.4.0/node_modules/@magic-sdk/types/dist/es/index.js +4 -0
- package/dist/node_modules/.pnpm/@magic-sdk_types@27.4.0/node_modules/@magic-sdk/types/dist/es/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.58.0_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js +31 -0
- package/dist/node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.58.0_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/node_modules/.pnpm/magic-sdk@33.4.1/node_modules/magic-sdk/dist/es/index.js +9 -0
- package/dist/node_modules/.pnpm/magic-sdk@33.4.1/node_modules/magic-sdk/dist/es/index.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,6 +144,10 @@ A component for claiming Fan Passes.
|
|
|
144
144
|
| debugLogging | Boolean | false | Enable debug logging |
|
|
145
145
|
| btnBackgroundColor | String | '#D60455' | Button background color |
|
|
146
146
|
| btnTextColor | String | '#FFFFFF' | Button text color |
|
|
147
|
+
| crmOptInPrivacyUrl | String | '' | If set, appends a “Privacy Policy” link after `defaultOptInLabel` (implicit line or checkbox label). |
|
|
148
|
+
| defaultOptInLabel | String | '' | Copy for the default Fan Pass opt-in consent. With `requireDefaultOptIn` false, shown as informational text and default opt-in is implied when the user claims. With `requireDefaultOptIn` true, the same copy appears beside the default checkbox (bold); **if empty or whitespace-only**, that checkbox is not shown and that consent is not collected via the built-in control, unless you supply a custom checkbox via the `optin` slot. |
|
|
149
|
+
| extraOptInLabel | String | '' | Label for an optional second (CRM) opt-in checkbox. **If empty, that checkbox is not shown** and the extra opt-in is not collected. |
|
|
150
|
+
| requireDefaultOptIn | Boolean | false | When `true`, the user must check the default opt-in before email submit—**only when the default opt-in checkbox is visible** (non-empty `defaultOptInLabel` or a valid `optin` slot). If the label is blank so no default checkbox is shown, **submit and claim are still allowed** (this flag cannot block the flow when there is no opt-in to complete). |
|
|
147
151
|
|
|
148
152
|
#### Events
|
|
149
153
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Magic as
|
|
1
|
+
import { Magic as $n } from '../../node_modules/.pnpm/magic-sdk@33.4.1/node_modules/magic-sdk/dist/es/index.js';
|
|
2
2
|
import { MAGIC_PROD_API, MAGIC_STAGE_API } from '../../constants/apis.js';
|
|
3
3
|
import { Environment } from '../n3xus/types.js';
|
|
4
4
|
|
|
@@ -17,7 +17,7 @@ const MagicAPI = (_options = {
|
|
|
17
17
|
useStorageCache: true,
|
|
18
18
|
deferPreload: true,
|
|
19
19
|
};
|
|
20
|
-
const magicApi = new
|
|
20
|
+
const magicApi = new $n(magicApiKey, magicConfig);
|
|
21
21
|
return magicApi;
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.
|
|
1
|
+
import { __decorate } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.58.0_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
3
|
import { property } from 'lit/decorators/property.js';
|
|
4
4
|
import '@pushengineering/push-web-components/text';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/connected/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/connected/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.
|
|
1
|
+
import { __decorate } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.58.0_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
3
|
import { property } from 'lit/decorators/property.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/error-screen/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,WAAW,CAAC,MAAM,CAAC,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/error-screen/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA,WAAW,CAAC,MAAM,CAAC,iBAAiB,CAAC"}
|
|
@@ -22,6 +22,8 @@ import { Environment } from '../../base/n3xus/types';
|
|
|
22
22
|
import { LogoSet } from '../../utils/helpers';
|
|
23
23
|
export default class FanPassClaim extends CirkayElement {
|
|
24
24
|
static styles: CSSResultGroup;
|
|
25
|
+
private readonly walletCheckMaxRetries;
|
|
26
|
+
private readonly walletCheckInitialRetryDelayMs;
|
|
25
27
|
private loginController;
|
|
26
28
|
private n3xusApiConfig;
|
|
27
29
|
private n3xusAPIController;
|
|
@@ -60,12 +62,9 @@ export default class FanPassClaim extends CirkayElement {
|
|
|
60
62
|
claimSuccessPerkButtonText: string;
|
|
61
63
|
connectedText: string;
|
|
62
64
|
faqUrl: string;
|
|
63
|
-
crmOptInDisclaimer: string;
|
|
64
|
-
crmOptInCta: string;
|
|
65
65
|
crmOptInPrivacyUrl: string;
|
|
66
66
|
defaultOptInLabel: string;
|
|
67
67
|
extraOptInLabel: string;
|
|
68
|
-
extraOptInCta: string;
|
|
69
68
|
requireDefaultOptIn: boolean;
|
|
70
69
|
_claimState: ClaimStateTypes;
|
|
71
70
|
_defaultOptIn: boolean;
|
|
@@ -73,6 +72,7 @@ export default class FanPassClaim extends CirkayElement {
|
|
|
73
72
|
_useDefaultOptInSlotOverride: boolean;
|
|
74
73
|
private _slottedDefaultOptInCheckbox;
|
|
75
74
|
private _slottedDefaultOptInCheckboxChangeBound;
|
|
75
|
+
private get _emailSubmitSuppressedForDefaultOptIn();
|
|
76
76
|
_campaignState: CampaignState;
|
|
77
77
|
_pageNumber: number;
|
|
78
78
|
_user: FanPassUser | undefined;
|
|
@@ -100,11 +100,15 @@ export default class FanPassClaim extends CirkayElement {
|
|
|
100
100
|
private checkSessionStatus;
|
|
101
101
|
private startPolling;
|
|
102
102
|
private stopPolling;
|
|
103
|
+
private delay;
|
|
104
|
+
private checkWalletForNftWithRetry;
|
|
103
105
|
private setCodeStatus;
|
|
104
106
|
private getCampaignInformation;
|
|
105
107
|
private setCampaignStatus;
|
|
108
|
+
private _renderDefaultOptInLinkedCopy;
|
|
106
109
|
private parseOptInValue;
|
|
107
110
|
private resolveClaimOptIns;
|
|
111
|
+
private resolveAndPersistClaimOptIns;
|
|
108
112
|
private handleClaim;
|
|
109
113
|
private unlockedContentEmit;
|
|
110
114
|
private setSessionToken;
|
|
@@ -122,6 +126,9 @@ export default class FanPassClaim extends CirkayElement {
|
|
|
122
126
|
private renderContent;
|
|
123
127
|
private renderClaimButton;
|
|
124
128
|
private getConnectedDisplayText;
|
|
129
|
+
private isModalConnectedBlockVisible;
|
|
130
|
+
private shouldShowClaimInsideConnectedBox;
|
|
131
|
+
private shouldShowModalClaimOutsideConnected;
|
|
125
132
|
render(): TemplateResult;
|
|
126
133
|
}
|
|
127
134
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fan-pass-claim.d.ts","sourceRoot":"","sources":["../../../src/components/fan-pass-claim/fan-pass-claim.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"fan-pass-claim.d.ts","sourceRoot":"","sources":["../../../src/components/fan-pass-claim/fan-pass-claim.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,MAAM,KAAK,C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,KAAK,GAAG,IAAW,GAAG,IAAI;IAUhD,OAAO,CAAC,0BAA0B;IAMlC,OAAO,CAAC,oBAAoB,CAU3B;IAQD,OAAO,CAAC,OAAO;IAMf,OAAO,CAAC,gBAAgB;IA+CxB,OAAO,CAAC,kBAAkB;IAqD1B,OAAO,CAAC,wBAAwB;IAgDhC,OAAO,CAAC,aAAa;IAoDrB,OAAO,CAAC,aAAa;IA0ZrB,OAAO,CAAC,iBAAiB;IAyFzB,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,4BAA4B;IAapC,OAAO,CAAC,iCAAiC;IAQzC,OAAO,CAAC,oCAAoC;IAcrC,MAAM,IAAI,cAAc;CA6IlC;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,gBAAgB,EAAE,YAAY,CAAA;KACjC;CACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { __decorate } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.
|
|
2
|
-
import { html } from 'lit';
|
|
1
|
+
import { __decorate } from '../../node_modules/.pnpm/@rollup_plugin-typescript@12.3.0_rollup@4.58.0_tslib@2.8.1_typescript@5.9.3/node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { nothing, html } from 'lit';
|
|
3
3
|
import { loginShadowParts, frameShadowParts, connectedShadowParts } from '../../constants/shadow-parts.js';
|
|
4
4
|
import { property, query } from 'lit/decorators.js';
|
|
5
5
|
import { state } from 'lit/decorators/state.js';
|
|
@@ -30,8 +30,17 @@ class FanPassClaim extends CirkayElement {
|
|
|
30
30
|
const expectedSuffix = `${this.apiKey}-${this.campaignId}`;
|
|
31
31
|
return callerId.endsWith(expectedSuffix);
|
|
32
32
|
}
|
|
33
|
+
get _emailSubmitSuppressedForDefaultOptIn() {
|
|
34
|
+
const defaultOptInCheckboxShown = this.requireDefaultOptIn &&
|
|
35
|
+
(this._useDefaultOptInSlotOverride || this.defaultOptInLabel.trim().length > 0);
|
|
36
|
+
return (this.requireDefaultOptIn &&
|
|
37
|
+
!this._defaultOptIn &&
|
|
38
|
+
defaultOptInCheckboxShown);
|
|
39
|
+
}
|
|
33
40
|
constructor() {
|
|
34
41
|
super();
|
|
42
|
+
this.walletCheckMaxRetries = 2;
|
|
43
|
+
this.walletCheckInitialRetryDelayMs = 1500;
|
|
35
44
|
this.loginController = null;
|
|
36
45
|
this.n3xusApiConfig = undefined;
|
|
37
46
|
this.n3xusAPIController = null;
|
|
@@ -80,12 +89,9 @@ class FanPassClaim extends CirkayElement {
|
|
|
80
89
|
this.claimSuccessPerkButtonText = 'Check out your perks!';
|
|
81
90
|
this.connectedText = 'Connected';
|
|
82
91
|
this.faqUrl = 'https://cirkay.com/faq/';
|
|
83
|
-
this.crmOptInDisclaimer = 'By claiming your Fan Pass you will receive email updates about perks.';
|
|
84
|
-
this.crmOptInCta = "I'd like to receive updates and offers";
|
|
85
92
|
this.crmOptInPrivacyUrl = '';
|
|
86
|
-
this.defaultOptInLabel = '
|
|
93
|
+
this.defaultOptInLabel = '';
|
|
87
94
|
this.extraOptInLabel = '';
|
|
88
|
-
this.extraOptInCta = '';
|
|
89
95
|
this.requireDefaultOptIn = false;
|
|
90
96
|
this._claimState = ClaimStateTypes.validating;
|
|
91
97
|
this._defaultOptIn = false;
|
|
@@ -156,7 +162,15 @@ class FanPassClaim extends CirkayElement {
|
|
|
156
162
|
if (!slot)
|
|
157
163
|
return [];
|
|
158
164
|
const assigned = slot.assignedElements({ flatten: true });
|
|
159
|
-
|
|
165
|
+
const checkboxes = [];
|
|
166
|
+
for (const element of assigned) {
|
|
167
|
+
if (FanPassClaim._isValidDefaultOptInCheckbox(element)) {
|
|
168
|
+
checkboxes.push(element);
|
|
169
|
+
}
|
|
170
|
+
const nestedCheckboxes = Array.from(element.querySelectorAll('input[type="checkbox"]')).filter(FanPassClaim._isValidDefaultOptInCheckbox);
|
|
171
|
+
checkboxes.push(...nestedCheckboxes);
|
|
172
|
+
}
|
|
173
|
+
return checkboxes;
|
|
160
174
|
}
|
|
161
175
|
_unbindSlottedDefaultOptInCheckbox() {
|
|
162
176
|
if (this._slottedDefaultOptInCheckbox && this._slottedDefaultOptInCheckboxChangeBound) {
|
|
@@ -205,6 +219,9 @@ class FanPassClaim extends CirkayElement {
|
|
|
205
219
|
}
|
|
206
220
|
updated(changedProperties) {
|
|
207
221
|
super.updated?.(changedProperties);
|
|
222
|
+
if (changedProperties.has('requireDefaultOptIn') && this.requireDefaultOptIn) {
|
|
223
|
+
this._onDefaultOptInSlotChange();
|
|
224
|
+
}
|
|
208
225
|
if (this._useDefaultOptInSlotOverride &&
|
|
209
226
|
this._slottedDefaultOptInCheckbox &&
|
|
210
227
|
changedProperties.has('_defaultOptIn')) {
|
|
@@ -319,6 +336,10 @@ class FanPassClaim extends CirkayElement {
|
|
|
319
336
|
}
|
|
320
337
|
willUpdate(changedProperties) {
|
|
321
338
|
try {
|
|
339
|
+
if (changedProperties.has('requireDefaultOptIn') && !this.requireDefaultOptIn) {
|
|
340
|
+
this._unbindSlottedDefaultOptInCheckbox();
|
|
341
|
+
this._useDefaultOptInSlotOverride = false;
|
|
342
|
+
}
|
|
322
343
|
if (changedProperties.has('apiKey')) {
|
|
323
344
|
this.n3xusApiConfig = {
|
|
324
345
|
apiKey: this.apiKey,
|
|
@@ -852,6 +873,42 @@ class FanPassClaim extends CirkayElement {
|
|
|
852
873
|
this.interval = null;
|
|
853
874
|
}
|
|
854
875
|
}
|
|
876
|
+
delay(ms) {
|
|
877
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
878
|
+
}
|
|
879
|
+
async checkWalletForNftWithRetry(didToken, bypassCache = false) {
|
|
880
|
+
let delayMs = this.walletCheckInitialRetryDelayMs;
|
|
881
|
+
for (let attempt = 0; attempt <= this.walletCheckMaxRetries; attempt++) {
|
|
882
|
+
try {
|
|
883
|
+
if (!this.n3xusAPIController) {
|
|
884
|
+
console.error('N3xus API is not initialized');
|
|
885
|
+
return null;
|
|
886
|
+
}
|
|
887
|
+
const response = await this.n3xusAPIController.checkWalletForNft(this.n3xusApiConfig, '', didToken, bypassCache);
|
|
888
|
+
if (response?.ok) {
|
|
889
|
+
return response;
|
|
890
|
+
}
|
|
891
|
+
const isFinalAttempt = attempt === this.walletCheckMaxRetries;
|
|
892
|
+
if (isFinalAttempt) {
|
|
893
|
+
return response ?? null;
|
|
894
|
+
}
|
|
895
|
+
console.warn(`Claim wallet check returned non-ok response (attempt ${attempt + 1}/${this.walletCheckMaxRetries + 1}). Retrying in ${delayMs}ms...`, response);
|
|
896
|
+
await this.delay(delayMs);
|
|
897
|
+
delayMs *= 2;
|
|
898
|
+
}
|
|
899
|
+
catch (error) {
|
|
900
|
+
const isFinalAttempt = attempt === this.walletCheckMaxRetries;
|
|
901
|
+
if (isFinalAttempt) {
|
|
902
|
+
console.error('Check wallet for NFT failed after retries', error);
|
|
903
|
+
return null;
|
|
904
|
+
}
|
|
905
|
+
console.warn(`Claim wallet check failed (attempt ${attempt + 1}/${this.walletCheckMaxRetries + 1}). Retrying in ${delayMs}ms...`, error);
|
|
906
|
+
await this.delay(delayMs);
|
|
907
|
+
delayMs *= 2;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
return null;
|
|
911
|
+
}
|
|
855
912
|
async setCodeStatus(issueId = null, redeemCode = null) {
|
|
856
913
|
if (!this.n3xusAPIController) {
|
|
857
914
|
throw new Error('Nexus API is not initialized');
|
|
@@ -972,6 +1029,17 @@ class FanPassClaim extends CirkayElement {
|
|
|
972
1029
|
this.availibleCampaign = true;
|
|
973
1030
|
}
|
|
974
1031
|
}
|
|
1032
|
+
_renderDefaultOptInLinkedCopy(layout = 'block') {
|
|
1033
|
+
const label = this.defaultOptInLabel.trim();
|
|
1034
|
+
if (!label) {
|
|
1035
|
+
return nothing;
|
|
1036
|
+
}
|
|
1037
|
+
if (this.crmOptInPrivacyUrl) {
|
|
1038
|
+
const gap = layout === 'block' ? html `<br />` : html ` `;
|
|
1039
|
+
return html `${label}${gap}<a href="${this.crmOptInPrivacyUrl}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`;
|
|
1040
|
+
}
|
|
1041
|
+
return html `${label}`;
|
|
1042
|
+
}
|
|
975
1043
|
parseOptInValue(value) {
|
|
976
1044
|
if (typeof value === 'boolean') {
|
|
977
1045
|
return value;
|
|
@@ -984,13 +1052,31 @@ class FanPassClaim extends CirkayElement {
|
|
|
984
1052
|
}
|
|
985
1053
|
resolveClaimOptIns() {
|
|
986
1054
|
const optinDetails = (this.loginController?.optinDetails ?? {});
|
|
987
|
-
const defaultOptIn = this.
|
|
988
|
-
|
|
1055
|
+
const defaultOptIn = !this.requireDefaultOptIn
|
|
1056
|
+
? true
|
|
1057
|
+
: optinDetails.defaultOptIn !== undefined && optinDetails.defaultOptIn !== null
|
|
1058
|
+
? this.parseOptInValue(optinDetails.defaultOptIn)
|
|
1059
|
+
: this._defaultOptIn;
|
|
1060
|
+
const extraOptIn = optinDetails.extraOptIn !== undefined && optinDetails.extraOptIn !== null
|
|
1061
|
+
? this.parseOptInValue(optinDetails.extraOptIn)
|
|
1062
|
+
: this._extraCrmOptIn;
|
|
989
1063
|
return {
|
|
990
1064
|
defaultOptIn,
|
|
991
1065
|
extraOptIn,
|
|
992
1066
|
};
|
|
993
1067
|
}
|
|
1068
|
+
resolveAndPersistClaimOptIns() {
|
|
1069
|
+
const { defaultOptIn, extraOptIn } = this.resolveClaimOptIns();
|
|
1070
|
+
const existing = (this.loginController?.optinDetails ?? {});
|
|
1071
|
+
this.loginController?.setOptinDetails({
|
|
1072
|
+
...existing,
|
|
1073
|
+
defaultOptIn: String(defaultOptIn),
|
|
1074
|
+
extraOptIn: String(extraOptIn),
|
|
1075
|
+
default_opt_in: String(defaultOptIn),
|
|
1076
|
+
extra_opt_in: String(extraOptIn),
|
|
1077
|
+
});
|
|
1078
|
+
return { defaultOptIn, extraOptIn };
|
|
1079
|
+
}
|
|
994
1080
|
async handleClaim() {
|
|
995
1081
|
this._claimState = ClaimStateTypes.minting;
|
|
996
1082
|
let didToken = this.loginController?.user?.did?.token;
|
|
@@ -998,7 +1084,7 @@ class FanPassClaim extends CirkayElement {
|
|
|
998
1084
|
await this.loginController?.getDidToken();
|
|
999
1085
|
didToken = this.loginController?.user?.did?.token;
|
|
1000
1086
|
}
|
|
1001
|
-
const { defaultOptIn, extraOptIn } = this.
|
|
1087
|
+
const { defaultOptIn, extraOptIn } = this.resolveAndPersistClaimOptIns();
|
|
1002
1088
|
try {
|
|
1003
1089
|
this.emit(ClaimEvents.Claiming, {
|
|
1004
1090
|
bubbles: true,
|
|
@@ -1087,7 +1173,7 @@ class FanPassClaim extends CirkayElement {
|
|
|
1087
1173
|
return null;
|
|
1088
1174
|
}
|
|
1089
1175
|
await this.loginController?.getDidToken();
|
|
1090
|
-
this.walletCheckResponse = await this.
|
|
1176
|
+
this.walletCheckResponse = await this.checkWalletForNftWithRetry(this.loginController.user.did.token, bypassCache);
|
|
1091
1177
|
if (!this.walletCheckResponse?.ok) {
|
|
1092
1178
|
console.error('Check wallet for NFT failed');
|
|
1093
1179
|
return null;
|
|
@@ -1459,7 +1545,7 @@ class FanPassClaim extends CirkayElement {
|
|
|
1459
1545
|
variant="bodyMd"
|
|
1460
1546
|
withoutMargin
|
|
1461
1547
|
>
|
|
1462
|
-
Claim to this
|
|
1548
|
+
Claim to this email
|
|
1463
1549
|
</pu-text>
|
|
1464
1550
|
</pu-button>
|
|
1465
1551
|
<pu-button
|
|
@@ -1478,7 +1564,7 @@ class FanPassClaim extends CirkayElement {
|
|
|
1478
1564
|
variant="bodyMd"
|
|
1479
1565
|
withoutMargin
|
|
1480
1566
|
>
|
|
1481
|
-
Change
|
|
1567
|
+
Change email
|
|
1482
1568
|
</pu-text>
|
|
1483
1569
|
</pu-button>
|
|
1484
1570
|
</pu-vertical-stack>
|
|
@@ -1514,54 +1600,65 @@ class FanPassClaim extends CirkayElement {
|
|
|
1514
1600
|
environment=${this.environment}
|
|
1515
1601
|
?debugLogging=${this.debugLogging}
|
|
1516
1602
|
?showLoaderAfterLogin=${true}
|
|
1603
|
+
?emailSubmitSuppressed=${this._emailSubmitSuppressedForDefaultOptIn}
|
|
1517
1604
|
exportparts="${loginShadowParts}"
|
|
1518
1605
|
>
|
|
1519
|
-
<div slot="form-content-before-submit">
|
|
1606
|
+
<div class="form-before-submit-wrapper" slot="form-content-before-submit">
|
|
1520
1607
|
<slot name="form-content-claim-before-submit"></slot>
|
|
1521
1608
|
</div>
|
|
1522
1609
|
<form part="form-content" slot="form-content">
|
|
1523
1610
|
<slot name="form-content-claim"></slot>
|
|
1524
1611
|
<div class="fanpass-claim-opt-in-block">
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
${this._useDefaultOptInSlotOverride
|
|
1531
|
-
? html
|
|
1612
|
+
${!this.requireDefaultOptIn && this.defaultOptInLabel.trim()
|
|
1613
|
+
? html `<p class="fanpass-claim-disclaimer" part="claim-disclaimer">
|
|
1614
|
+
${this._renderDefaultOptInLinkedCopy()}
|
|
1615
|
+
</p>`
|
|
1616
|
+
: nothing}
|
|
1617
|
+
${this.requireDefaultOptIn && this._useDefaultOptInSlotOverride
|
|
1618
|
+
? html `
|
|
1619
|
+
${this.defaultOptInLabel.trim()
|
|
1620
|
+
? html `<p class="fanpass-claim-disclaimer" part="claim-disclaimer">
|
|
1621
|
+
${this._renderDefaultOptInLinkedCopy()}
|
|
1622
|
+
</p>`
|
|
1623
|
+
: nothing}
|
|
1624
|
+
<slot name="optin" @slotchange=${this._onDefaultOptInSlotChange}></slot>
|
|
1625
|
+
`
|
|
1532
1626
|
: html `
|
|
1627
|
+
${this.requireDefaultOptIn && this.defaultOptInLabel.trim()
|
|
1628
|
+
? html `
|
|
1533
1629
|
<label class="fanpass-opt-in-label" part="opt-in-label">
|
|
1534
1630
|
<input
|
|
1535
1631
|
type="checkbox"
|
|
1536
|
-
name="
|
|
1632
|
+
name="defaultOptIn"
|
|
1537
1633
|
form="emailInputForm"
|
|
1538
|
-
?required=${this.requireDefaultOptIn}
|
|
1539
1634
|
.checked=${this._defaultOptIn}
|
|
1540
1635
|
@change=${(e) => { this._defaultOptIn = e.target.checked; }}
|
|
1541
1636
|
/>
|
|
1542
|
-
<span class="fanpass-opt-in-text" part="opt-in-text">${this.
|
|
1637
|
+
<span class="fanpass-opt-in-text" part="opt-in-text">${this._renderDefaultOptInLinkedCopy('inline')}</span>
|
|
1543
1638
|
</label>
|
|
1639
|
+
`
|
|
1640
|
+
: ''}
|
|
1641
|
+
|
|
1642
|
+
${this.extraOptInLabel
|
|
1643
|
+
? html `
|
|
1544
1644
|
<label class="fanpass-opt-in-label" part="opt-in-label">
|
|
1545
1645
|
<input
|
|
1546
1646
|
type="checkbox"
|
|
1547
|
-
name="
|
|
1647
|
+
name="extraOptIn"
|
|
1548
1648
|
form="emailInputForm"
|
|
1549
1649
|
.checked=${this._extraCrmOptIn}
|
|
1550
1650
|
@change=${(e) => { this._extraCrmOptIn = e.target.checked; }}
|
|
1551
1651
|
/>
|
|
1552
|
-
<span class="fanpass-opt-in-text" part="opt-in-text">
|
|
1553
|
-
${this.extraOptInLabel || this.crmOptInCta}${this.crmOptInPrivacyUrl
|
|
1554
|
-
? html ` <a href="${this.crmOptInPrivacyUrl}" target="_blank" rel="noopener noreferrer">Privacy Policy</a>`
|
|
1555
|
-
: ''}
|
|
1556
|
-
</span>
|
|
1652
|
+
<span class="fanpass-opt-in-text" part="opt-in-text">${this.extraOptInLabel}</span>
|
|
1557
1653
|
</label>
|
|
1558
|
-
|
|
1559
|
-
? html `<p class="fanpass-claim-disclaimer" part="claim-disclaimer">${this.extraOptInCta}</p>`
|
|
1654
|
+
`
|
|
1560
1655
|
: ''}
|
|
1561
|
-
|
|
1656
|
+
${this.requireDefaultOptIn
|
|
1657
|
+
? html `<div class="fanpass-opt-in-slot-hidden" aria-hidden="true">
|
|
1562
1658
|
<slot name="optin" @slotchange=${this._onDefaultOptInSlotChange}></slot>
|
|
1563
|
-
</div
|
|
1564
|
-
|
|
1659
|
+
</div>`
|
|
1660
|
+
: ''}
|
|
1661
|
+
`}
|
|
1565
1662
|
</div>
|
|
1566
1663
|
</form>
|
|
1567
1664
|
</fp-login>
|
|
@@ -1829,11 +1926,26 @@ class FanPassClaim extends CirkayElement {
|
|
|
1829
1926
|
}
|
|
1830
1927
|
return this.connectedText;
|
|
1831
1928
|
}
|
|
1929
|
+
isModalConnectedBlockVisible() {
|
|
1930
|
+
return !!(this.walletCheckResponse &&
|
|
1931
|
+
this.loginController?.loggedIn &&
|
|
1932
|
+
!this.hideConnected);
|
|
1933
|
+
}
|
|
1934
|
+
shouldShowClaimInsideConnectedBox() {
|
|
1935
|
+
return (this.isModalConnectedBlockVisible() &&
|
|
1936
|
+
this.walletCheckResponse?.data?.holds !== true);
|
|
1937
|
+
}
|
|
1938
|
+
shouldShowModalClaimOutsideConnected() {
|
|
1939
|
+
return !this.isModalConnectedBlockVisible();
|
|
1940
|
+
}
|
|
1832
1941
|
render() {
|
|
1833
1942
|
this.logging('render', 'claimState', this._claimState);
|
|
1834
1943
|
if (this.modal) {
|
|
1835
1944
|
return html `
|
|
1836
|
-
${this.
|
|
1945
|
+
${this.shouldShowModalClaimOutsideConnected()
|
|
1946
|
+
? this.renderClaimButton()
|
|
1947
|
+
: html ``}
|
|
1948
|
+
${this.isModalConnectedBlockVisible()
|
|
1837
1949
|
? html `
|
|
1838
1950
|
<fp-connected
|
|
1839
1951
|
part="connected-block"
|
|
@@ -1849,25 +1961,38 @@ class FanPassClaim extends CirkayElement {
|
|
|
1849
1961
|
? true
|
|
1850
1962
|
: false}
|
|
1851
1963
|
>
|
|
1852
|
-
${this.
|
|
1964
|
+
${this.shouldShowClaimInsideConnectedBox()
|
|
1853
1965
|
? html `
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1966
|
+
<div
|
|
1967
|
+
part="inner-content"
|
|
1968
|
+
slot="inner-content"
|
|
1969
|
+
class="connected-claim-button-wrap"
|
|
1970
|
+
>
|
|
1971
|
+
${this.renderClaimButton()}
|
|
1972
|
+
</div>
|
|
1973
|
+
`
|
|
1974
|
+
: html ``}
|
|
1975
|
+
<pu-button
|
|
1976
|
+
slot="popover-actions"
|
|
1977
|
+
@click=${this.handleOpenModalFromPopover}
|
|
1978
|
+
type="button"
|
|
1979
|
+
size="small"
|
|
1980
|
+
variant="plain"
|
|
1981
|
+
fullWidth
|
|
1982
|
+
>
|
|
1983
|
+
<pu-text
|
|
1984
|
+
as="span"
|
|
1985
|
+
variant="bodyMd"
|
|
1986
|
+
fontWeight="regular"
|
|
1987
|
+
withoutMargin
|
|
1988
|
+
spacing="loose"
|
|
1989
|
+
>
|
|
1990
|
+
See more
|
|
1991
|
+
</pu-text>
|
|
1992
|
+
</pu-button>
|
|
1868
1993
|
</fp-connected>
|
|
1869
1994
|
`
|
|
1870
|
-
: html
|
|
1995
|
+
: html ``}
|
|
1871
1996
|
|
|
1872
1997
|
<pu-overlay id="fb-modal" class="fb-modal" part="overlay-container" exportparts="base,close,content">
|
|
1873
1998
|
<pu-box
|
|
@@ -2037,12 +2162,6 @@ __decorate([
|
|
|
2037
2162
|
__decorate([
|
|
2038
2163
|
property({ type: String })
|
|
2039
2164
|
], FanPassClaim.prototype, "faqUrl", void 0);
|
|
2040
|
-
__decorate([
|
|
2041
|
-
property({ type: String })
|
|
2042
|
-
], FanPassClaim.prototype, "crmOptInDisclaimer", void 0);
|
|
2043
|
-
__decorate([
|
|
2044
|
-
property({ type: String })
|
|
2045
|
-
], FanPassClaim.prototype, "crmOptInCta", void 0);
|
|
2046
2165
|
__decorate([
|
|
2047
2166
|
property({ type: String })
|
|
2048
2167
|
], FanPassClaim.prototype, "crmOptInPrivacyUrl", void 0);
|
|
@@ -2052,9 +2171,6 @@ __decorate([
|
|
|
2052
2171
|
__decorate([
|
|
2053
2172
|
property({ type: String })
|
|
2054
2173
|
], FanPassClaim.prototype, "extraOptInLabel", void 0);
|
|
2055
|
-
__decorate([
|
|
2056
|
-
property({ type: String })
|
|
2057
|
-
], FanPassClaim.prototype, "extraOptInCta", void 0);
|
|
2058
2174
|
__decorate([
|
|
2059
2175
|
property({ type: Boolean })
|
|
2060
2176
|
], FanPassClaim.prototype, "requireDefaultOptIn", void 0);
|