@namiml/web-sdk 3.5.0-dev.202610312243 → 3.5.0-dev.202611011549
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/components/elements/ProgressIndicator.d.ts +5 -0
- package/dist/nami-web.cjs +17 -7
- package/dist/nami-web.d.ts +6 -1
- package/dist/nami-web.mjs +44 -34
- package/dist/nami-web.umd.js +44 -34
- package/package.json +2 -2
|
@@ -13,6 +13,11 @@ export declare class NamiProgressIndicator extends NamiElement {
|
|
|
13
13
|
firstUpdated(changedProperties: any): void;
|
|
14
14
|
updated(changedProperties: any): void;
|
|
15
15
|
protected styles(): CSSResult;
|
|
16
|
+
private stepFill;
|
|
17
|
+
private stepRadius;
|
|
18
|
+
private stepShadow;
|
|
19
|
+
private stepSize;
|
|
20
|
+
private renderSteps;
|
|
16
21
|
private getProgressPercentage;
|
|
17
22
|
private animateProgress;
|
|
18
23
|
render(): TemplateResult;
|
package/dist/nami-web.cjs
CHANGED
|
@@ -563,7 +563,17 @@
|
|
|
563
563
|
<div class="radio-button-wrapper ${0}">
|
|
564
564
|
<div class="radio-button-inner"></div>
|
|
565
565
|
</div>
|
|
566
|
-
`),e)}}])}();Ae([ot({type:Object})],HO.prototype,"component",void 0),Ae([ot({type:Boolean})],HO.prototype,"inFocusedState",void 0),Ae([ot({type:Number})],HO.prototype,"scaleFactor",void 0),HO=Ae([Fe("nami-radio-button")],HO);var GO,VO=e=>e,
|
|
566
|
+
`),e)}}])}();Ae([ot({type:Object})],HO.prototype,"component",void 0),Ae([ot({type:Boolean})],HO.prototype,"inFocusedState",void 0),Ae([ot({type:Number})],HO.prototype,"scaleFactor",void 0),HO=Ae([Fe("nami-radio-button")],HO);var GO,VO,KO,XO,YO=e=>e,qO=e._internal.NamiFlowManager,JO={left:"flex-start",center:"center",right:"flex-end"},QO=function(){function i(){var e;return u(this,i),(e=s(this,i,arguments)).scaleFactor=1,e.inFocusedState=!1,e.currentWidth=0,e.hasInitialized=!1,e}return y(i,Ts),m(i,[{key:"connectedCallback",value:function(){M(i,"connectedCallback",this)([]),e.validateMinSDKVersion(this.minSDKVersion,"ProgressIndicator")}},{key:"firstUpdated",value:function(t){var n;M(i,"firstUpdated",this)([t]),e.isStepsStyle(this.component)||(this.currentWidth=100*qO.getLastAnimatedFlowProgress((null===(n=this.component)||void 0===n?void 0:n.id)||"default"),this.hasInitialized=!0,this.animateProgress(!0))}},{key:"updated",value:function(t){M(i,"updated",this)([t]),this.hasInitialized&&!e.isStepsStyle(this.component)&&this.animateProgress(!1)}},{key:"styles",value:function(){var e=this.component,i=this.scaleFactor,n=this.inFocusedState,a=e.inactiveFillColor,r=e.inactiveFillColorFallback,o=e.inactiveBorderRadius,s=e.activeFillColor,u=e.activeFillColorFallback,l=e.activeBorderRadius,d=e.innerPadding,h=void 0===d?0:d,c=e.activeDropShadow,m=e.inactiveDropShadow;return t.unsafeCSS(`\n :host {\n display: ${e.hidden?"none":"block"};\n ${iu(e,i,n)}\n }\n \n .progress-container {\n ${Xs(e,i)} \n background: ${a||r};\n border-radius: ${o||0}px;\n overflow: hidden;\n position: relative;\n padding: ${h*i}px;\n box-sizing: border-box;\n ${Js(m)}\n }\n \n .progress-bar {\n height: 100%;\n background: ${s||u};\n border-radius: ${l||0}px;\n box-sizing: border-box;\n transition: width 0.8s ease-in-out;\n ${Js(c)}\n }\n\n .steps {\n display: flex;\n flex-direction: row;\n align-items: stretch;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n }\n\n .step {\n height: 100%;\n box-sizing: border-box;\n transition: background 0.4s, width 0.4s;\n }\n\n .steps--even .step {\n flex: 1 1 0;\n }\n\n .steps:not(.steps--even) .step {\n flex: 0 0 auto;\n }\n `)}},{key:"stepFill",value:function(t){var i=this.component;return"current"===t?e.firstSet(i.currentFillColor,i.currentFillColorFallback,i.activeFillColor,i.activeFillColorFallback):"active"===t?e.firstSet(i.activeFillColor,i.activeFillColorFallback):e.firstSet(i.inactiveFillColor,i.inactiveFillColorFallback)}},{key:"stepRadius",value:function(t){var i=this.component,n=eu("current"===t?e.firstSet(i.currentBorderRadius,i.activeBorderRadius):"active"===t?i.activeBorderRadius:i.inactiveBorderRadius);return Number.isFinite(n)?n:0}},{key:"stepShadow",value:function(t){var i=this.component;return"current"===t?e.firstSet(i.currentDropShadow,i.activeDropShadow):"active"===t?i.activeDropShadow:i.inactiveDropShadow}},{key:"stepSize",value:function(e){for(var t=this.component,i=0,n=["current"===e?t.currentSize:"active"===e?t.activeSize:t.inactiveSize,t.inactiveSize,t.activeSize,t.height];i<n.length;i++){var a=eu(n[i]);if(Number.isFinite(a))return Math.max(0,a)}return 0}},{key:"renderSteps",value:function(){var i=this.component,n=this.scaleFactor,a=qO.getTotalFlowSteps(),r=qO.getCurrentFlowStepIndex(),o=Math.max(0,e.resolveStepCount(i.stepCount,a)),s=e.resolveCurrentStep(i.currentStep,r),u="fixed"===e.resolveStepSizing(i.stepSizing),l=eu(i.indicatorSpacing),d=`gap: ${Rs(n,Number.isFinite(l)?Math.max(0,l):0)}px;${u?` justify-content: ${JO[e.resolveStepAlignment(i.alignment)]};`:""}`,h=Math.min(o,Math.max(0,s)),c=Array.from({length:o},(a,r)=>{var o=e.stepSegmentState(r+1,s,i.fillMode),l=this.stepFill(o),d=[l?`background: ${l};`:"",`border-radius: ${Rs(n,this.stepRadius(o))}px;`,u?`width: ${Rs(n,this.stepSize(o))}px;`:"",Js(this.stepShadow(o)).trim()].filter(Boolean).join(" ");return t.html(GO||(GO=YO`<div class="step step--${0}" style="${0}"></div>`),o,d)});return 0===o?t.html(VO||(VO=YO`<div class="steps${0}" style="${0}" aria-hidden="true"></div>`),u?"":" steps--even",d):t.html(KO||(KO=YO`
|
|
567
|
+
<div
|
|
568
|
+
class="steps${0}"
|
|
569
|
+
style="${0}"
|
|
570
|
+
role="progressbar"
|
|
571
|
+
aria-valuemin="0"
|
|
572
|
+
aria-valuemax="${0}"
|
|
573
|
+
aria-valuenow="${0}"
|
|
574
|
+
aria-valuetext="Step ${0} of ${0}"
|
|
575
|
+
>${0}</div>
|
|
576
|
+
`),u?"":" steps--even",d,o,h,h,o,c)}},{key:"getProgressPercentage",value:function(){var e,t=null!==(e=this.component.percentage)&&void 0!==e?e:0;return"auto"===t&&(t=qO.getCurrentFlowProgress(this.component.id)),Math.min(100,Math.max(0,100*Number(t)))}},{key:"animateProgress",value:function(e){var t=this.component,i=t.id,n=t.percentage,a=this.getProgressPercentage();if(this.currentWidth!==a){var r=()=>{this.currentWidth=a,"auto"===n&&qO.setLastAnimatedFlowProgress(i||"default",a/100)};e?requestAnimationFrame(()=>requestAnimationFrame(r)):requestAnimationFrame(r)}}},{key:"render",value:function(){return e.isStepsStyle(this.component)?this.renderSteps():t.html(XO||(XO=YO`
|
|
567
577
|
<div class="progress-container">
|
|
568
578
|
<div
|
|
569
579
|
class="progress-bar"
|
|
@@ -574,20 +584,20 @@
|
|
|
574
584
|
aria-valuemax="100"
|
|
575
585
|
></div>
|
|
576
586
|
</div>
|
|
577
|
-
`),this.currentWidth,Math.round(this.currentWidth))}}])}();Ae([ot({type:Object})],XO.prototype,"component",void 0),Ae([ot({type:Number})],XO.prototype,"scaleFactor",void 0),Ae([ot({type:Boolean})],XO.prototype,"inFocusedState",void 0),Ae([ot({type:Object})],XO.prototype,"minSDKVersion",void 0),Ae([ot({type:Number})],XO.prototype,"currentWidth",void 0),XO=Ae([Fe("nami-progress-indicator")],XO);var YO=function(){function i(){var e;return u(this,i),(e=s(this,i,arguments)).inFocusedState=!1,e.scaleFactor=1,e.isActive=!1,e._handleFocus=()=>{e.inFocusedState=!0},e._handleKeyDown=t=>{"Enter"!==t.key&&" "!==t.key&&142!==t.keyCode&&195!==t.keyCode||e._handleClick()},e}return y(i,Ts),m(i,[{key:"connectedCallback",value:function(){M(i,"connectedCallback",this)([]),this.addEventListener("click",this._handleClick,!1),this.addEventListener("keydown",this._handleKeyDown),this.addEventListener("focus",this._handleFocus)}},{key:"disconnectedCallback",value:function(){M(i,"disconnectedCallback",this)([]),this.removeEventListener("click",this._handleClick),this.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("focus",this._handleFocus)}},{key:"_handleClick",value:function(){var t,i,n=null===(t=this.component.onTap)||void 0===t?void 0:t.function;if(n){var a={function:n,parameters:v({},null===(i=this.component.onTap)||void 0===i?void 0:i.parameters,{formId:this.component.formId||"",value:"radio"===this.component.mode?this.component.value:void 0})};Lo({onTap:a,contextProvider:this.contextProvider}),this.contextProvider.flow&&this.component.id&&(e.logger.debug(`Trigger NamiFlow action for component ${this.component.id}`),this.contextProvider.flow.triggerActions(this.component.id,void 0,void 0,this.contextProvider.paywallId()))}}},{key:"updated",value:function(){var e;this.ariaLabel=this.component.screenreaderText||this.component.title||"",this.ariaDescription=null!==(e=this.component.screenreaderHint)&&void 0!==e?e:""}},{key:"styles",value:function(){var e=this.component,i=this.contextProvider.getCurrentFormId(e.formId||""),n=!0===i||i===e.value;this.inFocusedState=n;var a=n?e.activeFillColor||e.activeFillColorFallback||"transparent":e.inactiveFillColor||e.inactiveFillColorFallback||"transparent",r=n?e.activeBorderColor||"transparent":e.inactiveBorderColor||"transparent";return t.unsafeCSS(`\n :host {\n box-sizing: border-box;\n display: ${e.hidden?"none":"flex"};\n position: relative;\n cursor: pointer;\n height: 100%;\n border-radius: ${e.borderRadius}px !important;\n ${iu(e,this.scaleFactor,this.inFocusedState)}\n ${Ws(r)}\n border-width: ${n?e.activeBorderWidth||0:e.inactiveBorderWidth||0}px !important;\n ${Js(n?e.activeDropShadow:e.inactiveDropShadow)};\n border-style: solid;\n ${Os(a)}\n }\n `)}},{key:"render",value:function(){return this.tabIndex=0,this.component.components.map(e=>ju(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion))}}])}();Ae([ot({type:Object})],YO.prototype,"component",void 0),Ae([ot({type:Boolean})],YO.prototype,"inFocusedState",void 0),Ae([ot({type:Number})],YO.prototype,"scaleFactor",void 0),Ae([ot({type:Object})],YO.prototype,"minSDKVersion",void 0),Ae([ot({type:Boolean})],YO.prototype,"isActive",void 0),YO=Ae([Fe("nami-toggle-button")],YO);var qO,JO,QO,ZO,eW,tW,iW,nW,aW,rW,oW=e=>e,sW=(qO=function(){function i(){var e;return u(this,i),(e=s(this,i,arguments)).inFocusedState=!1,e.scaleFactor=1,e.timer=null,e.startTime=0,e.initialDuration=0,e.hasEmittedCompletion=!1,e}return y(i,Ts),m(i,[{key:"firstUpdated",value:function(){this.loadTimerState(),this.startTimer()}},{key:"disconnectedCallback",value:function(){M(i,"disconnectedCallback",this)([]),this.saveTimerState(),this.clearTimer()}},{key:"getTimerId",value:function(){var e,t;return null!==(e=null===(t=this.component)||void 0===t?void 0:t.id)&&void 0!==e?e:""}},{key:"loadTimerState",value:function(){var e;null!==(e=this.contextProvider)&&void 0!==e&&e.flow&&(this.timerState=this.contextProvider.flow.timerStates[this.getTimerId()])}},{key:"saveTimerState",value:function(){var e;if(null!==(e=this.contextProvider)&&void 0!==e&&e.flow){var t=this.component,i=t.mode,n=t.durationSeconds;if("duration"===i&&void 0!==n){var a=this.calculateCurrentRemainingSeconds();this.contextProvider.flow.timerStates[this.getTimerId()]={remainingSeconds:a,savedAt:Date.now(),hasEmittedCompletion:this.hasEmittedCompletion}}}}},{key:"getSavedTimerState",value:function(){var e;return null===(e=this.contextProvider)||void 0===e||null===(e=e.flow)||void 0===e?void 0:e.timerStates[this.getTimerId()]}},{key:"startTimer",value:function(){this.initializeTimerState(),this.clearTimer(),this.timer=setInterval(()=>this.onTimerTick(),rW.TIMER_INTERVAL_MS)}},{key:"initializeTimerState",value:function(){var e=this.component,t=e.mode,i=e.durationSeconds,n=e.resetOnRemount;"duration"===t&&void 0!==i&&(this.timerState&&!n?this.restoreTimerFromState(this.timerState,i):this.resetTimerState(i))}},{key:"restoreTimerFromState",value:function(e,t){var i=(Date.now()-e.savedAt)/1e3,n=Math.max(0,e.remainingSeconds-i);this.initialDuration=t,this.startTime=Date.now()-1e3*(this.initialDuration-n),this.hasEmittedCompletion=e.hasEmittedCompletion}},{key:"resetTimerState",value:function(e){this.initialDuration=e,this.startTime=Date.now(),this.hasEmittedCompletion=!1}},{key:"onTimerTick",value:function(){var e=this.calculateTimeValues().isCompleted;this.requestUpdate(),e&&this.clearTimer()}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"calculateTimeValues",value:function(){var e=this.calculateTotalRemainingSeconds(),t=e<=0,i=this.component.units||rW.DEFAULT_UNITS,n=i.days,a=i.hours,r=i.minutes,o=i.seconds;return v({},this.convertSecondsToTimeUnits(e,{days:n,hours:a,minutes:r,seconds:o}),{isCompleted:t})}},{key:"calculateTotalRemainingSeconds",value:function(){var e=this.component,t=e.mode,i=e.durationSeconds,n=e.targetDateTime;return"duration"===t?this.calculateDurationRemainingSeconds(i):"targetDateTime"===t&&n?this.calculateTargetDateTimeRemainingSeconds(n):0}},{key:"calculateDurationRemainingSeconds",value:function(e){var t=this.getSavedTimerState();if(t){var i=(Date.now()-t.savedAt)/1e3;return Math.max(0,t.remainingSeconds-i)}if(this.initialDuration>0&&this.startTime>0){var n=(Date.now()-this.startTime)/1e3;return Math.max(0,this.initialDuration-n)}return void 0!==e?Math.max(0,e):0}},{key:"calculateTargetDateTimeRemainingSeconds",value:function(e){var t=new Date(e).getTime(),i=Date.now();return Math.max(0,(t-i)/1e3)}},{key:"calculateCurrentRemainingSeconds",value:function(){var e=this.component.durationSeconds;if(this.initialDuration>0&&this.startTime>0){var t=(Date.now()-this.startTime)/1e3;return Math.max(0,this.initialDuration-t)}return null!=e?e:0}},{key:"convertSecondsToTimeUnits",value:function(e,t){var i=t.days?Math.floor(e/rW.SECONDS_PER_DAY):0,n=e-i*rW.SECONDS_PER_DAY,a=t.hours?Math.floor(n/rW.SECONDS_PER_HOUR):0,r=n-a*rW.SECONDS_PER_HOUR,o=t.minutes?Math.floor(r/rW.SECONDS_PER_MINUTE):0,s=r-o*rW.SECONDS_PER_MINUTE;return{days:i,hours:a,minutes:o,seconds:t.seconds?Math.floor(s):0}}},{key:"formatValue",value:function(e,t){return t?e.toString().padStart(2,"0"):e.toString()}},{key:"emitCompletionEvent",value:function(){!this.hasEmittedCompletion&&this.contextProvider&&(this.hasEmittedCompletion=!0,e.NamiEventEmitter.getInstance().emit(e.PAYWALL_ACTION_EVENT,v({},this.contextProvider.getPaywallActionEventData(),{action:e.NamiPaywallAction.COUNTDOWN_TIMER_COMPLETED,componentChange:{id:this.component.id,name:this.component.title}})))}},{key:"updated",value:function(e){this.updateAccessibilityAttributes(),e.has("component")&&this.handleComponentChange(e.get("component"))}},{key:"updateAccessibilityAttributes",value:function(){this.ariaLabel=this.component.screenreaderText||"",this.ariaDescription=this.component.screenreaderHint||""}},{key:"handleComponentChange",value:function(e){if(e){var t=this.component,i=t.mode,n=t.durationSeconds,a=t.targetDateTime;(i!==e.mode||n!==e.durationSeconds||a!==e.targetDateTime)&&this.startTimer()}}},{key:"styles",value:function(){var e=this.component,i=e.labels,n=e.separator,a=e.labelPosition,r=void 0===a?"none":a,o=e.direction,s=void 0===o?"horizontal":o,u=e.labelFontSize,l=e.labelFontColor,d=e.labelFontName,h=e.labelSpacing,c=e.spacing,m=e.fontSize,f=e.fontColor,v=e.fontName,p=e.alignment,g="below"===r?"bottom":"above"===r?"top":r,y="vertical"===s,b=i&&(i.days||i.hours||i.minutes||i.seconds)||"none"!==g;return t.unsafeCSS(`\n :host {\n box-sizing: border-box;\n display: ${e.hidden?"none":"flex"};\n position: relative;\n cursor: pointer;\n height: 100%;\n border-radius: ${e.borderRadius||0}px !important;\n flex-direction: ${y?"column":"row"};\n align-items: center;\n justify-content: flex-start;\n ${Ns(e,this.inFocusedState)}\n ${Gs(e,this.scaleFactor)}\n ${Ks(e,this.scaleFactor,this.inFocusedState)}\n ${zs(e)}\n ${Xs(e,this.scaleFactor)}\n }\n .timer-text {\n display: flex;\n flex-direction: ${y?"column":"row"};\n align-items: center;\n gap: ${y?c?c*this.scaleFactor:4:0}px;\n }\n .timer-unit {\n display: flex;\n flex-direction: ${"top"===g||"bottom"===g?"column":"row"};\n align-items: center;\n ${y?`margin-top: ${c?c*this.scaleFactor:4}px;`:`margin-right: ${c?c*this.scaleFactor:4}px;`} \n }\n .timer-text-value-days,\n .timer-text-value-hours,\n .timer-text-value-minutes,\n .timer-text-value-seconds {\n ${m?`font-size: ${m*this.scaleFactor}px;`:""}\n ${f?$s(f):""}\n ${Zs(v)}\n ${p?`text-align: ${p};`:""}\n ${Js(e.dropShadow,!0)}\n line-height: 1;\n }\n .timer-text-value-label {\n font-size: ${u?u*this.scaleFactor:12*this.scaleFactor}px;\n color: ${l||"inherit"};\n ${Zs(d)}\n ${"top"===g?`margin-bottom: ${h?h*this.scaleFactor:2}px;`:""}\n ${"bottom"===g?`margin-top: ${h?h*this.scaleFactor:2}px;`:""}\n ${b?"":"display: none;"}\n }\n .timer-text-value-separator {\n ${n?`\n display: flex;\n align-items: center;\n ${m?`font-size: ${m*this.scaleFactor}px;`:""}\n ${f?$s(f):""}\n ${Zs(v)}\n line-height: 1;\n ${y?`margin-top: ${c?c*this.scaleFactor:4}px;`:`margin-right: ${c?c*this.scaleFactor:4}px;`} \n ${"bottom"===g||"top"===g?"align-self: flex-start;":""}\n `:"display: none;"}\n }\n `)}},{key:"render",value:function(){this.tabIndex=0;var e=this.component.showWhenCompleted,i=void 0===e?"zero":e,n=this.calculateTimeValues();if(n.isCompleted&&(this.emitCompletionEvent(),"hidden"===i))return t.html(JO||(JO=oW``));var a=this.buildUnitsToRender(n);return 0===a.length?t.html(QO||(QO=oW`<div class="timer-text"></div>`)):this.renderTimerUnits(a)}},{key:"buildUnitsToRender",value:function(e){var t=this.component,i=t.labels,n=t.units,a=t.labelPosition,r=void 0===a?"none":a,o=n||{},s=o.days,u=o.hours,l=o.minutes,d=o.seconds,h=this.normalizeLabelPosition(r),c=this.shouldDisplayLabels(i,h);return[{enabled:s,value:e.days,label:this.getLabel("days",i,c),class:"timer-text-value-days"},{enabled:u,value:e.hours,label:this.getLabel("hours",i,c),class:"timer-text-value-hours"},{enabled:l,value:e.minutes,label:this.getLabel("minutes",i,c),class:"timer-text-value-minutes"},{enabled:d,value:e.seconds,label:this.getLabel("seconds",i,c),class:"timer-text-value-seconds"}].filter(e=>e.enabled).map(e=>({value:e.value,label:e.label,unitClass:e.class,showUnit:!0}))}},{key:"normalizeLabelPosition",value:function(e){return"below"===e?"bottom":"above"===e?"top":e}},{key:"shouldDisplayLabels",value:function(e,t){return Boolean(e&&(e.days||e.hours||e.minutes||e.seconds))||"none"!==t&&void 0!==t}},{key:"getLabel",value:function(e,t,i){var n;return null!==(n=null==t?void 0:t[e])&&void 0!==n?n:i?rW.DEFAULT_LABELS[e]:""}},{key:"renderTimerUnits",value:function(e){var i=this.component,n=i.separator,a=i.zeroPad,r=void 0===a||a,o=i.labelPosition,s=void 0===o?"none":o,u=this.component.labels,l=this.normalizeLabelPosition(s),d=u&&(u.days||u.hours||u.minutes||u.seconds),h=Boolean(d||"none"!==l),c=null!=n?n:":";return t.html(ZO||(ZO=oW`
|
|
587
|
+
`),this.currentWidth,Math.round(this.currentWidth))}}])}();Ae([ot({type:Object})],QO.prototype,"component",void 0),Ae([ot({type:Number})],QO.prototype,"scaleFactor",void 0),Ae([ot({type:Boolean})],QO.prototype,"inFocusedState",void 0),Ae([ot({type:Object})],QO.prototype,"minSDKVersion",void 0),Ae([ot({type:Number})],QO.prototype,"currentWidth",void 0),QO=Ae([Fe("nami-progress-indicator")],QO);var ZO=function(){function i(){var e;return u(this,i),(e=s(this,i,arguments)).inFocusedState=!1,e.scaleFactor=1,e.isActive=!1,e._handleFocus=()=>{e.inFocusedState=!0},e._handleKeyDown=t=>{"Enter"!==t.key&&" "!==t.key&&142!==t.keyCode&&195!==t.keyCode||e._handleClick()},e}return y(i,Ts),m(i,[{key:"connectedCallback",value:function(){M(i,"connectedCallback",this)([]),this.addEventListener("click",this._handleClick,!1),this.addEventListener("keydown",this._handleKeyDown),this.addEventListener("focus",this._handleFocus)}},{key:"disconnectedCallback",value:function(){M(i,"disconnectedCallback",this)([]),this.removeEventListener("click",this._handleClick),this.removeEventListener("keydown",this._handleKeyDown),this.removeEventListener("focus",this._handleFocus)}},{key:"_handleClick",value:function(){var t,i,n=null===(t=this.component.onTap)||void 0===t?void 0:t.function;if(n){var a={function:n,parameters:v({},null===(i=this.component.onTap)||void 0===i?void 0:i.parameters,{formId:this.component.formId||"",value:"radio"===this.component.mode?this.component.value:void 0})};Lo({onTap:a,contextProvider:this.contextProvider}),this.contextProvider.flow&&this.component.id&&(e.logger.debug(`Trigger NamiFlow action for component ${this.component.id}`),this.contextProvider.flow.triggerActions(this.component.id,void 0,void 0,this.contextProvider.paywallId()))}}},{key:"updated",value:function(){var e;this.ariaLabel=this.component.screenreaderText||this.component.title||"",this.ariaDescription=null!==(e=this.component.screenreaderHint)&&void 0!==e?e:""}},{key:"styles",value:function(){var e=this.component,i=this.contextProvider.getCurrentFormId(e.formId||""),n=!0===i||i===e.value;this.inFocusedState=n;var a=n?e.activeFillColor||e.activeFillColorFallback||"transparent":e.inactiveFillColor||e.inactiveFillColorFallback||"transparent",r=n?e.activeBorderColor||"transparent":e.inactiveBorderColor||"transparent";return t.unsafeCSS(`\n :host {\n box-sizing: border-box;\n display: ${e.hidden?"none":"flex"};\n position: relative;\n cursor: pointer;\n height: 100%;\n border-radius: ${e.borderRadius}px !important;\n ${iu(e,this.scaleFactor,this.inFocusedState)}\n ${Ws(r)}\n border-width: ${n?e.activeBorderWidth||0:e.inactiveBorderWidth||0}px !important;\n ${Js(n?e.activeDropShadow:e.inactiveDropShadow)};\n border-style: solid;\n ${Os(a)}\n }\n `)}},{key:"render",value:function(){return this.tabIndex=0,this.component.components.map(e=>ju(this.contextProvider,e,this.scaleFactor,this.inFocusedState,this.minSDKVersion))}}])}();Ae([ot({type:Object})],ZO.prototype,"component",void 0),Ae([ot({type:Boolean})],ZO.prototype,"inFocusedState",void 0),Ae([ot({type:Number})],ZO.prototype,"scaleFactor",void 0),Ae([ot({type:Object})],ZO.prototype,"minSDKVersion",void 0),Ae([ot({type:Boolean})],ZO.prototype,"isActive",void 0),ZO=Ae([Fe("nami-toggle-button")],ZO);var eW,tW,iW,nW,aW,rW,oW,sW,uW,lW,dW=e=>e,hW=(eW=function(){function i(){var e;return u(this,i),(e=s(this,i,arguments)).inFocusedState=!1,e.scaleFactor=1,e.timer=null,e.startTime=0,e.initialDuration=0,e.hasEmittedCompletion=!1,e}return y(i,Ts),m(i,[{key:"firstUpdated",value:function(){this.loadTimerState(),this.startTimer()}},{key:"disconnectedCallback",value:function(){M(i,"disconnectedCallback",this)([]),this.saveTimerState(),this.clearTimer()}},{key:"getTimerId",value:function(){var e,t;return null!==(e=null===(t=this.component)||void 0===t?void 0:t.id)&&void 0!==e?e:""}},{key:"loadTimerState",value:function(){var e;null!==(e=this.contextProvider)&&void 0!==e&&e.flow&&(this.timerState=this.contextProvider.flow.timerStates[this.getTimerId()])}},{key:"saveTimerState",value:function(){var e;if(null!==(e=this.contextProvider)&&void 0!==e&&e.flow){var t=this.component,i=t.mode,n=t.durationSeconds;if("duration"===i&&void 0!==n){var a=this.calculateCurrentRemainingSeconds();this.contextProvider.flow.timerStates[this.getTimerId()]={remainingSeconds:a,savedAt:Date.now(),hasEmittedCompletion:this.hasEmittedCompletion}}}}},{key:"getSavedTimerState",value:function(){var e;return null===(e=this.contextProvider)||void 0===e||null===(e=e.flow)||void 0===e?void 0:e.timerStates[this.getTimerId()]}},{key:"startTimer",value:function(){this.initializeTimerState(),this.clearTimer(),this.timer=setInterval(()=>this.onTimerTick(),lW.TIMER_INTERVAL_MS)}},{key:"initializeTimerState",value:function(){var e=this.component,t=e.mode,i=e.durationSeconds,n=e.resetOnRemount;"duration"===t&&void 0!==i&&(this.timerState&&!n?this.restoreTimerFromState(this.timerState,i):this.resetTimerState(i))}},{key:"restoreTimerFromState",value:function(e,t){var i=(Date.now()-e.savedAt)/1e3,n=Math.max(0,e.remainingSeconds-i);this.initialDuration=t,this.startTime=Date.now()-1e3*(this.initialDuration-n),this.hasEmittedCompletion=e.hasEmittedCompletion}},{key:"resetTimerState",value:function(e){this.initialDuration=e,this.startTime=Date.now(),this.hasEmittedCompletion=!1}},{key:"onTimerTick",value:function(){var e=this.calculateTimeValues().isCompleted;this.requestUpdate(),e&&this.clearTimer()}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"calculateTimeValues",value:function(){var e=this.calculateTotalRemainingSeconds(),t=e<=0,i=this.component.units||lW.DEFAULT_UNITS,n=i.days,a=i.hours,r=i.minutes,o=i.seconds;return v({},this.convertSecondsToTimeUnits(e,{days:n,hours:a,minutes:r,seconds:o}),{isCompleted:t})}},{key:"calculateTotalRemainingSeconds",value:function(){var e=this.component,t=e.mode,i=e.durationSeconds,n=e.targetDateTime;return"duration"===t?this.calculateDurationRemainingSeconds(i):"targetDateTime"===t&&n?this.calculateTargetDateTimeRemainingSeconds(n):0}},{key:"calculateDurationRemainingSeconds",value:function(e){var t=this.getSavedTimerState();if(t){var i=(Date.now()-t.savedAt)/1e3;return Math.max(0,t.remainingSeconds-i)}if(this.initialDuration>0&&this.startTime>0){var n=(Date.now()-this.startTime)/1e3;return Math.max(0,this.initialDuration-n)}return void 0!==e?Math.max(0,e):0}},{key:"calculateTargetDateTimeRemainingSeconds",value:function(e){var t=new Date(e).getTime(),i=Date.now();return Math.max(0,(t-i)/1e3)}},{key:"calculateCurrentRemainingSeconds",value:function(){var e=this.component.durationSeconds;if(this.initialDuration>0&&this.startTime>0){var t=(Date.now()-this.startTime)/1e3;return Math.max(0,this.initialDuration-t)}return null!=e?e:0}},{key:"convertSecondsToTimeUnits",value:function(e,t){var i=t.days?Math.floor(e/lW.SECONDS_PER_DAY):0,n=e-i*lW.SECONDS_PER_DAY,a=t.hours?Math.floor(n/lW.SECONDS_PER_HOUR):0,r=n-a*lW.SECONDS_PER_HOUR,o=t.minutes?Math.floor(r/lW.SECONDS_PER_MINUTE):0,s=r-o*lW.SECONDS_PER_MINUTE;return{days:i,hours:a,minutes:o,seconds:t.seconds?Math.floor(s):0}}},{key:"formatValue",value:function(e,t){return t?e.toString().padStart(2,"0"):e.toString()}},{key:"emitCompletionEvent",value:function(){!this.hasEmittedCompletion&&this.contextProvider&&(this.hasEmittedCompletion=!0,e.NamiEventEmitter.getInstance().emit(e.PAYWALL_ACTION_EVENT,v({},this.contextProvider.getPaywallActionEventData(),{action:e.NamiPaywallAction.COUNTDOWN_TIMER_COMPLETED,componentChange:{id:this.component.id,name:this.component.title}})))}},{key:"updated",value:function(e){this.updateAccessibilityAttributes(),e.has("component")&&this.handleComponentChange(e.get("component"))}},{key:"updateAccessibilityAttributes",value:function(){this.ariaLabel=this.component.screenreaderText||"",this.ariaDescription=this.component.screenreaderHint||""}},{key:"handleComponentChange",value:function(e){if(e){var t=this.component,i=t.mode,n=t.durationSeconds,a=t.targetDateTime;(i!==e.mode||n!==e.durationSeconds||a!==e.targetDateTime)&&this.startTimer()}}},{key:"styles",value:function(){var e=this.component,i=e.labels,n=e.separator,a=e.labelPosition,r=void 0===a?"none":a,o=e.direction,s=void 0===o?"horizontal":o,u=e.labelFontSize,l=e.labelFontColor,d=e.labelFontName,h=e.labelSpacing,c=e.spacing,m=e.fontSize,f=e.fontColor,v=e.fontName,p=e.alignment,g="below"===r?"bottom":"above"===r?"top":r,y="vertical"===s,b=i&&(i.days||i.hours||i.minutes||i.seconds)||"none"!==g;return t.unsafeCSS(`\n :host {\n box-sizing: border-box;\n display: ${e.hidden?"none":"flex"};\n position: relative;\n cursor: pointer;\n height: 100%;\n border-radius: ${e.borderRadius||0}px !important;\n flex-direction: ${y?"column":"row"};\n align-items: center;\n justify-content: flex-start;\n ${Ns(e,this.inFocusedState)}\n ${Gs(e,this.scaleFactor)}\n ${Ks(e,this.scaleFactor,this.inFocusedState)}\n ${zs(e)}\n ${Xs(e,this.scaleFactor)}\n }\n .timer-text {\n display: flex;\n flex-direction: ${y?"column":"row"};\n align-items: center;\n gap: ${y?c?c*this.scaleFactor:4:0}px;\n }\n .timer-unit {\n display: flex;\n flex-direction: ${"top"===g||"bottom"===g?"column":"row"};\n align-items: center;\n ${y?`margin-top: ${c?c*this.scaleFactor:4}px;`:`margin-right: ${c?c*this.scaleFactor:4}px;`} \n }\n .timer-text-value-days,\n .timer-text-value-hours,\n .timer-text-value-minutes,\n .timer-text-value-seconds {\n ${m?`font-size: ${m*this.scaleFactor}px;`:""}\n ${f?$s(f):""}\n ${Zs(v)}\n ${p?`text-align: ${p};`:""}\n ${Js(e.dropShadow,!0)}\n line-height: 1;\n }\n .timer-text-value-label {\n font-size: ${u?u*this.scaleFactor:12*this.scaleFactor}px;\n color: ${l||"inherit"};\n ${Zs(d)}\n ${"top"===g?`margin-bottom: ${h?h*this.scaleFactor:2}px;`:""}\n ${"bottom"===g?`margin-top: ${h?h*this.scaleFactor:2}px;`:""}\n ${b?"":"display: none;"}\n }\n .timer-text-value-separator {\n ${n?`\n display: flex;\n align-items: center;\n ${m?`font-size: ${m*this.scaleFactor}px;`:""}\n ${f?$s(f):""}\n ${Zs(v)}\n line-height: 1;\n ${y?`margin-top: ${c?c*this.scaleFactor:4}px;`:`margin-right: ${c?c*this.scaleFactor:4}px;`} \n ${"bottom"===g||"top"===g?"align-self: flex-start;":""}\n `:"display: none;"}\n }\n `)}},{key:"render",value:function(){this.tabIndex=0;var e=this.component.showWhenCompleted,i=void 0===e?"zero":e,n=this.calculateTimeValues();if(n.isCompleted&&(this.emitCompletionEvent(),"hidden"===i))return t.html(tW||(tW=dW``));var a=this.buildUnitsToRender(n);return 0===a.length?t.html(iW||(iW=dW`<div class="timer-text"></div>`)):this.renderTimerUnits(a)}},{key:"buildUnitsToRender",value:function(e){var t=this.component,i=t.labels,n=t.units,a=t.labelPosition,r=void 0===a?"none":a,o=n||{},s=o.days,u=o.hours,l=o.minutes,d=o.seconds,h=this.normalizeLabelPosition(r),c=this.shouldDisplayLabels(i,h);return[{enabled:s,value:e.days,label:this.getLabel("days",i,c),class:"timer-text-value-days"},{enabled:u,value:e.hours,label:this.getLabel("hours",i,c),class:"timer-text-value-hours"},{enabled:l,value:e.minutes,label:this.getLabel("minutes",i,c),class:"timer-text-value-minutes"},{enabled:d,value:e.seconds,label:this.getLabel("seconds",i,c),class:"timer-text-value-seconds"}].filter(e=>e.enabled).map(e=>({value:e.value,label:e.label,unitClass:e.class,showUnit:!0}))}},{key:"normalizeLabelPosition",value:function(e){return"below"===e?"bottom":"above"===e?"top":e}},{key:"shouldDisplayLabels",value:function(e,t){return Boolean(e&&(e.days||e.hours||e.minutes||e.seconds))||"none"!==t&&void 0!==t}},{key:"getLabel",value:function(e,t,i){var n;return null!==(n=null==t?void 0:t[e])&&void 0!==n?n:i?lW.DEFAULT_LABELS[e]:""}},{key:"renderTimerUnits",value:function(e){var i=this.component,n=i.separator,a=i.zeroPad,r=void 0===a||a,o=i.labelPosition,s=void 0===o?"none":o,u=this.component.labels,l=this.normalizeLabelPosition(s),d=u&&(u.days||u.hours||u.minutes||u.seconds),h=Boolean(d||"none"!==l),c=null!=n?n:":";return t.html(nW||(nW=dW`
|
|
578
588
|
<div class="timer-text">
|
|
579
589
|
${0}
|
|
580
590
|
</div>
|
|
581
|
-
`),e.map((i,n)=>t.html(
|
|
591
|
+
`),e.map((i,n)=>t.html(aW||(aW=dW`
|
|
582
592
|
${0}
|
|
583
593
|
${0}
|
|
584
|
-
`),this.renderUnit(i.value,i.label,i.unitClass,i.showUnit,r,l,h),n<e.length-1&&c?t.html(
|
|
594
|
+
`),this.renderUnit(i.value,i.label,i.unitClass,i.showUnit,r,l,h),n<e.length-1&&c?t.html(rW||(rW=dW`<span class="timer-text-value-separator">${0}</span>`),c):"")))}},{key:"renderUnit",value:function(e,i,n,a,r,o,s){if(!a)return null;var u=Boolean(i&&s);return t.html(oW||(oW=dW`
|
|
585
595
|
<div class="timer-unit">
|
|
586
596
|
${0}
|
|
587
597
|
<span class="${0}">${0}</span>
|
|
588
598
|
${0}
|
|
589
599
|
</div>
|
|
590
|
-
`),u&&"top"===o?t.html(
|
|
600
|
+
`),u&&"top"===o?t.html(sW||(sW=dW`<span class="timer-text-value-label">${0}</span>`),i):"",n,this.formatValue(e,r),u&&"bottom"===o?t.html(uW||(uW=dW`<span class="timer-text-value-label">${0}</span>`),i):"")}}])}(),lW=eW,eW.DEFAULT_LABELS={days:"days",hours:"hours",minutes:"minutes",seconds:"seconds"},eW.DEFAULT_UNITS={days:!1,hours:!0,minutes:!0,seconds:!0},eW.SECONDS_PER_DAY=86400,eW.SECONDS_PER_HOUR=3600,eW.SECONDS_PER_MINUTE=60,eW.TIMER_INTERVAL_MS=1e3,eW);Ae([ot({type:Object})],hW.prototype,"component",void 0),Ae([ot({type:Boolean})],hW.prototype,"inFocusedState",void 0),Ae([ot({type:Number})],hW.prototype,"scaleFactor",void 0),Ae([ot({type:Object})],hW.prototype,"minSDKVersion",void 0),hW=lW=Ae([Fe("nami-countdown-timer-text")],hW);var cW,mW=e=>e,fW=e._internal.NamiFlowManager,vW=function(){function i(){var e;return u(this,i),(e=s(this,i,arguments)).scaleFactor=1,e.inFocusedState=!1,e.currentProgress=0,e.isAnimating=!1,e.screenreaderAnnouncement="",e.hasInitialized=!1,e.delayTimeoutId=null,e.animationFrameId=null,e.animationStartTime=null,e.startPercentage=0,e}return y(i,Ts),m(i,[{key:"connectedCallback",value:function(){M(i,"connectedCallback",this)([]),e.validateMinSDKVersion(this.minSDKVersion,"ProgressBar")}},{key:"disconnectedCallback",value:function(){M(i,"disconnectedCallback",this)([]),this.cleanup()}},{key:"firstUpdated",value:function(e){M(i,"firstUpdated",this)([e]),this.hasInitialized=!0,this.startAnimation()}},{key:"updated",value:function(e){M(i,"updated",this)([e]),this.hasInitialized&&e.has("component")&&(this.cleanup(),this.startAnimation())}},{key:"cleanup",value:function(){null!==this.delayTimeoutId&&(clearTimeout(this.delayTimeoutId),this.delayTimeoutId=null),null!==this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.animationStartTime=null,this.isAnimating=!1}},{key:"getResolvedDuration",value:function(){var e=this.component,t=e.duration,i=e.mode;if("auto"===t&&"determinate"===i){var n=fW.getCurrentFlowStepAutoAdvanceDelay();return null!=n?n:3}return"number"==typeof t&&t>0?t:"determinate"===i?3:2}},{key:"startAnimation",value:function(){var e=this.component,t=e.mode,i=e.delay,n=e.percentage,a=void 0===n?0:n,r="number"==typeof a&&!Number.isInteger(a);this.startPercentage="number"==typeof a?r?100*a:a:0,this.currentProgress=this.startPercentage;var o="number"==typeof i&&i>0?1e3*i:0;o>0?this.delayTimeoutId=setTimeout(()=>{this.delayTimeoutId=null,this.beginAnimation(t)},o):this.beginAnimation(t)}},{key:"beginAnimation",value:function(e){this.isAnimating=!0;var t=this.component.screenreaderText||"Loading";this.screenreaderAnnouncement=t,setTimeout(()=>{this.screenreaderAnnouncement=""},1e3),"determinate"===e&&this.animateDeterminate()}},{key:"animateDeterminate",value:function(){if(!this.isAnimating||null===this.animationFrameId){var e=1e3*this.getResolvedDuration(),t=this.startPercentage;this.animationStartTime=null;var i=n=>{null===this.animationStartTime&&(this.animationStartTime=n);var a=n-this.animationStartTime,r=Math.min(1,a/e);this.currentProgress=t+(100-t)*r,r<1?this.animationFrameId=requestAnimationFrame(i):(this.currentProgress=100,this.isAnimating=!1,this.animationFrameId=null,this.animationStartTime=null)};this.animationFrameId=requestAnimationFrame(i)}}},{key:"getActiveWidthCss",value:function(){var e=this.component.activeWidth;return null==e?"30%":"number"==typeof e?`${e}px`:String(e).trim()}},{key:"isActiveWidthPercent",value:function(){var e=this.component.activeWidth;return null==e||"number"!=typeof e&&String(e).endsWith("%")}},{key:"styles",value:function(){var e=this.component,i=this.scaleFactor,n=this.inFocusedState,a=e.mode,r=e.inactiveFillColor,o=e.inactiveFillColorFallback,s=e.inactiveBorderRadius,u=e.activeFillColor,l=e.activeFillColorFallback,d=e.activeBorderRadius,h=e.innerPadding,c=void 0===h?0:h,m=e.activeDropShadow,f=e.inactiveDropShadow,v=this.getActiveWidthCss(),p=this.getResolvedDuration(),g=this.isActiveWidthPercent(),y=g&&parseFloat(v)||30,b=(100-y)/y*100,w=g?0:parseFloat(v)||0;return t.unsafeCSS(`\n :host {\n display: ${e.hidden?"none":"block"};\n ${iu(e,i,n)}\n }\n \n .progress-container {\n ${Xs(e,i)} \n background: ${r||o};\n border-radius: ${s||0}px;\n overflow: hidden;\n position: relative;\n padding: ${c*i}px;\n box-sizing: border-box;\n ${Js(f)}\n }\n \n .progress-bar {\n height: 100%;\n background: ${u||l};\n border-radius: ${d||0}px;\n box-sizing: border-box;\n ${Js(m)}\n ${"indeterminate"===a?`\n position: absolute;\n left: 0;\n top: ${c*i}px;\n bottom: ${c*i}px;\n width: ${v};\n animation: slide ${p}s linear infinite;\n `:""}\n }\n\n ${"indeterminate"===a?g?`\n @keyframes slide {\n 0% {\n transform: translateX(-${b}%);\n }\n 100% {\n transform: translateX(${b+100}%);\n }\n }\n `:`\n @keyframes slide {\n 0% {\n left: -${w}px;\n }\n 100% {\n left: 100%;\n }\n }\n `:""}\n\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n `)}},{key:"render",value:function(){var e=this.component.mode;return t.html(cW||(cW=mW`
|
|
591
601
|
<div class="progress-container">
|
|
592
602
|
<div
|
|
593
603
|
class="progress-bar"
|
|
@@ -604,7 +614,7 @@
|
|
|
604
614
|
aria-live="polite"
|
|
605
615
|
aria-atomic="true"
|
|
606
616
|
>${0}</span>
|
|
607
|
-
`),"indeterminate"===e?"":`width: ${this.currentProgress}%`,"indeterminate"===e?void 0:Math.round(this.currentProgress),"indeterminate"===e?void 0:0,"indeterminate"===e?void 0:100,this.isAnimating,this.screenreaderAnnouncement)}}])}();Ae([ot({type:Object})],
|
|
617
|
+
`),"indeterminate"===e?"":`width: ${this.currentProgress}%`,"indeterminate"===e?void 0:Math.round(this.currentProgress),"indeterminate"===e?void 0:0,"indeterminate"===e?void 0:100,this.isAnimating,this.screenreaderAnnouncement)}}])}();Ae([ot({type:Object})],vW.prototype,"component",void 0),Ae([ot({type:Number})],vW.prototype,"scaleFactor",void 0),Ae([ot({type:Boolean})],vW.prototype,"inFocusedState",void 0),Ae([ot({type:Object})],vW.prototype,"minSDKVersion",void 0),Ae([st()],vW.prototype,"currentProgress",void 0),Ae([st()],vW.prototype,"isAnimating",void 0),Ae([st()],vW.prototype,"screenreaderAnnouncement",void 0),vW=Ae([Fe("nami-progress-bar")],vW);var pW,gW,yW=e=>e,bW=2,wW=6,kW=20,SW=16,EW=16,TW=function(){function i(){var t;return u(this,i),(t=s(this,i)).inFocusedState=!1,t.scaleFactor=1,t._value="",t._focused=!1,t._handleInput=i=>{var n=i.target.value;t._value=n;var a=t.component,r=a.formId,o=a.validateOn;if(t.contextProvider.setFormState(r,n),"change"===o){var s,u=e.validateTextInput(t.validatorType(),!0===t.component.reqed,n);if(u)t.contextProvider.setFormFieldError(r,null!==(s=t.component.validationMessage)&&void 0!==s?s:u);else t.contextProvider.clearFormFieldError(r)}t.requestUpdate()},t._handleFocus=()=>{t._focused=!0,t.isTelevision||document.addEventListener("pointerdown",t._onOutsidePointerDown,!0),t.requestUpdate()},t._handleBlur=()=>{t._focused=!1,document.removeEventListener("pointerdown",t._onOutsidePointerDown,!0),t.requestUpdate()},t._onOutsidePointerDown=e=>{var i;e.composedPath().includes(t)||null===(i=t.shadowRoot)||void 0===i||null===(i=i.querySelector("input"))||void 0===i||i.blur()},t}return y(i,Ts),m(i,[{key:"connectedCallback",value:function(){var e;M(i,"connectedCallback",this)([]);var t=this.component.formId,n=null===(e=this.contextProvider.state.formStates)||void 0===e?void 0:e[t];this._value="string"==typeof n?n:"",this.contextProvider.setFormState(t,this._value),this.contextProvider.registerFormFieldValidator(t,this.validator())}},{key:"updated",value:function(e){if(M(i,"updated",this)([e]),e.has("component")){var t,n=e.get("component"),a=!0===(null==n?void 0:n.focused);if(!0===this.component.focused&&!a)null===(t=this._inputEl)||void 0===t||t.focus({preventScroll:!0})}}},{key:"isTelevision",get:function(){return"television"===e.getDeviceFormFactor()}},{key:"validatorType",value:function(){return"email"===this.component.type?"email":"name"}},{key:"validator",value:function(){return{type:this.validatorType(),required:!0===this.component.reqed,message:this.component.validationMessage}}},{key:"currentError",get:function(){return this.contextProvider.getFormFieldErrors()[this.component.formId]}},{key:"disconnectedCallback",value:function(){document.removeEventListener("pointerdown",this._onOutsidePointerDown,!0),M(i,"disconnectedCallback",this)([])}},{key:"styles",value:function(){return t.unsafeCSS(`\n :host {\n box-sizing: border-box;\n display: block;\n ${"100%"===this.component.width?"width: 100%;":""}\n }\n :host .nami-text-input-wrapper {\n display: flex;\n flex-direction: column;\n gap: ${this.resolvedSpacing()}px;\n ${"100%"===this.component.width?"width: 100%;":""}\n }\n :host label {\n ${this.applyLabelStyles()}\n }\n :host input {\n ${this.applyInputStyles()}\n }\n :host input::placeholder {\n ${this.component.placeholderFontColor?`color: ${this.component.placeholderFontColor};`:""}\n }\n :host .nami-text-input-error {\n ${this.applyErrorStyles()}\n }\n `)}},{key:"resolvedSpacing",value:function(){var e=this.component.spacing;return null==e?this.isTelevision?SW:0:Number(e)}},{key:"resolvedBorderWidth",value:function(e){return null==e?this.isTelevision?bW:0:Number(e)}},{key:"applyLabelStyles",value:function(){var e,t=this.component,i=null!==(e=t.labelFontSize)&&void 0!==e?e:this.isTelevision?kW:void 0;return`\n ${$s(t.labelFontColor||"inherit")}\n ${Zs(t.labelFontName)}\n ${null!=i?`font-size: ${Fs(i,this.scaleFactor)};`:""}\n `}},{key:"applyInputStyles",value:function(){var e,t,i,n,a,r,o,s,u,l,d,h,c=this.component,m=!!this.currentError,f=this._focused,v=c.borderColor||"transparent",p=this.resolvedBorderWidth(c.borderWidth),g=Number(null!==(e=c.borderRadius)&&void 0!==e?e:this.isTelevision?wW:0),y=c.fillColor||"transparent";f&&(v=c.focusedBorderColor||v,p=this.resolvedBorderWidth(null!==(o=c.focusedBorderWidth)&&void 0!==o?o:c.borderWidth),g=Number(null!==(s=null!==(u=c.focusedBorderRadius)&&void 0!==u?u:c.borderRadius)&&void 0!==s?s:g),y=c.focusedFillColor||y);m&&(v=c.errorBorderColor||v,p=this.resolvedBorderWidth(null!==(l=c.errorBorderWidth)&&void 0!==l?l:c.borderWidth),g=Number(null!==(d=null!==(h=c.errorBorderRadius)&&void 0!==h?h:c.borderRadius)&&void 0!==d?d:g));var b=null!==(t=c.fontSize)&&void 0!==t?t:this.isTelevision?kW:void 0,w=null!==(i=c.innerTopPadding)&&void 0!==i?i:this.isTelevision?EW:0,k=null!==(n=c.innerBottomPadding)&&void 0!==n?n:this.isTelevision?EW:0,S=null!==(a=c.innerLeftPadding)&&void 0!==a?a:this.isTelevision?EW:0,E=null!==(r=c.innerRightPadding)&&void 0!==r?r:this.isTelevision?EW:0;return`\n box-sizing: border-box;\n width: 100%;\n outline: none;\n ${$s(c.fontColor||"inherit")}\n ${Zs(c.fontName)}\n ${null!=b?`font-size: ${Fs(b,this.scaleFactor)};`:""}\n ${Os(y)}\n ${Ws(v)}\n border-style: solid;\n border-width: ${p}px !important;\n border-radius: ${g}px !important;\n padding: ${Number(w)}px ${Number(E)}px ${Number(k)}px ${Number(S)}px !important;\n text-align: ${c.alignment||"left"};\n `}},{key:"applyErrorStyles",value:function(){var e,t=this.component,i=null!==(e=t.validationTextFontSize)&&void 0!==e?e:this.isTelevision?kW:void 0;return`\n ${$s(t.validationTextFontColor||"#D83A58")}\n ${Zs(t.validationTextFontName)}\n ${null!=i?`font-size: ${Fs(i,this.scaleFactor)};`:""}\n `}},{key:"render",value:function(){var e,i,n,a,r=this.component,o=`nami-text-input-${r.formId}`,s=this.currentError,u="none"!==r.labelPosition&&!!r.labelText,l=!0===r.reqed?`${r.labelText} *`:r.labelText,d="email"===r.type?"email":"text",h="email"===r.type?"email":"text";return t.html(pW||(pW=yW`
|
|
608
618
|
<div class="nami-text-input-wrapper">
|
|
609
619
|
${0}
|
|
610
620
|
<input
|
|
@@ -627,4 +637,4 @@
|
|
|
627
637
|
aria-live="polite"
|
|
628
638
|
>${0}</div>
|
|
629
639
|
</div>
|
|
630
|
-
`),u?t.html(
|
|
640
|
+
`),u?t.html(gW||(gW=yW`<label for=${0}>${0}</label>`),o,l):t.nothing,o,d,h,this._value,null!==(e=r.placeholderText)&&void 0!==e?e:"",null!==(i=null!==(n=r.screenreaderText)&&void 0!==n?n:l)&&void 0!==i?i:t.nothing,null!==(a=r.screenreaderHint)&&void 0!==a?a:t.nothing,s?"true":t.nothing,s?`${o}-error`:t.nothing,this._handleInput,this._handleFocus,this._handleBlur,`${o}-error`,null!=s?s:"")}}])}();Ae([ot({type:Object})],TW.prototype,"component",void 0),Ae([ot({type:Boolean})],TW.prototype,"inFocusedState",void 0),Ae([ot({type:Number})],TW.prototype,"scaleFactor",void 0),Ae([function(e){return(t,i,n)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>{var i,n;return null!==(i=null===(n=t.renderRoot)||void 0===n?void 0:n.querySelector(e))&&void 0!==i?i:null})(this)}})}("input")],TW.prototype,"_inputEl",void 0),TW=Ae([Fe("nami-text-input")],TW),Object.defineProperty(exports,"LaunchCampaignError",{enumerable:!0,get:function(){return e.LaunchCampaignError}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return e.LogLevel}}),Object.defineProperty(exports,"Nami",{enumerable:!0,get:function(){return e.Nami}}),Object.defineProperty(exports,"NamiCampaignManager",{enumerable:!0,get:function(){return e.NamiCampaignManager}}),Object.defineProperty(exports,"NamiCampaignRuleType",{enumerable:!0,get:function(){return e.NamiCampaignRuleType}}),Object.defineProperty(exports,"NamiCustomerManager",{enumerable:!0,get:function(){return e.NamiCustomerManager}}),Object.defineProperty(exports,"NamiEntitlementManager",{enumerable:!0,get:function(){return e.NamiEntitlementManager}}),Object.defineProperty(exports,"NamiFlowManager",{enumerable:!0,get:function(){return e.NamiFlowManager}}),Object.defineProperty(exports,"NamiHandoffTag",{enumerable:!0,get:function(){return e.NamiHandoffTag}}),Object.defineProperty(exports,"NamiPaywallAction",{enumerable:!0,get:function(){return e.NamiPaywallAction}}),Object.defineProperty(exports,"NamiPaywallManager",{enumerable:!0,get:function(){return e.NamiPaywallManager}}),Object.defineProperty(exports,"NamiPaywallManagerEvents",{enumerable:!0,get:function(){return e.NamiPaywallManagerEvents}}),Object.defineProperty(exports,"NamiPermissionOutcome",{enumerable:!0,get:function(){return e.NamiPermissionOutcome}}),Object.defineProperty(exports,"NamiPurchaseManager",{enumerable:!0,get:function(){return e.NamiPurchaseManager}}),Object.defineProperty(exports,"TRANSPORT_FAILURE_STATUS",{enumerable:!0,get:function(){return e.TRANSPORT_FAILURE_STATUS}}),Object.defineProperty(exports,"_internal",{enumerable:!0,get:function(){return e._internal}}),Object.defineProperty(exports,"didReceiveResponse",{enumerable:!0,get:function(){return e.didReceiveResponse}}),Object.defineProperty(exports,"isNamiFlowCampaign",{enumerable:!0,get:function(){return e.isNamiFlowCampaign}}),Object.defineProperty(exports,"registerAPITrafficObserver",{enumerable:!0,get:function(){return e.registerAPITrafficObserver}});
|
package/dist/nami-web.d.ts
CHANGED
|
@@ -342,7 +342,7 @@ declare class NamiResponsiveGrid extends NamiElement {
|
|
|
342
342
|
private isGroupedHorizontal;
|
|
343
343
|
private isTimelineActive;
|
|
344
344
|
protected styles(): CSSResult;
|
|
345
|
-
render(): lit_html.TemplateResult<1> |
|
|
345
|
+
render(): any[][] | lit_html.TemplateResult<1> | lit_html.TemplateResult<1>[];
|
|
346
346
|
protected updated(): void;
|
|
347
347
|
private measureTimeline;
|
|
348
348
|
private readTimelineGeometry;
|
|
@@ -512,6 +512,11 @@ declare class NamiProgressIndicator extends NamiElement {
|
|
|
512
512
|
firstUpdated(changedProperties: any): void;
|
|
513
513
|
updated(changedProperties: any): void;
|
|
514
514
|
protected styles(): CSSResult;
|
|
515
|
+
private stepFill;
|
|
516
|
+
private stepRadius;
|
|
517
|
+
private stepShadow;
|
|
518
|
+
private stepSize;
|
|
519
|
+
private renderSteps;
|
|
515
520
|
private getProgressPercentage;
|
|
516
521
|
private animateProgress;
|
|
517
522
|
render(): TemplateResult;
|