morph-quest-phb
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -1,1 +0,1 @@ | ||
"use strict";var AuthContext=require("./chunks/AuthContext-b2583ffe.js");var React=require("react");require("./chunks/index-ed929e3a.js");function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=="default"){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}})}})}n.default=e;return Object.freeze(n)}var React__namespace=/*#__PURE__*/_interopNamespaceDefault(React);function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}var s$1={"main":"Splash-module_main__foBPf","visible":"Splash-module_visible__RJUX1","hidden":"Splash-module_hidden__UfeIf"};function _array_like_to_array$6(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$6(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep$4(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator$4(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$4(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$4(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _define_property$5(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit$6(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$6(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$6(arr,i){return _array_with_holes$6(arr)||_iterable_to_array_limit$6(arr,i)||_unsupported_iterable_to_array$6(arr,i)||_non_iterable_rest$6()}function _unsupported_iterable_to_array$6(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$6(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$6(o,minLen)}function _ts_generator$4(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}var Splash=function(props){var children=props.children,className=props.className,classes=props.classes,tmp=props.data,_ref=tmp===void 0?{}:tmp,loggedInRedirect=_ref.loggedInRedirect,loggedOutRedirect=_ref.loggedOutRedirect,_ref_duration=_ref.duration,duration=_ref_duration===void 0?1500:_ref_duration,_ref_delayRedirect=_ref.delayRedirect,delayRedirect=_ref_delayRedirect===void 0?0:_ref_delayRedirect;var redirect=null;try{var _require=require("next/navigation"),nextRedirect=_require.redirect;redirect=nextRedirect()}catch(err){redirect=function(url){window.location.href=url}}var _useUser=AuthContext.useUser(),initiated=_useUser.initiated,isAuthenticated=_useUser.isAuthenticated;var defaultVisible=initiated&&isAuthenticated;var _React_useState=_sliced_to_array$6(React__namespace.useState(defaultVisible||true),2),showSplash=_React_useState[0],setShowSplash=_React_useState[1];var _React_useState1=_sliced_to_array$6(React__namespace.useState(defaultVisible||true),2),isVisible=_React_useState1[0],setIsVisible=_React_useState1[1];React__namespace.useEffect(function(){var redirectTimeout;var redirectWithDelay=/*#__PURE__*/function(){var _ref=_async_to_generator$4(function(url){return _ts_generator$4(this,function(_state){if(delayRedirect)redirectTimeout=setTimeout(function(){return redirect(url)},delayRedirect);else redirect(url);return[2]})});return function redirectWithDelay(url){return _ref.apply(this,arguments)}}();if(initiated){if(isAuthenticated&&loggedInRedirect)redirectWithDelay(loggedInRedirect);if(!isAuthenticated&&loggedOutRedirect)redirectWithDelay(loggedOutRedirect)}else if(typeof initiated!=="boolean"&&loggedOutRedirect)redirectWithDelay(loggedOutRedirect);return function(){return clearTimeout(redirectTimeout)}},[delayRedirect,initiated,isAuthenticated,loggedInRedirect,loggedOutRedirect,redirect]);React__namespace.useEffect(function(){var timer=setTimeout(function(){setIsVisible(false)},duration);return function(){return clearTimeout(timer)}},[duration]);var handleTransitionEnd=function(){if(!isVisible)setShowSplash(false)};var _obj;return showSplash?/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx(s$1.main,className,(_obj={},_define_property$5(_obj,classes,classes!==""),_define_property$5(_obj,"".concat(s$1.visible," ").concat(classes,"Visible ").concat(className,"Visible"),isVisible),_define_property$5(_obj,"".concat(s$1.hidden," ").concat(classes,"Hidden ").concat(className,"Hidden"),!isVisible),_obj)),onTransitionEnd:handleTransitionEnd,children:children}):null};Splash.propTypes={children:AuthContext.PropTypes.node,className:AuthContext.PropTypes.string,classes:AuthContext.PropTypes.string,data:AuthContext.PropTypes.shape({loggedInRedirect:AuthContext.PropTypes.string,loggedOutRedirect:AuthContext.PropTypes.string,duration:AuthContext.PropTypes.number})};var s={"progressContainer":"ProgressBar-module_progressContainer__-sSUw","progressCircle":"ProgressBar-module_progressCircle__A1xV7","circleBg":"ProgressBar-module_circleBg__0Rd6K","circle":"ProgressBar-module_circle__vlei7","barWrapper":"ProgressBar-module_barWrapper__phDp1","circleText":"ProgressBar-module_circleText__xfjZx","progressBar":"ProgressBar-module_progressBar__CU31J","progressBarFill":"ProgressBar-module_progressBarFill__jH0bN","progressText":"ProgressBar-module_progressText__HSBkD","prefixText":"ProgressBar-module_prefixText__dT6R8","suffixText":"ProgressBar-module_suffixText__KDAH3","textContainer":"ProgressBar-module_textContainer__oz0d-","topAnchor":"ProgressBar-module_topAnchor__3C8lM","bottomAnchor":"ProgressBar-module_bottomAnchor__APDIj"};function _array_like_to_array$5(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$5(arr){if(Array.isArray(arr))return arr}function _define_property$4(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit$5(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$5(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$5(arr,i){return _array_with_holes$5(arr)||_iterable_to_array_limit$5(arr,i)||_unsupported_iterable_to_array$5(arr,i)||_non_iterable_rest$5()}function _unsupported_iterable_to_array$5(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$5(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$5(o,minLen)}var ProgressBar=/*#__PURE__*/React__namespace.memo(function ProgressBar(props){var className=props.className,classes=props.classes,_props_data=props.data,_props_data_variant=_props_data.variant,variant=_props_data_variant===void 0?"text":_props_data_variant,_props_data_speed=_props_data.speed,speed=_props_data_speed===void 0?700:_props_data_speed,_props_data_min=_props_data.min,min=_props_data_min===void 0?0:_props_data_min,_props_data_max=_props_data.max,max=_props_data_max===void 0?100:_props_data_max,_props_data_value=_props_data.value,value=_props_data_value===void 0?75:_props_data_value,_props_data_delay=_props_data.delay,delay=_props_data_delay===void 0?0:_props_data_delay,_props_data_anchor=_props_data.anchor,anchor=_props_data_anchor===void 0?"middle":_props_data_anchor,prefix=_props_data.prefix,suffix=_props_data.suffix;var convertedValue=React__namespace.useMemo(function(){return parseInt(value,10)||0},[value]);var convertedMin=React__namespace.useMemo(function(){return parseInt(min,10)||0},[min]);var convertedMax=React__namespace.useMemo(function(){return parseInt(max,10)||0},[max]);var _React_useState=_sliced_to_array$5(React__namespace.useState(convertedMin),2),progress=_React_useState[0],setProgress=_React_useState[1];var intervalRef=React__namespace.useRef(null);React__namespace.useEffect(function(){var increment=(convertedValue-convertedMin)/(speed/100);var startProgress=function(){intervalRef.current=setInterval(function(){setProgress(function(prev){if(prev>=convertedValue){clearInterval(intervalRef.current);return Math.round(convertedValue)}return Math.round(prev+increment)})},100)};var delayTimeout=setTimeout(startProgress,delay);return function(){clearInterval(intervalRef.current);clearTimeout(delayTimeout)}},[convertedMin,convertedValue,speed,delay]);var renderProgress=function(){var TextProgress=function(){return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs(AuthContext.jsxRuntimeExports.Fragment,{children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.prefixText,_define_property$4({},"".concat(classes,"Prefix"),classes!==""),"".concat(className,"Prefix")),children:prefix}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.progressText,_define_property$4({},"".concat(classes,"ProgressText"),classes!==""),"".concat(className,"ProgressText")),children:progress}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.suffixText,_define_property$4({},"".concat(classes,"Suffix"),classes!==""),"".concat(className,"Suffix")),children:suffix})]})};switch(variant){case"text":return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:clsx(s.progressText,_define_property$4({},"".concat(classes,"Text"),classes!==""),"".concat(className,"Text")),children:[prefix,progress,suffix]});case"circle":return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:clsx(s.progressCircle,_define_property$4({},"".concat(classes,"ProgressCircle"),classes!==""),"".concat(className,"ProgressCircle")),children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 36 36",children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("path",{className:clsx(s.circleBg,_define_property$4({},"".concat(classes,"CircleBg"),classes!==""),"".concat(className,"CircleBg")),d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("path",{className:clsx(s.circle,_define_property$4({},"".concat(classes,"Circle"),classes!==""),"".concat(className,"Circle")),strokeDasharray:"".concat(progress/convertedMax*100,", 100"),d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"})]}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:clsx(s.circleText,_define_property$4({},"".concat(classes,"CircleText"),classes!==""),"".concat(className,"CircleText")),children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.prefixText,_define_property$4({},"".concat(classes,"Prefix"),classes!==""),"".concat(className,"Prefix")),children:prefix}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.progressText,_define_property$4({},"".concat(classes,"ProgressText"),classes!==""),"".concat(className,"ProgressText")),children:progress}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.suffixText,_define_property$4({},"".concat(classes,"Suffix"),classes!==""),"".concat(className,"Suffix")),children:suffix})]})]});case"bar":var _obj,_obj1;return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:clsx(s.barWrapper,"".concat(className,"BarWrapper"),_define_property$4({},"".concat(classes,"BarWrapper"),classes!=="")),children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx(s.progressBar,_define_property$4({},"".concat(classes,"ProgressBar"),classes!==""),"".concat(className,"ProgressBar")),children:/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx(s.progressBarFill,(_obj={},_define_property$4(_obj,"".concat(classes,"ProgressBarFill"),classes!==""),_define_property$4(_obj,s.bottomAnchor,anchor==="top"),_define_property$4(_obj,s.topAnchor,anchor==="bottom"),_obj),"".concat(className,"ProgressBarFill")),style:{width:"".concat(progress/convertedMax*100,"%"),transition:"width ".concat(speed,"ms linear")},children:anchor==="middle"&&/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(TextProgress,{})})}),anchor!=="middle"&&/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx(s.textContainer,"".concat(className,"TextContainer"),(_obj1={},_define_property$4(_obj1,"".concat(classes,"TextContainer"),classes!==""),_define_property$4(_obj1,"".concat(s.bottomAnchor," ").concat(classes,"Bottom ").concat(className,"Bottom"),anchor==="bottom"),_define_property$4(_obj1,"".concat(s.topAnchor," ").concat(classes,"Top ").concat(className,"Top"),anchor==="top"),_obj1)),children:/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(TextProgress,{})})]});default:return null}};return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx(s.progressContainer,classes,className),children:renderProgress()})});ProgressBar.propTypes={variant:AuthContext.PropTypes.oneOf(["text","circle","bar"]).isRequired,speed:AuthContext.PropTypes.number.isRequired,min:AuthContext.PropTypes.oneOfType([AuthContext.PropTypes.number,AuthContext.PropTypes.string]).isRequired,max:AuthContext.PropTypes.oneOfType([AuthContext.PropTypes.number,AuthContext.PropTypes.string]).isRequired,value:AuthContext.PropTypes.oneOfType([AuthContext.PropTypes.number,AuthContext.PropTypes.string]).isRequired,anchor:AuthContext.PropTypes.oneOf(["top","bottom","middle"]),prefix:AuthContext.PropTypes.string,suffix:AuthContext.PropTypes.string};function _array_like_to_array$4(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$4(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep$3(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator$3(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$3(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$3(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _define_property$3(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit$4(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$4(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$4(arr,i){return _array_with_holes$4(arr)||_iterable_to_array_limit$4(arr,i)||_unsupported_iterable_to_array$4(arr,i)||_non_iterable_rest$4()}function _unsupported_iterable_to_array$4(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$4(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$4(o,minLen)}function _ts_generator$3(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}var PhoebeUser=/*#__PURE__*/React__namespace.memo(function PhoebeUser(props){var children=props.children,className=props.className,_props_data=props.data,_props_data_type=_props_data.type,type=_props_data_type===void 0?"base":_props_data_type,historyPerPage=_props_data.historyPerPage,historyPage=_props_data.historyPage,_props_data_validOnly=_props_data.validOnly,validOnly=_props_data_validOnly===void 0?true:_props_data_validOnly,benefitTypeId=_props_data.benefitTypeId,_props_data_wrapper=_props_data.wrapper,wrapper=_props_data_wrapper===void 0?true:_props_data_wrapper,setFetchFinished=props.setFetchFinished;var _useUser=AuthContext.useUser(),user=_useUser.user,isAuthenticated=_useUser.isAuthenticated,onGetOrderHistory=_useUser.onGetOrderHistory,orderHistory=_useUser.orderHistory,onGetLoyaltyProgramBenefits=_useUser.onGetLoyaltyProgramBenefits,onGetUserBenefits=_useUser.onGetUserBenefits,activeUserBenefits=_useUser.activeUserBenefits;var _React_useState=_sliced_to_array$4(React__namespace.useState(true),2),isLoading=_React_useState[0],setIsLoading=_React_useState[1];var _React_useState1=_sliced_to_array$4(React__namespace.useState({}),2),items=_React_useState1[0],setItems=_React_useState1[1];React__namespace.useEffect(function(){var getOrderHistory=/*#__PURE__*/function(){var _ref=_async_to_generator$3(function(){var response;return _ts_generator$3(this,function(_state){switch(_state.label){case 0:if((orderHistory===null||orderHistory===void 0?void 0:orderHistory.length)>0){setItems(orderHistory);setIsLoading(false);return[2]}return[4,onGetOrderHistory({perPage:historyPerPage,page:historyPage})];case 1:response=_state.sent();setItems(response);setIsLoading(false);return[2]}})});return function getOrderHistory(){return _ref.apply(this,arguments)}}();var getLoyaltyProgramBenefits=/*#__PURE__*/function(){var _ref=_async_to_generator$3(function(){var response;return _ts_generator$3(this,function(_state){switch(_state.label){case 0:return[4,onGetLoyaltyProgramBenefits({validOnly:validOnly,benefitTypeId:benefitTypeId})];case 1:response=_state.sent();setItems(response);setIsLoading(false);if(setFetchFinished&&typeof setFetchFinished==="function")setFetchFinished(className);return[2]}})});return function getLoyaltyProgramBenefits(){return _ref.apply(this,arguments)}}();var getUserBenefits=/*#__PURE__*/function(){var _ref=_async_to_generator$3(function(){return _ts_generator$3(this,function(_state){switch(_state.label){case 0:return[4,onGetUserBenefits({benefitTypeId:benefitTypeId})];case 1:_state.sent();setItems(activeUserBenefits);setIsLoading(false);if(setFetchFinished&&typeof setFetchFinished==="function")setFetchFinished(className);return[2]}})});return function getUserBenefits(){return _ref.apply(this,arguments)}}();if(isAuthenticated&&Object.keys(user).length>0){switch(type){case"base":setItems(user);setIsLoading(false);break;case"orderHistory":getOrderHistory();break;case"loyaltyProgramBenefits":getLoyaltyProgramBenefits();break;case"userBenefits":getUserBenefits();break}}},[historyPage,historyPerPage,isAuthenticated,onGetOrderHistory,onGetUserBenefits,onGetLoyaltyProgramBenefits]);var Component=function(param){var children=param.children;if(wrapper)return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:"".concat(className,"PUWrapper"),children:children});return children};return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(Component,{children:isLoading?/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx("".concat(className,"PULoader"),_define_property$3({},"".concat(className,"NoAuth"),!isAuthenticated))}):/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(AuthContext.jsxRuntimeExports.Fragment,{children:React__namespace.Children.map(children,function(child,index){return /*#__PURE__*/React__namespace.cloneElement(child,{key:index,data:{items:items,wrappers:false}})})})})});PhoebeUser.propTypes={className:AuthContext.PropTypes.string};function _array_like_to_array$3(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$3(arr){if(Array.isArray(arr))return arr}function _iterable_to_array_limit$3(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$3(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$3(arr,i){return _array_with_holes$3(arr)||_iterable_to_array_limit$3(arr,i)||_unsupported_iterable_to_array$3(arr,i)||_non_iterable_rest$3()}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _unsupported_iterable_to_array$3(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$3(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$3(o,minLen)}var groupKeys=function(obj){var groupedObj={};Object.keys(obj).forEach(function(key){var parts=key.split(".");var currentGroup=groupedObj;for(var i=0;i<parts.length-1;i++){var part=parts[i];if((part===null||part===void 0?void 0:part.startsWith("["))&&(part===null||part===void 0?void 0:part.endsWith("]"))){var index=parseInt(part===null||part===void 0?void 0:part.slice(1,-1),10);currentGroup[index]=currentGroup[index]||{};currentGroup=currentGroup[index]}else{var _parts_,_parts_1;if(parts[i+1]&&((_parts_=parts[i+1])===null||_parts_===void 0?void 0:_parts_.startsWith("["))&&((_parts_1=parts[i+1])===null||_parts_1===void 0?void 0:_parts_1.endsWith("]"))){currentGroup[part]=currentGroup[part]||[]}else{currentGroup[part]=currentGroup[part]||{}}currentGroup=currentGroup[part]}}var lastPart=parts[parts.length-1];if((lastPart===null||lastPart===void 0?void 0:lastPart.startsWith("["))&&(lastPart===null||lastPart===void 0?void 0:lastPart.endsWith("]"))){var index1=parseInt(lastPart===null||lastPart===void 0?void 0:lastPart.slice(1,-1),10);currentGroup[index1]=obj[key]}else{currentGroup[lastPart]=obj[key]}});var cleanEmptyEntries=function(obj){if(Array.isArray(obj)){return obj.filter(function(item){return item!==undefined&&item!==null}).map(cleanEmptyEntries)}else if((typeof obj==="undefined"?"undefined":_type_of(obj))==="object"&&obj!==null){return Object.fromEntries(Object.entries(obj).map(function(param){var _param=_sliced_to_array$3(param,2),key=_param[0],value=_param[1];return[key,cleanEmptyEntries(value)]}))}return obj};return cleanEmptyEntries(groupedObj)};var formatFormData=function(formData){var formattedData={};for(var key in formData){if(formData.hasOwnProperty(key)){var value=formData[key];if(key.toLowerCase().includes("password"))formattedData[key]=value;else if(value==="true"||value==="false")formattedData[key]=value==="true";else if(value==="")formattedData[key]=null;else if(key.includes("phone_number")||key.includes("phoneNumber")||key.includes("barcode")){formattedData[key]=value}else if(/^\d{4}-\d{2}-\d{2}$/.test(value)){var date=new Date(value);formattedData[key]=date.toISOString()}else if(!isNaN(Number(value)))formattedData[key]=Number(value);else formattedData[key]=value}}return groupKeys(formattedData)};function _array_like_to_array$2(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$2(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator$2(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _iterable_to_array_limit$2(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$2(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$2(arr,i){return _array_with_holes$2(arr)||_iterable_to_array_limit$2(arr,i)||_unsupported_iterable_to_array$2(arr,i)||_non_iterable_rest$2()}function _unsupported_iterable_to_array$2(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$2(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$2(o,minLen)}function _ts_generator$2(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}var Form=function(props){var children=props.children,className=props.elementName,classes=props.classes,_props_data=props.data,_props_data_type=_props_data.type,type=_props_data_type===void 0?"login":_props_data_type,_props_data_redirectUrl=_props_data.redirectUrl,redirectUrl=_props_data_redirectUrl===void 0?undefined:_props_data_redirectUrl,_props_data_successMessage=_props_data.successMessage,successMessage=_props_data_successMessage===void 0?"":_props_data_successMessage,_props_data_errorMessage=_props_data.errorMessage,errorMessage=_props_data_errorMessage===void 0?"":_props_data_errorMessage,_props_data_resetAfterSubmit=_props_data.resetAfterSubmit,resetAfterSubmit=_props_data_resetAfterSubmit===void 0?false:_props_data_resetAfterSubmit;var onFormSubmit=AuthContext.useAuthHandlers().onFormSubmit;var _React_useState=_sliced_to_array$2(React__namespace.useState(false),2),isLoading=_React_useState[0],setIsLoading=_React_useState[1];var _React_useState1=_sliced_to_array$2(React__namespace.useState(false),2),success=_React_useState1[0],setSuccess=_React_useState1[1];var _React_useState2=_sliced_to_array$2(React__namespace.useState([]),2),error=_React_useState2[0],setError=_React_useState2[1];var handleSubmit=React__namespace.useCallback(/*#__PURE__*/function(){var _ref=_async_to_generator$2(function(e){var formData,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,input,formEntries,formValues,actions,handleResponse,isSuccessful,form;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:e.preventDefault();formData=new FormData(e.target);_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(_iterator=e.target.querySelectorAll("input[type=checkbox]")[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){input=_step.value;if(!formData.has(input.name)){formData.append(input.name,"false")}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}formEntries=Object.fromEntries(formData.entries());formValues=formatFormData(formEntries);setIsLoading(true);setSuccess(false);setError(null);actions={auth:function(){return Promise.resolve().then(function(){return require("./chunks/auth-a0fcd0d0.js")}).then(function(m){return m.default(onFormSubmit,formValues,type,redirectUrl,errorMessage)})}};handleResponse=function(param){var success=param.success,error=param.error;if(success){setSuccess(true);return true}if(error)setError(error)};return[4,actions.auth()];case 1:isSuccessful=handleResponse.apply(void 0,[_state.sent()]);form=e.target;if(resetAfterSubmit&&isSuccessful){form.reset();form.scrollIntoView({behavior:"smooth"})}setIsLoading(false);return[2]}})});return function(e){return _ref.apply(this,arguments)}}(),[resetAfterSubmit,onFormSubmit,type,redirectUrl,errorMessage]);return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("form",{className:clsx(classes,className),onSubmit:handleSubmit,children:[React__namespace.Children.map(children,function(child){if(child.props.elementType==="FormButton"){return /*#__PURE__*/React__namespace.cloneElement(child,{className:"".concat(classes,"Button ").concat(className,"Button"),isLoading:isLoading,success:success,error:error})}return child}),type==="newsletter"&&/*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs(AuthContext.jsxRuntimeExports.Fragment,{children:[success&&/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("p",{className:clsx("".concat(classes,"Success"),"".concat(className,"Success")),children:successMessage}),error&&(error===null||error===void 0?void 0:error.map(function(value,idx){return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("p",{className:clsx("".concat(classes,"Error"),"".concat(className,"Error")),children:value},idx)}))]})]})};Form.propTypes={children:AuthContext.PropTypes.node,className:AuthContext.PropTypes.string};function _array_like_to_array$1(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$1(arr){if(Array.isArray(arr))return arr}function _define_property$2(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit$1(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$1(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$1(arr,i){return _array_with_holes$1(arr)||_iterable_to_array_limit$1(arr,i)||_unsupported_iterable_to_array$1(arr,i)||_non_iterable_rest$1()}function _unsupported_iterable_to_array$1(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$1(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$1(o,minLen)}var FormField=function(props){var children=props.children,className=props.elementName,_props_data=props.data,label=_props_data.label,name=_props_data.name,_props_data_type=_props_data.type,type=_props_data_type===void 0?"text":_props_data_type,_props_data_placeholder=_props_data.placeholder,placeholder=_props_data_placeholder===void 0?"Field":_props_data_placeholder,_props_data_regex=_props_data.regex,regex=_props_data_regex===void 0?undefined:_props_data_regex,_props_data_required=_props_data.required,required=_props_data_required===void 0?false:_props_data_required,disable=_props_data.disable,_props_data_readOnly=_props_data.readOnly,readOnly=_props_data_readOnly===void 0?false:_props_data_readOnly,_props_data_disableFilled=_props_data.disableFilled,disableFilled=_props_data_disableFilled===void 0?false:_props_data_disableFilled,_props_data_prefix=_props_data.prefix,prefix=_props_data_prefix===void 0?undefined:_props_data_prefix,_props_data_maxLength=_props_data.maxLength,maxLength=_props_data_maxLength===void 0?undefined:_props_data_maxLength,tmp=_props_data.defaultValue,defaultValueProp=tmp===void 0?undefined:tmp,_props_data_keepFocus=_props_data.keepFocus,keepFocus=_props_data_keepFocus===void 0?false:_props_data_keepFocus,classes=props.classes;var user=AuthContext.useUser().user;var _React_useState=_sliced_to_array$1(React__namespace.useState(undefined),2),valid=_React_useState[0],setValid=_React_useState[1];var _React_useState1=_sliced_to_array$1(React__namespace.useState(false),2),isFocused=_React_useState1[0],setIsFocused=_React_useState1[1];var handleChange=function(e){var value=e.target.value;if(prefix&&!(value===null||value===void 0?void 0:value.startsWith(prefix))){e.target.value=prefix}if(regex){try{var regexTest=new RegExp(regex);var isValid=regexTest.test(value);if(!isValid){e.target.setCustomValidity("Invalid ".concat(label||name,"."));setValid(false)}else{setValid(true);e.target.setCustomValidity("")}}catch(error){console.error("Error compiling regex:",error)}}};var handleFocus=function(e){if(prefix&&e.target.value==="")e.target.value=prefix;setIsFocused(true)};var handleBlur=function(e){if(prefix&&e.target.value===prefix)e.target.value="";if(e.target.value!==""&&keepFocus)return;setIsFocused(false)};var defaultValue=undefined;if((name===null||name===void 0?void 0:name.includes("user."))&&Object.keys(user||{}).length>0){var _name_split;if(type==="date"){var date=new Date(user[name.split(".")[1]]);var year=date.getFullYear();var month=date.getMonth()+1;var day=date.getDate();defaultValue="".concat(year,"-").concat(month<10?"0".concat(month):month,"-").concat(day<10?"0".concat(day):day)}else defaultValue=user[name===null||name===void 0?void 0:(_name_split=name.split("."))===null||_name_split===void 0?void 0:_name_split[1]]}var getClassName=function(subclass){var _obj;return clsx("".concat(classes).concat(subclass," ").concat(className).concat(subclass),(_obj={},_define_property$2(_obj,"".concat(classes).concat(subclass,"Disabled ").concat(className).concat(subclass,"Disabled"),disable||disableFilled&&defaultValue!==undefined),_define_property$2(_obj,"".concat(classes).concat(subclass,"Valid ").concat(className).concat(subclass,"Valid"),valid===true),_define_property$2(_obj,"".concat(classes).concat(subclass,"Invalid ").concat(className).concat(subclass,"Invalid"),valid===false),_obj))};return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:clsx(classes,className,_define_property$2({},"".concat(classes,"Focused ").concat(className,"Focused"),isFocused)),children:[label&&label!==""&&/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("label",{htmlFor:name,className:getClassName("Label"),children:label}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:getClassName("Container"),children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("input",{className:getClassName("Input"),type:type,name:name,id:"".concat(name,"_").concat(className),placeholder:placeholder,disabled:disable||disableFilled&&defaultValue!==undefined,onChange:handleChange,onFocus:handleFocus,onBlur:handleBlur,required:required,defaultValue:defaultValue||defaultValueProp,maxLength:maxLength,readOnly:readOnly}),children]})]})};FormField.propTypes={children:AuthContext.PropTypes.node,className:AuthContext.PropTypes.string,classes:AuthContext.PropTypes.string,data:AuthContext.PropTypes.shape({label:AuthContext.PropTypes.string,name:AuthContext.PropTypes.string.isRequired,type:AuthContext.PropTypes.string,placeholder:AuthContext.PropTypes.string,regex:AuthContext.PropTypes.string,required:AuthContext.PropTypes.bool,disable:AuthContext.PropTypes.bool,disableFilled:AuthContext.PropTypes.bool})};function _array_like_to_array(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator$1(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _define_property$1(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(arr,i){return _array_with_holes(arr)||_iterable_to_array_limit(arr,i)||_unsupported_iterable_to_array(arr,i)||_non_iterable_rest()}function _unsupported_iterable_to_array(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}function _ts_generator$1(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}var BenefitButton=function(props){var children=props.children,classes=props.classes,className=props.className,_props_data=props.data,label=_props_data.label,disabled=_props_data.disabled,couponCode=_props_data.couponCode,costInPoints=_props_data.costInPoints,benefitTypeId=_props_data.benefitTypeId,href=_props_data.href;var _useUser=AuthContext.useUser(),onConsumeStamps=_useUser.onConsumeStamps,user=_useUser.user;var _React_useState=_sliced_to_array(React__namespace.useState(disabled),2),buttonDisabled=_React_useState[0],setButtonDisabled=_React_useState[1];var router;try{var _require=require("next/navigation"),nextUseRouter=_require.useRouter;router=nextUseRouter()}catch(e){router={push:function(url){window.location.href=url}}}React__namespace.useEffect(function(){if(user&&user.points<costInPoints)setButtonDisabled(true);else setButtonDisabled(disabled||false)},[costInPoints,disabled,user]);var handleConsumeStamps=React__namespace.useCallback(/*#__PURE__*/_async_to_generator$1(function(){return _ts_generator$1(this,function(_state){switch(_state.label){case 0:return[4,onConsumeStamps({code:couponCode,benefitTypeId:benefitTypeId})];case 1:_state.sent();if(href)router.push(href);return[2]}})}),[benefitTypeId,couponCode,href,onConsumeStamps,router]);var _obj;return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("button",{type:"button",className:clsx(classes,className,(_obj={},_define_property$1(_obj,"".concat(className,"Disabled"),buttonDisabled),_define_property$1(_obj,"".concat(classes,"Disabled"),buttonDisabled&&classes!==""),_obj)),onClick:handleConsumeStamps,"aria-label":label,disabled:buttonDisabled,"aria-disabled":buttonDisabled,children:children||label})};BenefitButton.propTypes={children:AuthContext.PropTypes.node,classes:AuthContext.PropTypes.string,className:AuthContext.PropTypes.string,data:AuthContext.PropTypes.shape({label:AuthContext.PropTypes.string,disabled:AuthContext.PropTypes.bool,couponCode:AuthContext.PropTypes.string})};function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _ts_generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}var LogoutButton=function(props){var children=props.children,classes=props.classes,className=props.className,_props_data=props.data,_props_data_label=_props_data.label,label=_props_data_label===void 0?"Logout":_props_data_label,_props_data_disabled=_props_data.disabled,disabled=_props_data_disabled===void 0?false:_props_data_disabled,href=_props_data.href;var _useUser=AuthContext.useUser(),isAuthenticated=_useUser.isAuthenticated,onUserLogout=_useUser.onUserLogout;var handleLogout=React__namespace.useCallback(/*#__PURE__*/_async_to_generator(function(){return _ts_generator(this,function(_state){switch(_state.label){case 0:if(!isAuthenticated)return[3,2];return[4,onUserLogout({redirectPath:href})];case 1:_state.sent();_state.label=2;case 2:return[2]}})}),[href,isAuthenticated,onUserLogout]);var _obj;return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("button",{type:"button",className:clsx(classes,className,(_obj={},_define_property(_obj,"".concat(className,"Disabled"),disabled),_define_property(_obj,"".concat(classes,"Disabled"),disabled&&classes!==""),_obj)),onClick:handleLogout,"aria-label":label,disabled:disabled,"aria-disabled":disabled,children:children||label})};LogoutButton.propTypes={children:AuthContext.PropTypes.node,classes:AuthContext.PropTypes.string,className:AuthContext.PropTypes.string,data:AuthContext.PropTypes.shape({label:AuthContext.PropTypes.string,disabled:AuthContext.PropTypes.bool,href:AuthContext.PropTypes.string})};exports.BenefitButton=BenefitButton;exports.FormField=FormField;exports.LogoutButton=LogoutButton;exports.PhoebeForm=Form;exports.PhoebeUser=PhoebeUser;exports.ProgressBar=ProgressBar;exports.Splash=Splash; | ||
"use strict";var AuthContext=require("./chunks/AuthContext-93a45c95.js");var React=require("react");require("./chunks/index-ed929e3a.js");function _interopNamespaceDefault(e){var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=="default"){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}})}})}n.default=e;return Object.freeze(n)}var React__namespace=/*#__PURE__*/_interopNamespaceDefault(React);function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}var s$1={"main":"Splash-module_main__foBPf","visible":"Splash-module_visible__RJUX1","hidden":"Splash-module_hidden__UfeIf"};function _array_like_to_array$6(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$6(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep$4(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator$4(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$4(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$4(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _define_property$5(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit$6(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$6(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$6(arr,i){return _array_with_holes$6(arr)||_iterable_to_array_limit$6(arr,i)||_unsupported_iterable_to_array$6(arr,i)||_non_iterable_rest$6()}function _unsupported_iterable_to_array$6(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$6(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$6(o,minLen)}function _ts_generator$4(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}var Splash=function(props){var children=props.children,className=props.className,classes=props.classes,tmp=props.data,_ref=tmp===void 0?{}:tmp,loggedInRedirect=_ref.loggedInRedirect,loggedOutRedirect=_ref.loggedOutRedirect,_ref_duration=_ref.duration,duration=_ref_duration===void 0?1500:_ref_duration,_ref_delayRedirect=_ref.delayRedirect,delayRedirect=_ref_delayRedirect===void 0?0:_ref_delayRedirect;var redirect=null;try{var _require=require("next/navigation"),nextRedirect=_require.redirect;redirect=nextRedirect()}catch(err){redirect=function(url){window.location.href=url}}var _useUser=AuthContext.useUser(),initiated=_useUser.initiated,isAuthenticated=_useUser.isAuthenticated;var defaultVisible=initiated&&isAuthenticated;var _React_useState=_sliced_to_array$6(React__namespace.useState(defaultVisible||true),2),showSplash=_React_useState[0],setShowSplash=_React_useState[1];var _React_useState1=_sliced_to_array$6(React__namespace.useState(defaultVisible||true),2),isVisible=_React_useState1[0],setIsVisible=_React_useState1[1];React__namespace.useEffect(function(){var redirectTimeout;var redirectWithDelay=/*#__PURE__*/function(){var _ref=_async_to_generator$4(function(url){return _ts_generator$4(this,function(_state){if(delayRedirect)redirectTimeout=setTimeout(function(){return redirect(url)},delayRedirect);else redirect(url);return[2]})});return function redirectWithDelay(url){return _ref.apply(this,arguments)}}();if(initiated){if(isAuthenticated&&loggedInRedirect)redirectWithDelay(loggedInRedirect);if(!isAuthenticated&&loggedOutRedirect)redirectWithDelay(loggedOutRedirect)}else if(typeof initiated!=="boolean"&&loggedOutRedirect)redirectWithDelay(loggedOutRedirect);return function(){return clearTimeout(redirectTimeout)}},[delayRedirect,initiated,isAuthenticated,loggedInRedirect,loggedOutRedirect,redirect]);React__namespace.useEffect(function(){var timer=setTimeout(function(){setIsVisible(false)},duration);return function(){return clearTimeout(timer)}},[duration]);var handleTransitionEnd=function(){if(!isVisible)setShowSplash(false)};var _obj;return showSplash?/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx(s$1.main,className,(_obj={},_define_property$5(_obj,classes,classes!==""),_define_property$5(_obj,"".concat(s$1.visible," ").concat(classes,"Visible ").concat(className,"Visible"),isVisible),_define_property$5(_obj,"".concat(s$1.hidden," ").concat(classes,"Hidden ").concat(className,"Hidden"),!isVisible),_obj)),onTransitionEnd:handleTransitionEnd,children:children}):null};Splash.propTypes={children:AuthContext.PropTypes.node,className:AuthContext.PropTypes.string,classes:AuthContext.PropTypes.string,data:AuthContext.PropTypes.shape({loggedInRedirect:AuthContext.PropTypes.string,loggedOutRedirect:AuthContext.PropTypes.string,duration:AuthContext.PropTypes.number})};var s={"progressContainer":"ProgressBar-module_progressContainer__-sSUw","progressCircle":"ProgressBar-module_progressCircle__A1xV7","circleBg":"ProgressBar-module_circleBg__0Rd6K","circle":"ProgressBar-module_circle__vlei7","barWrapper":"ProgressBar-module_barWrapper__phDp1","circleText":"ProgressBar-module_circleText__xfjZx","progressBar":"ProgressBar-module_progressBar__CU31J","progressBarFill":"ProgressBar-module_progressBarFill__jH0bN","progressText":"ProgressBar-module_progressText__HSBkD","prefixText":"ProgressBar-module_prefixText__dT6R8","suffixText":"ProgressBar-module_suffixText__KDAH3","textContainer":"ProgressBar-module_textContainer__oz0d-","topAnchor":"ProgressBar-module_topAnchor__3C8lM","bottomAnchor":"ProgressBar-module_bottomAnchor__APDIj"};function _array_like_to_array$5(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$5(arr){if(Array.isArray(arr))return arr}function _define_property$4(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit$5(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$5(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$5(arr,i){return _array_with_holes$5(arr)||_iterable_to_array_limit$5(arr,i)||_unsupported_iterable_to_array$5(arr,i)||_non_iterable_rest$5()}function _unsupported_iterable_to_array$5(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$5(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$5(o,minLen)}var ProgressBar=/*#__PURE__*/React__namespace.memo(function ProgressBar(props){var className=props.className,classes=props.classes,_props_data=props.data,_props_data_variant=_props_data.variant,variant=_props_data_variant===void 0?"text":_props_data_variant,_props_data_speed=_props_data.speed,speed=_props_data_speed===void 0?700:_props_data_speed,_props_data_min=_props_data.min,min=_props_data_min===void 0?0:_props_data_min,_props_data_max=_props_data.max,max=_props_data_max===void 0?100:_props_data_max,_props_data_value=_props_data.value,value=_props_data_value===void 0?75:_props_data_value,_props_data_delay=_props_data.delay,delay=_props_data_delay===void 0?0:_props_data_delay,_props_data_anchor=_props_data.anchor,anchor=_props_data_anchor===void 0?"middle":_props_data_anchor,prefix=_props_data.prefix,suffix=_props_data.suffix;var convertedValue=React__namespace.useMemo(function(){return parseInt(value,10)||0},[value]);var convertedMin=React__namespace.useMemo(function(){return parseInt(min,10)||0},[min]);var convertedMax=React__namespace.useMemo(function(){return parseInt(max,10)||0},[max]);var _React_useState=_sliced_to_array$5(React__namespace.useState(convertedMin),2),progress=_React_useState[0],setProgress=_React_useState[1];var intervalRef=React__namespace.useRef(null);React__namespace.useEffect(function(){var increment=(convertedValue-convertedMin)/(speed/100);var startProgress=function(){intervalRef.current=setInterval(function(){setProgress(function(prev){if(prev>=convertedValue){clearInterval(intervalRef.current);return Math.round(convertedValue)}return Math.round(prev+increment)})},100)};var delayTimeout=setTimeout(startProgress,delay);return function(){clearInterval(intervalRef.current);clearTimeout(delayTimeout)}},[convertedMin,convertedValue,speed,delay]);var renderProgress=function(){var TextProgress=function(){return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs(AuthContext.jsxRuntimeExports.Fragment,{children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.prefixText,_define_property$4({},"".concat(classes,"Prefix"),classes!==""),"".concat(className,"Prefix")),children:prefix}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.progressText,_define_property$4({},"".concat(classes,"ProgressText"),classes!==""),"".concat(className,"ProgressText")),children:progress}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.suffixText,_define_property$4({},"".concat(classes,"Suffix"),classes!==""),"".concat(className,"Suffix")),children:suffix})]})};switch(variant){case"text":return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:clsx(s.progressText,_define_property$4({},"".concat(classes,"Text"),classes!==""),"".concat(className,"Text")),children:[prefix,progress,suffix]});case"circle":return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:clsx(s.progressCircle,_define_property$4({},"".concat(classes,"ProgressCircle"),classes!==""),"".concat(className,"ProgressCircle")),children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("svg",{viewBox:"0 0 36 36",children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("path",{className:clsx(s.circleBg,_define_property$4({},"".concat(classes,"CircleBg"),classes!==""),"".concat(className,"CircleBg")),d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("path",{className:clsx(s.circle,_define_property$4({},"".concat(classes,"Circle"),classes!==""),"".concat(className,"Circle")),strokeDasharray:"".concat(progress/convertedMax*100,", 100"),d:"M18 2.0845 a 15.9155 15.9155 0 0 1 0 31.831 a 15.9155 15.9155 0 0 1 0 -31.831"})]}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:clsx(s.circleText,_define_property$4({},"".concat(classes,"CircleText"),classes!==""),"".concat(className,"CircleText")),children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.prefixText,_define_property$4({},"".concat(classes,"Prefix"),classes!==""),"".concat(className,"Prefix")),children:prefix}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.progressText,_define_property$4({},"".concat(classes,"ProgressText"),classes!==""),"".concat(className,"ProgressText")),children:progress}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("span",{className:clsx(s.suffixText,_define_property$4({},"".concat(classes,"Suffix"),classes!==""),"".concat(className,"Suffix")),children:suffix})]})]});case"bar":var _obj,_obj1;return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:clsx(s.barWrapper,"".concat(className,"BarWrapper"),_define_property$4({},"".concat(classes,"BarWrapper"),classes!=="")),children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx(s.progressBar,_define_property$4({},"".concat(classes,"ProgressBar"),classes!==""),"".concat(className,"ProgressBar")),children:/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx(s.progressBarFill,(_obj={},_define_property$4(_obj,"".concat(classes,"ProgressBarFill"),classes!==""),_define_property$4(_obj,s.bottomAnchor,anchor==="top"),_define_property$4(_obj,s.topAnchor,anchor==="bottom"),_obj),"".concat(className,"ProgressBarFill")),style:{width:"".concat(progress/convertedMax*100,"%"),transition:"width ".concat(speed,"ms linear")},children:anchor==="middle"&&/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(TextProgress,{})})}),anchor!=="middle"&&/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx(s.textContainer,"".concat(className,"TextContainer"),(_obj1={},_define_property$4(_obj1,"".concat(classes,"TextContainer"),classes!==""),_define_property$4(_obj1,"".concat(s.bottomAnchor," ").concat(classes,"Bottom ").concat(className,"Bottom"),anchor==="bottom"),_define_property$4(_obj1,"".concat(s.topAnchor," ").concat(classes,"Top ").concat(className,"Top"),anchor==="top"),_obj1)),children:/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(TextProgress,{})})]});default:return null}};return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx(s.progressContainer,classes,className),children:renderProgress()})});ProgressBar.propTypes={variant:AuthContext.PropTypes.oneOf(["text","circle","bar"]).isRequired,speed:AuthContext.PropTypes.number.isRequired,min:AuthContext.PropTypes.oneOfType([AuthContext.PropTypes.number,AuthContext.PropTypes.string]).isRequired,max:AuthContext.PropTypes.oneOfType([AuthContext.PropTypes.number,AuthContext.PropTypes.string]).isRequired,value:AuthContext.PropTypes.oneOfType([AuthContext.PropTypes.number,AuthContext.PropTypes.string]).isRequired,anchor:AuthContext.PropTypes.oneOf(["top","bottom","middle"]),prefix:AuthContext.PropTypes.string,suffix:AuthContext.PropTypes.string};function _array_like_to_array$4(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$4(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep$3(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator$3(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$3(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$3(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _define_property$3(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit$4(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$4(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$4(arr,i){return _array_with_holes$4(arr)||_iterable_to_array_limit$4(arr,i)||_unsupported_iterable_to_array$4(arr,i)||_non_iterable_rest$4()}function _unsupported_iterable_to_array$4(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$4(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$4(o,minLen)}function _ts_generator$3(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}var PhoebeUser=/*#__PURE__*/React__namespace.memo(function PhoebeUser(props){var children=props.children,className=props.className,_props_data=props.data,_props_data_type=_props_data.type,type=_props_data_type===void 0?"base":_props_data_type,historyPerPage=_props_data.historyPerPage,historyPage=_props_data.historyPage,_props_data_validOnly=_props_data.validOnly,validOnly=_props_data_validOnly===void 0?true:_props_data_validOnly,benefitTypeId=_props_data.benefitTypeId,_props_data_wrapper=_props_data.wrapper,wrapper=_props_data_wrapper===void 0?true:_props_data_wrapper,setFetchFinished=props.setFetchFinished;var _useUser=AuthContext.useUser(),user=_useUser.user,isAuthenticated=_useUser.isAuthenticated,onGetOrderHistory=_useUser.onGetOrderHistory,orderHistory=_useUser.orderHistory,onGetLoyaltyProgramBenefits=_useUser.onGetLoyaltyProgramBenefits,onGetUserBenefits=_useUser.onGetUserBenefits,activeUserBenefits=_useUser.activeUserBenefits;var _React_useState=_sliced_to_array$4(React__namespace.useState(true),2),isLoading=_React_useState[0],setIsLoading=_React_useState[1];var _React_useState1=_sliced_to_array$4(React__namespace.useState({}),2),items=_React_useState1[0],setItems=_React_useState1[1];React__namespace.useEffect(function(){var getOrderHistory=/*#__PURE__*/function(){var _ref=_async_to_generator$3(function(){var response;return _ts_generator$3(this,function(_state){switch(_state.label){case 0:if((orderHistory===null||orderHistory===void 0?void 0:orderHistory.length)>0){setItems(orderHistory);setIsLoading(false);return[2]}return[4,onGetOrderHistory({perPage:historyPerPage,page:historyPage})];case 1:response=_state.sent();setItems(response);setIsLoading(false);return[2]}})});return function getOrderHistory(){return _ref.apply(this,arguments)}}();var getLoyaltyProgramBenefits=/*#__PURE__*/function(){var _ref=_async_to_generator$3(function(){var response;return _ts_generator$3(this,function(_state){switch(_state.label){case 0:return[4,onGetLoyaltyProgramBenefits({validOnly:validOnly,benefitTypeId:benefitTypeId})];case 1:response=_state.sent();setItems(response);setIsLoading(false);if(setFetchFinished&&typeof setFetchFinished==="function")setFetchFinished(className);return[2]}})});return function getLoyaltyProgramBenefits(){return _ref.apply(this,arguments)}}();var getUserBenefits=/*#__PURE__*/function(){var _ref=_async_to_generator$3(function(){return _ts_generator$3(this,function(_state){switch(_state.label){case 0:return[4,onGetUserBenefits({benefitTypeId:benefitTypeId})];case 1:_state.sent();setItems(activeUserBenefits);setIsLoading(false);if(setFetchFinished&&typeof setFetchFinished==="function")setFetchFinished(className);return[2]}})});return function getUserBenefits(){return _ref.apply(this,arguments)}}();if(isAuthenticated&&Object.keys(user).length>0){switch(type){case"base":setItems(user);setIsLoading(false);break;case"orderHistory":getOrderHistory();break;case"loyaltyProgramBenefits":getLoyaltyProgramBenefits();break;case"userBenefits":getUserBenefits();break}}},[historyPage,historyPerPage,isAuthenticated,onGetOrderHistory,onGetUserBenefits,onGetLoyaltyProgramBenefits]);var Component=function(param){var children=param.children;if(wrapper)return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:"".concat(className,"PUWrapper"),children:children});return children};return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(Component,{children:isLoading?/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("div",{className:clsx("".concat(className,"PULoader"),_define_property$3({},"".concat(className,"NoAuth"),!isAuthenticated))}):/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(AuthContext.jsxRuntimeExports.Fragment,{children:React__namespace.Children.map(children,function(child,index){return /*#__PURE__*/React__namespace.cloneElement(child,{key:index,data:{items:items,wrappers:false}})})})})});PhoebeUser.propTypes={className:AuthContext.PropTypes.string};function _array_like_to_array$3(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$3(arr){if(Array.isArray(arr))return arr}function _iterable_to_array_limit$3(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$3(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$3(arr,i){return _array_with_holes$3(arr)||_iterable_to_array_limit$3(arr,i)||_unsupported_iterable_to_array$3(arr,i)||_non_iterable_rest$3()}function _type_of(obj){"@swc/helpers - typeof";return obj&&typeof Symbol!=="undefined"&&obj.constructor===Symbol?"symbol":typeof obj}function _unsupported_iterable_to_array$3(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$3(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$3(o,minLen)}var groupKeys=function(obj){var groupedObj={};Object.keys(obj).forEach(function(key){var parts=key.split(".");var currentGroup=groupedObj;for(var i=0;i<parts.length-1;i++){var part=parts[i];if((part===null||part===void 0?void 0:part.startsWith("["))&&(part===null||part===void 0?void 0:part.endsWith("]"))){var index=parseInt(part===null||part===void 0?void 0:part.slice(1,-1),10);currentGroup[index]=currentGroup[index]||{};currentGroup=currentGroup[index]}else{var _parts_,_parts_1;if(parts[i+1]&&((_parts_=parts[i+1])===null||_parts_===void 0?void 0:_parts_.startsWith("["))&&((_parts_1=parts[i+1])===null||_parts_1===void 0?void 0:_parts_1.endsWith("]"))){currentGroup[part]=currentGroup[part]||[]}else{currentGroup[part]=currentGroup[part]||{}}currentGroup=currentGroup[part]}}var lastPart=parts[parts.length-1];if((lastPart===null||lastPart===void 0?void 0:lastPart.startsWith("["))&&(lastPart===null||lastPart===void 0?void 0:lastPart.endsWith("]"))){var index1=parseInt(lastPart===null||lastPart===void 0?void 0:lastPart.slice(1,-1),10);currentGroup[index1]=obj[key]}else{currentGroup[lastPart]=obj[key]}});var cleanEmptyEntries=function(obj){if(Array.isArray(obj)){return obj.filter(function(item){return item!==undefined&&item!==null}).map(cleanEmptyEntries)}else if((typeof obj==="undefined"?"undefined":_type_of(obj))==="object"&&obj!==null){return Object.fromEntries(Object.entries(obj).map(function(param){var _param=_sliced_to_array$3(param,2),key=_param[0],value=_param[1];return[key,cleanEmptyEntries(value)]}))}return obj};return cleanEmptyEntries(groupedObj)};var formatFormData=function(formData){var formattedData={};for(var key in formData){if(formData.hasOwnProperty(key)){var value=formData[key];if(key.toLowerCase().includes("password"))formattedData[key]=value;else if(value==="true"||value==="false")formattedData[key]=value==="true";else if(value==="")formattedData[key]=null;else if(key.includes("phone_number")||key.includes("phoneNumber")||key.includes("barcode")){formattedData[key]=value}else if(/^\d{4}-\d{2}-\d{2}$/.test(value)){var date=new Date(value);formattedData[key]=date.toISOString()}else if(!isNaN(Number(value)))formattedData[key]=Number(value);else formattedData[key]=value}}return groupKeys(formattedData)};function _array_like_to_array$2(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$2(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator$2(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$2(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _iterable_to_array_limit$2(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$2(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$2(arr,i){return _array_with_holes$2(arr)||_iterable_to_array_limit$2(arr,i)||_unsupported_iterable_to_array$2(arr,i)||_non_iterable_rest$2()}function _unsupported_iterable_to_array$2(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$2(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$2(o,minLen)}function _ts_generator$2(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}var Form=function(props){var children=props.children,className=props.elementName,classes=props.classes,_props_data=props.data,_props_data_type=_props_data.type,type=_props_data_type===void 0?"login":_props_data_type,_props_data_redirectUrl=_props_data.redirectUrl,redirectUrl=_props_data_redirectUrl===void 0?undefined:_props_data_redirectUrl,_props_data_successMessage=_props_data.successMessage,successMessage=_props_data_successMessage===void 0?"":_props_data_successMessage,_props_data_errorMessage=_props_data.errorMessage,errorMessage=_props_data_errorMessage===void 0?"":_props_data_errorMessage,_props_data_resetAfterSubmit=_props_data.resetAfterSubmit,resetAfterSubmit=_props_data_resetAfterSubmit===void 0?false:_props_data_resetAfterSubmit;var onFormSubmit=AuthContext.useAuthHandlers().onFormSubmit;var _React_useState=_sliced_to_array$2(React__namespace.useState(false),2),isLoading=_React_useState[0],setIsLoading=_React_useState[1];var _React_useState1=_sliced_to_array$2(React__namespace.useState(false),2),success=_React_useState1[0],setSuccess=_React_useState1[1];var _React_useState2=_sliced_to_array$2(React__namespace.useState([]),2),error=_React_useState2[0],setError=_React_useState2[1];var handleSubmit=React__namespace.useCallback(/*#__PURE__*/function(){var _ref=_async_to_generator$2(function(e){var formData,_iteratorNormalCompletion,_didIteratorError,_iteratorError,_iterator,_step,input,formEntries,formValues,actions,handleResponse,isSuccessful,form;return _ts_generator$2(this,function(_state){switch(_state.label){case 0:e.preventDefault();formData=new FormData(e.target);_iteratorNormalCompletion=true,_didIteratorError=false,_iteratorError=undefined;try{for(_iterator=e.target.querySelectorAll("input[type=checkbox]")[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=true){input=_step.value;if(!formData.has(input.name)){formData.append(input.name,"false")}}}catch(err){_didIteratorError=true;_iteratorError=err}finally{try{if(!_iteratorNormalCompletion&&_iterator.return!=null){_iterator.return()}}finally{if(_didIteratorError){throw _iteratorError}}}formEntries=Object.fromEntries(formData.entries());formValues=formatFormData(formEntries);setIsLoading(true);setSuccess(false);setError(null);actions={auth:function(){return Promise.resolve().then(function(){return require("./chunks/auth-a0fcd0d0.js")}).then(function(m){return m.default(onFormSubmit,formValues,type,redirectUrl,errorMessage)})}};handleResponse=function(param){var success=param.success,error=param.error;if(success){setSuccess(true);return true}if(error)setError(error)};return[4,actions.auth()];case 1:isSuccessful=handleResponse.apply(void 0,[_state.sent()]);form=e.target;if(resetAfterSubmit&&isSuccessful){form.reset();form.scrollIntoView({behavior:"smooth"})}setIsLoading(false);return[2]}})});return function(e){return _ref.apply(this,arguments)}}(),[resetAfterSubmit,onFormSubmit,type,redirectUrl,errorMessage]);return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("form",{className:clsx(classes,className),onSubmit:handleSubmit,children:[React__namespace.Children.map(children,function(child){if(child.props.elementType==="FormButton"){return /*#__PURE__*/React__namespace.cloneElement(child,{className:"".concat(classes,"Button ").concat(className,"Button"),isLoading:isLoading,success:success,error:error})}return child}),type==="newsletter"&&/*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs(AuthContext.jsxRuntimeExports.Fragment,{children:[success&&/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("p",{className:clsx("".concat(classes,"Success"),"".concat(className,"Success")),children:successMessage}),error&&(error===null||error===void 0?void 0:error.map(function(value,idx){return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("p",{className:clsx("".concat(classes,"Error"),"".concat(className,"Error")),children:value},idx)}))]})]})};Form.propTypes={children:AuthContext.PropTypes.node,className:AuthContext.PropTypes.string};function _array_like_to_array$1(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes$1(arr){if(Array.isArray(arr))return arr}function _define_property$2(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit$1(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest$1(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array$1(arr,i){return _array_with_holes$1(arr)||_iterable_to_array_limit$1(arr,i)||_unsupported_iterable_to_array$1(arr,i)||_non_iterable_rest$1()}function _unsupported_iterable_to_array$1(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array$1(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array$1(o,minLen)}var FormField=function(props){var children=props.children,className=props.elementName,_props_data=props.data,label=_props_data.label,name=_props_data.name,_props_data_type=_props_data.type,type=_props_data_type===void 0?"text":_props_data_type,_props_data_placeholder=_props_data.placeholder,placeholder=_props_data_placeholder===void 0?"Field":_props_data_placeholder,_props_data_regex=_props_data.regex,regex=_props_data_regex===void 0?undefined:_props_data_regex,_props_data_required=_props_data.required,required=_props_data_required===void 0?false:_props_data_required,disable=_props_data.disable,_props_data_readOnly=_props_data.readOnly,readOnly=_props_data_readOnly===void 0?false:_props_data_readOnly,_props_data_disableFilled=_props_data.disableFilled,disableFilled=_props_data_disableFilled===void 0?false:_props_data_disableFilled,_props_data_prefix=_props_data.prefix,prefix=_props_data_prefix===void 0?undefined:_props_data_prefix,_props_data_maxLength=_props_data.maxLength,maxLength=_props_data_maxLength===void 0?undefined:_props_data_maxLength,tmp=_props_data.defaultValue,defaultValueProp=tmp===void 0?undefined:tmp,_props_data_keepFocus=_props_data.keepFocus,keepFocus=_props_data_keepFocus===void 0?false:_props_data_keepFocus,classes=props.classes;var user=AuthContext.useUser().user;var _React_useState=_sliced_to_array$1(React__namespace.useState(undefined),2),valid=_React_useState[0],setValid=_React_useState[1];var _React_useState1=_sliced_to_array$1(React__namespace.useState(false),2),isFocused=_React_useState1[0],setIsFocused=_React_useState1[1];var handleChange=function(e){var value=e.target.value;if(prefix&&!(value===null||value===void 0?void 0:value.startsWith(prefix))){e.target.value=prefix}if(regex){try{var regexTest=new RegExp(regex);var isValid=regexTest.test(value);if(!isValid){e.target.setCustomValidity("Invalid ".concat(label||name,"."));setValid(false)}else{setValid(true);e.target.setCustomValidity("")}}catch(error){console.error("Error compiling regex:",error)}}};var handleFocus=function(e){if(prefix&&e.target.value==="")e.target.value=prefix;setIsFocused(true)};var handleBlur=function(e){if(prefix&&e.target.value===prefix)e.target.value="";if(e.target.value!==""&&keepFocus)return;setIsFocused(false)};var defaultValue=undefined;if((name===null||name===void 0?void 0:name.includes("user."))&&Object.keys(user||{}).length>0){var _name_split;if(type==="date"){var date=new Date(user[name.split(".")[1]]);var year=date.getFullYear();var month=date.getMonth()+1;var day=date.getDate();defaultValue="".concat(year,"-").concat(month<10?"0".concat(month):month,"-").concat(day<10?"0".concat(day):day)}else defaultValue=user[name===null||name===void 0?void 0:(_name_split=name.split("."))===null||_name_split===void 0?void 0:_name_split[1]]}var getClassName=function(subclass){var _obj;return clsx("".concat(classes).concat(subclass," ").concat(className).concat(subclass),(_obj={},_define_property$2(_obj,"".concat(classes).concat(subclass,"Disabled ").concat(className).concat(subclass,"Disabled"),disable||disableFilled&&defaultValue!==undefined),_define_property$2(_obj,"".concat(classes).concat(subclass,"Valid ").concat(className).concat(subclass,"Valid"),valid===true),_define_property$2(_obj,"".concat(classes).concat(subclass,"Invalid ").concat(className).concat(subclass,"Invalid"),valid===false),_obj))};return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:clsx(classes,className,_define_property$2({},"".concat(classes,"Focused ").concat(className,"Focused"),isFocused)),children:[label&&label!==""&&/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("label",{htmlFor:name,className:getClassName("Label"),children:label}),/*#__PURE__*/AuthContext.jsxRuntimeExports.jsxs("div",{className:getClassName("Container"),children:[/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("input",{className:getClassName("Input"),type:type,name:name,id:"".concat(name,"_").concat(className),placeholder:placeholder,disabled:disable||disableFilled&&defaultValue!==undefined,onChange:handleChange,onFocus:handleFocus,onBlur:handleBlur,required:required,defaultValue:defaultValue||defaultValueProp,maxLength:maxLength,readOnly:readOnly}),children]})]})};FormField.propTypes={children:AuthContext.PropTypes.node,className:AuthContext.PropTypes.string,classes:AuthContext.PropTypes.string,data:AuthContext.PropTypes.shape({label:AuthContext.PropTypes.string,name:AuthContext.PropTypes.string.isRequired,type:AuthContext.PropTypes.string,placeholder:AuthContext.PropTypes.string,regex:AuthContext.PropTypes.string,required:AuthContext.PropTypes.bool,disable:AuthContext.PropTypes.bool,disableFilled:AuthContext.PropTypes.bool})};function _array_like_to_array(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _array_with_holes(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator$1(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep$1(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _define_property$1(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _iterable_to_array_limit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break}}catch(err){_d=true;_e=err}finally{try{if(!_n&&_i["return"]!=null)_i["return"]()}finally{if(_d)throw _e}}return _arr}function _non_iterable_rest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(arr,i){return _array_with_holes(arr)||_iterable_to_array_limit(arr,i)||_unsupported_iterable_to_array(arr,i)||_non_iterable_rest()}function _unsupported_iterable_to_array(o,minLen){if(!o)return;if(typeof o==="string")return _array_like_to_array(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _array_like_to_array(o,minLen)}function _ts_generator$1(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}var BenefitButton=function(props){var children=props.children,classes=props.classes,className=props.className,_props_data=props.data,label=_props_data.label,disabled=_props_data.disabled,couponCode=_props_data.couponCode,costInPoints=_props_data.costInPoints,benefitTypeId=_props_data.benefitTypeId,href=_props_data.href;var _useUser=AuthContext.useUser(),onConsumeStamps=_useUser.onConsumeStamps,user=_useUser.user;var _React_useState=_sliced_to_array(React__namespace.useState(disabled),2),buttonDisabled=_React_useState[0],setButtonDisabled=_React_useState[1];var router;try{var _require=require("next/navigation"),nextUseRouter=_require.useRouter;router=nextUseRouter()}catch(e){router={push:function(url){window.location.href=url}}}React__namespace.useEffect(function(){if(user&&user.points<costInPoints)setButtonDisabled(true);else setButtonDisabled(disabled||false)},[costInPoints,disabled,user]);var handleConsumeStamps=React__namespace.useCallback(/*#__PURE__*/_async_to_generator$1(function(){return _ts_generator$1(this,function(_state){switch(_state.label){case 0:return[4,onConsumeStamps({code:couponCode,benefitTypeId:benefitTypeId})];case 1:_state.sent();if(href)router.push(href);return[2]}})}),[benefitTypeId,couponCode,href,onConsumeStamps,router]);var _obj;return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("button",{type:"button",className:clsx(classes,className,(_obj={},_define_property$1(_obj,"".concat(className,"Disabled"),buttonDisabled),_define_property$1(_obj,"".concat(classes,"Disabled"),buttonDisabled&&classes!==""),_obj)),onClick:handleConsumeStamps,"aria-label":label,disabled:buttonDisabled,"aria-disabled":buttonDisabled,children:children||label})};BenefitButton.propTypes={children:AuthContext.PropTypes.node,classes:AuthContext.PropTypes.string,className:AuthContext.PropTypes.string,data:AuthContext.PropTypes.shape({label:AuthContext.PropTypes.string,disabled:AuthContext.PropTypes.bool,couponCode:AuthContext.PropTypes.string})};function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _async_to_generator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}function _define_property(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}function _ts_generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[op[0]&2,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}if(t[2])_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true}}}var LogoutButton=function(props){var children=props.children,classes=props.classes,className=props.className,_props_data=props.data,_props_data_label=_props_data.label,label=_props_data_label===void 0?"Logout":_props_data_label,_props_data_disabled=_props_data.disabled,disabled=_props_data_disabled===void 0?false:_props_data_disabled,href=_props_data.href;var _useUser=AuthContext.useUser(),isAuthenticated=_useUser.isAuthenticated,onUserLogout=_useUser.onUserLogout;var handleLogout=React__namespace.useCallback(/*#__PURE__*/_async_to_generator(function(){return _ts_generator(this,function(_state){switch(_state.label){case 0:if(!isAuthenticated)return[3,2];return[4,onUserLogout({redirectPath:href})];case 1:_state.sent();_state.label=2;case 2:return[2]}})}),[href,isAuthenticated,onUserLogout]);var _obj;return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx("button",{type:"button",className:clsx(classes,className,(_obj={},_define_property(_obj,"".concat(className,"Disabled"),disabled),_define_property(_obj,"".concat(classes,"Disabled"),disabled&&classes!==""),_obj)),onClick:handleLogout,"aria-label":label,disabled:disabled,"aria-disabled":disabled,children:children||label})};LogoutButton.propTypes={children:AuthContext.PropTypes.node,classes:AuthContext.PropTypes.string,className:AuthContext.PropTypes.string,data:AuthContext.PropTypes.shape({label:AuthContext.PropTypes.string,disabled:AuthContext.PropTypes.bool,href:AuthContext.PropTypes.string})};exports.BenefitButton=BenefitButton;exports.FormField=FormField;exports.LogoutButton=LogoutButton;exports.PhoebeForm=Form;exports.PhoebeUser=PhoebeUser;exports.ProgressBar=ProgressBar;exports.Splash=Splash; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var AuthContext=require("./chunks/AuthContext-b2583ffe.js");require("react");require("./chunks/index-ed929e3a.js");var PhoebeProviders=function(props){var children=props.children,host=props.host,phoebeData=props.phoebeData;var pageElements=children;return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(AuthContext.UserProvider,{host:host,phoebeData:phoebeData,children:/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(AuthContext.AuthProvider,{children:pageElements})})};PhoebeProviders.propTypes={children:AuthContext.PropTypes.node,host:AuthContext.PropTypes.string,apiKey:AuthContext.PropTypes.string};exports.default=PhoebeProviders; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var AuthContext=require("./chunks/AuthContext-93a45c95.js");require("react");require("./chunks/index-ed929e3a.js");var PhoebeProviders=function(props){var children=props.children,host=props.host,phoebeData=props.phoebeData;var pageElements=children;return /*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(AuthContext.UserProvider,{host:host,phoebeData:phoebeData,children:/*#__PURE__*/AuthContext.jsxRuntimeExports.jsx(AuthContext.AuthProvider,{children:pageElements})})};PhoebeProviders.propTypes={children:AuthContext.PropTypes.node,host:AuthContext.PropTypes.string,apiKey:AuthContext.PropTypes.string};exports.default=PhoebeProviders; |
{ | ||
"name": "morph-quest-phb", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Morpheus Quest Phoebe is extension of Morpheus Quest. It is a content management system (CMS) for web development paired with Phoebes loyalty.", | ||
@@ -5,0 +5,0 @@ "author": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
162638
635