woocommerce/error-boundary-stories-erro...

1 line
31 KiB
JavaScript

"use strict";(self.webpackChunk_woocommerce_storybook=self.webpackChunk_woocommerce_storybook||[]).push([[2590],{"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _assertThisInitialized(self){if(void 0===self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return self}__webpack_require__.d(__webpack_exports__,{A:()=>_assertThisInitialized})},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/classCallCheck.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}__webpack_require__.d(__webpack_exports__,{A:()=>_classCallCheck})},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/createClass.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>_createClass});var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,(0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__.A)(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Object.defineProperty(Constructor,"prototype",{writable:!1}),Constructor}},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/defineProperty.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>_defineProperty});var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js");function _defineProperty(obj,key,value){return(key=(0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__.A)(key))in obj?Object.defineProperty(obj,key,{value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _getPrototypeOf(o){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o)},_getPrototypeOf(o)}__webpack_require__.d(__webpack_exports__,{A:()=>_getPrototypeOf})},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/inherits.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>_inherits});var _setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js");function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function");subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:!0,configurable:!0}}),Object.defineProperty(subClass,"prototype",{writable:!1}),superClass&&(0,_setPrototypeOf_js__WEBPACK_IMPORTED_MODULE_0__.A)(subClass,superClass)}},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>_possibleConstructorReturn});var _typeof_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/typeof.js"),_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js");function _possibleConstructorReturn(self,call){if(call&&("object"===(0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__.A)(call)||"function"==typeof call))return call;if(void 0!==call)throw new TypeError("Derived constructors may only return object or undefined");return(0,_assertThisInitialized_js__WEBPACK_IMPORTED_MODULE_1__.A)(self)}},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _setPrototypeOf(o,p){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){return o.__proto__=p,o},_setPrototypeOf(o,p)}__webpack_require__.d(__webpack_exports__,{A:()=>_setPrototypeOf})},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>_toPropertyKey});var esm_typeof=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/typeof.js");function _toPropertyKey(arg){var key=function _toPrimitive(input,hint){if("object"!==(0,esm_typeof.A)(input)||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!==(0,esm_typeof.A)(res))return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"===(0,esm_typeof.A)(key)?key:String(key)}},"../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/typeof.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}__webpack_require__.d(__webpack_exports__,{A:()=>_typeof})},"../../packages/js/components/src/empty-content/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{A:()=>__WEBPACK_DEFAULT_EXPORT__});__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.object.to-string.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.reflect.construct.js");var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/classCallCheck.js"),_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/createClass.js"),_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/inherits.js"),_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js"),_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js"),_wordpress_components__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("../../node_modules/.pnpm/@wordpress+components@19.8.5_@types+react@17.0.71_react-dom@17.0.2_react@17.0.2__react-with-d_oli5xz3n7pc4ztqokra47llglu/node_modules/@wordpress/components/build-module/button/index.js"),_wordpress_element__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("../../node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.js"),classnames__WEBPACK_IMPORTED_MODULE_4___default=__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_4__),prop_types__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__("../../node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js"),prop_types__WEBPACK_IMPORTED_MODULE_11___default=__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_11__),_section__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__("../../packages/js/components/src/section/header.tsx");function _createSuper(Derived){var hasNativeReflectConstruct=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function _createSuperInternal(){var result,Super=(0,_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_2__.A)(Derived);if(hasNativeReflectConstruct){var NewTarget=(0,_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_2__.A)(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return(0,_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_3__.A)(this,result)}}var EmptyContent=function(_Component){(0,_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_5__.A)(EmptyContent,_Component);var _super=_createSuper(EmptyContent);function EmptyContent(){return(0,_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_6__.A)(this,EmptyContent),_super.apply(this,arguments)}return(0,_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_7__.A)(EmptyContent,[{key:"renderIllustration",value:function renderIllustration(){var _this$props=this.props,illustrationWidth=_this$props.illustrationWidth,illustrationHeight=_this$props.illustrationHeight,illustration=_this$props.illustration;return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)("img",{alt:"",src:illustration,width:illustrationWidth,height:illustrationHeight,className:"woocommerce-empty-content__illustration"})}},{key:"renderActionButtons",value:function renderActionButtons(type){var actionLabel="secondary"===type?this.props.secondaryActionLabel:this.props.actionLabel,actionURL="secondary"===type?this.props.secondaryActionURL:this.props.actionURL,actionCallback="secondary"===type?this.props.secondaryActionCallback:this.props.actionCallback,buttonVariant="secondary"!==type?"primary":"secondary";return actionURL&&actionCallback?(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__.A,{className:"woocommerce-empty-content__action",variant:buttonVariant,onClick:actionCallback,href:actionURL},actionLabel):actionURL?(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__.A,{className:"woocommerce-empty-content__action",variant:buttonVariant,href:actionURL},actionLabel):actionCallback?(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)(_wordpress_components__WEBPACK_IMPORTED_MODULE_9__.A,{className:"woocommerce-empty-content__action",variant:buttonVariant,onClick:actionCallback},actionLabel):null}},{key:"renderActions",value:function renderActions(){var _this$props2=this.props,actionLabel=_this$props2.actionLabel,secondaryActionLabel=_this$props2.secondaryActionLabel;return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)("div",{className:"woocommerce-empty-content__actions"},actionLabel&&this.renderActionButtons("primary"),secondaryActionLabel&&this.renderActionButtons("secondary"))}},{key:"render",value:function render(){var _this$props3=this.props,className=_this$props3.className,title=_this$props3.title,message=_this$props3.message,illustration=_this$props3.illustration;return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)("div",{className:classnames__WEBPACK_IMPORTED_MODULE_4___default()("woocommerce-empty-content",className)},illustration&&this.renderIllustration(),title?(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)(_section__WEBPACK_IMPORTED_MODULE_10__.H,{className:"woocommerce-empty-content__title"},title):null,message?(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.createElement)("p",{className:"woocommerce-empty-content__message"},message):null,this.renderActions())}}]),EmptyContent}(_wordpress_element__WEBPACK_IMPORTED_MODULE_8__.Component);EmptyContent.propTypes={title:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string.isRequired,message:prop_types__WEBPACK_IMPORTED_MODULE_11___default().node,illustration:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string,illustrationHeight:prop_types__WEBPACK_IMPORTED_MODULE_11___default().number,illustrationWidth:prop_types__WEBPACK_IMPORTED_MODULE_11___default().number,actionLabel:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string.isRequired,actionURL:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string,actionCallback:prop_types__WEBPACK_IMPORTED_MODULE_11___default().func,secondaryActionLabel:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string,secondaryActionURL:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string,secondaryActionCallback:prop_types__WEBPACK_IMPORTED_MODULE_11___default().func,className:prop_types__WEBPACK_IMPORTED_MODULE_11___default().string},EmptyContent.defaultProps={illustration:'data:image/svg+xml;utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 400"%3E%3Cpath d="M226.153073,88.3099993 L355.380187,301.446227 C363.970299,315.614028 359.448689,334.062961 345.280888,342.653073 C340.591108,345.496544 335.21158,347 329.727115,347 L71.2728854,347 C54.7043429,347 41.2728854,333.568542 41.2728854,317 C41.2728854,311.515534 42.7763415,306.136007 45.6198127,301.446227 L174.846927,88.3099993 C183.437039,74.1421985 201.885972,69.6205881 216.053773,78.2106999 C220.184157,80.7150022 223.64877,84.1796157 226.153073,88.3099993 Z M184.370159,153 L186.899684,255.024156 L213.459691,255.024156 L215.989216,153 L184.370159,153 Z M200.179688,307.722584 C209.770801,307.722584 217.359375,300.450201 217.359375,291.175278 C217.359375,281.900355 209.770801,274.627972 200.179688,274.627972 C190.588574,274.627972 183,281.900355 183,291.175278 C183,300.450201 190.588574,307.722584 200.179688,307.722584 Z" id="Combined-Shape" stroke="%23c0c0c0" fill="%23c0c0c0" fill-rule="nonzero"%3E%3C/path%3E%3C/svg%3E',illustrationWidth:100};const __WEBPACK_DEFAULT_EXPORT__=EmptyContent},"../../packages/js/components/src/section/context.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{$:()=>Level});var Level=(0,__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js").createContext)(2)},"../../packages/js/components/src/section/header.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{H:()=>H});var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),_context__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../packages/js/components/src/section/context.tsx");function H(props){var level=(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.useContext)(_context__WEBPACK_IMPORTED_MODULE_1__.$),Heading="h"+Math.min(level,6);return(0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Heading,props)}try{H.displayName="H",H.__docgenInfo={description:'These components are used to frame out the page content for accessible heading hierarchy. Instead of defining fixed heading levels\n(`h2`, `h3`, …) you can use `<H />` to create "section headings", which look to the parent `<Section />`s for the appropriate\nheading level.',displayName:"H",props:{}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/js/components/src/section/header.tsx#H"]={docgenInfo:H.__docgenInfo,name:"H",path:"../../packages/js/components/src/section/header.tsx#H"})}catch(__react_docgen_typescript_loader_error){}},"../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind.js":(module,__unused_webpack_exports,__webpack_require__)=>{var uncurryThis=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-uncurry-this.js"),aCallable=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/a-callable.js"),isObject=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-object.js"),hasOwn=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/has-own-property.js"),arraySlice=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/array-slice.js"),NATIVE_BIND=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind-native.js"),$Function=Function,concat=uncurryThis([].concat),join=uncurryThis([].join),factories={};module.exports=NATIVE_BIND?$Function.bind:function bind(that){var F=aCallable(this),Prototype=F.prototype,partArgs=arraySlice(arguments,1),boundFunction=function bound(){var args=concat(partArgs,arraySlice(arguments));return this instanceof boundFunction?function(C,argsLength,args){if(!hasOwn(factories,argsLength)){for(var list=[],i=0;i<argsLength;i++)list[i]="a["+i+"]";factories[argsLength]=$Function("C,a","return new C("+join(list,",")+")")}return factories[argsLength](C,args)}(F,args.length,args):F.apply(that,args)};return isObject(Prototype)&&(boundFunction.prototype=Prototype),boundFunction}},"../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.function.bind.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{var $=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js"),bind=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind.js");$({target:"Function",proto:!0,forced:Function.bind!==bind},{bind})},"../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.reflect.construct.js":(__unused_webpack_module,__unused_webpack_exports,__webpack_require__)=>{var $=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/export.js"),getBuiltIn=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/get-built-in.js"),apply=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-apply.js"),bind=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/function-bind.js"),aConstructor=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/a-constructor.js"),anObject=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/an-object.js"),isObject=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/is-object.js"),create=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/object-create.js"),fails=__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/internals/fails.js"),nativeConstruct=getBuiltIn("Reflect","construct"),ObjectPrototype=Object.prototype,push=[].push,NEW_TARGET_BUG=fails((function(){function F(){}return!(nativeConstruct((function(){}),[],F)instanceof F)})),ARGS_BUG=!fails((function(){nativeConstruct((function(){}))})),FORCED=NEW_TARGET_BUG||ARGS_BUG;$({target:"Reflect",stat:!0,forced:FORCED,sham:FORCED},{construct:function construct(Target,args){aConstructor(Target),anObject(args);var newTarget=arguments.length<3?Target:aConstructor(arguments[2]);if(ARGS_BUG&&!NEW_TARGET_BUG)return nativeConstruct(Target,args,newTarget);if(Target===newTarget){switch(args.length){case 0:return new Target;case 1:return new Target(args[0]);case 2:return new Target(args[0],args[1]);case 3:return new Target(args[0],args[1],args[2]);case 4:return new Target(args[0],args[1],args[2],args[3])}var $args=[null];return apply(push,$args,args),new(apply(bind,Target,$args))}var proto=newTarget.prototype,instance=create(isObject(proto)?proto:ObjectPrototype),result=apply(Target,instance,args);return isObject(result)?result:instance}})},"../../packages/js/components/src/error-boundary/stories/error-boundary.story.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{CustomActionCallback:()=>CustomActionCallback,CustomActionLabel:()=>CustomActionLabel,CustomErrorMessage:()=>CustomErrorMessage,Default:()=>Default,WithoutActionButton:()=>WithoutActionButton,default:()=>error_boundary_story});var react=__webpack_require__("../../node_modules/.pnpm/react@18.3.1/node_modules/react/index.js"),classCallCheck=(__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.function.bind.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.object.to-string.js"),__webpack_require__("../../node_modules/.pnpm/core-js@3.34.0/node_modules/core-js/modules/es.reflect.construct.js"),__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/classCallCheck.js")),createClass=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/createClass.js"),assertThisInitialized=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js"),inherits=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/inherits.js"),possibleConstructorReturn=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js"),getPrototypeOf=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js"),defineProperty=__webpack_require__("../../node_modules/.pnpm/@babel+runtime@7.23.5/node_modules/@babel/runtime/helpers/esm/defineProperty.js"),build_module=__webpack_require__("../../node_modules/.pnpm/@wordpress+i18n@4.6.1/node_modules/@wordpress/i18n/build-module/index.js"),empty_content=__webpack_require__("../../packages/js/components/src/empty-content/index.js");function _createSuper(Derived){var hasNativeReflectConstruct=function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function _createSuperInternal(){var result,Super=(0,getPrototypeOf.A)(Derived);if(hasNativeReflectConstruct){var NewTarget=(0,getPrototypeOf.A)(this).constructor;result=Reflect.construct(Super,arguments,NewTarget)}else result=Super.apply(this,arguments);return(0,possibleConstructorReturn.A)(this,result)}}var ErrorBoundary=function(_Component){(0,inherits.A)(ErrorBoundary,_Component);var _super=_createSuper(ErrorBoundary);function ErrorBoundary(props){var _this;return(0,classCallCheck.A)(this,ErrorBoundary),_this=_super.call(this,props),(0,defineProperty.A)((0,assertThisInitialized.A)(_this),"handleReload",(function(){window.location.reload()})),(0,defineProperty.A)((0,assertThisInitialized.A)(_this),"handleAction",(function(){var _this$props=_this.props,actionCallback=_this$props.actionCallback,resetErrorAfterAction=_this$props.resetErrorAfterAction;actionCallback?actionCallback(_this.state.error):_this.handleReload(),resetErrorAfterAction&&_this.setState({hasError:!1,error:null,errorInfo:null})})),_this.state={hasError:!1,error:null,errorInfo:null},_this}return(0,createClass.A)(ErrorBoundary,[{key:"componentDidCatch",value:function componentDidCatch(_error,errorInfo){this.setState({errorInfo}),this.props.onError&&this.props.onError(_error,errorInfo)}},{key:"render",value:function render(){var _this$props2=this.props,children=_this$props2.children,errorMessage=_this$props2.errorMessage,showActionButton=_this$props2.showActionButton,actionLabel=_this$props2.actionLabel;return this.state.hasError?(0,react.createElement)("div",{className:"woocommerce-error-boundary"},(0,react.createElement)(empty_content.A,{title:"",actionLabel:"",message:errorMessage||(0,build_module.__)("Oops, something went wrong. Please try again","woocommerce"),secondaryActionLabel:actionLabel||(0,build_module.__)("Reload","woocommerce"),secondaryActionURL:null,secondaryActionCallback:showActionButton?this.handleAction:void 0,illustrationWidth:36,illustrationHeight:36,illustration:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHZpZXdCb3g9IjAgMCAyMCAyMCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTguNTc0NjUgMy4yMTYzNUwxLjUxNjMyIDE0Ljk5OTdDMS4zNzA3OSAxNS4yNTE3IDEuMjkzNzkgMTUuNTM3NCAxLjI5Mjk4IDE1LjgyODRDMS4yOTIxNiAxNi4xMTk1IDEuMzY3NTYgMTYuNDA1NiAxLjUxMTY3IDE2LjY1ODVDMS42NTU3OSAxNi45MTEzIDEuODYzNTkgMTcuMTIyIDIuMTE0NDEgMTcuMjY5NkMyLjM2NTIzIDE3LjQxNzEgMi42NTAzMiAxNy40OTY1IDIuOTQxMzIgMTcuNDk5N0gxNy4wNThDMTcuMzQ5IDE3LjQ5NjUgMTcuNjM0MSAxNy40MTcxIDE3Ljg4NDkgMTcuMjY5NkMxOC4xMzU3IDE3LjEyMiAxOC4zNDM1IDE2LjkxMTMgMTguNDg3NiAxNi42NTg1QzE4LjYzMTcgMTYuNDA1NiAxOC43MDcxIDE2LjExOTUgMTguNzA2MyAxNS44Mjg0QzE4LjcwNTUgMTUuNTM3NCAxOC42Mjg1IDE1LjI1MTcgMTguNDgzIDE0Ljk5OTdMMTEuNDI0NyAzLjIxNjM1QzExLjI3NjEgMi45NzE0NCAxMS4wNjY5IDIuNzY4OTUgMTAuODE3MyAyLjYyODQyQzEwLjU2NzcgMi40ODc4OSAxMC4yODYxIDIuNDE0MDYgOS45OTk2NSAyLjQxNDA2QzkuNzEzMjEgMi40MTQwNiA5LjQzMTU5IDIuNDg3ODkgOS4xODE5OSAyLjYyODQyQzguOTMyMzggMi43Njg5NSA4LjcyMzIxIDIuOTcxNDQgOC41NzQ2NSAzLjIxNjM1VjMuMjE2MzVaIiBzdHJva2U9IiMxZTFlMWUiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xMCA3LjVWMTAuODMzMyIgc3Ryb2tlPSIjMWUxZTFlIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgo8cGF0aCBkPSJNMTAgMTQuMTY4SDEwLjAwODMiIHN0cm9rZT0iIzFlMWUxZSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+Cg=="})):children}}],[{key:"getDerivedStateFromError",value:function getDerivedStateFromError(error){return{hasError:!0,error}}}]),ErrorBoundary}(react.Component);(0,defineProperty.A)(ErrorBoundary,"defaultProps",{showActionButton:!0,resetErrorAfterAction:!0});try{ErrorBoundary.displayName="ErrorBoundary",ErrorBoundary.__docgenInfo={description:"",displayName:"ErrorBoundary",props:{children:{defaultValue:null,description:"The content to be rendered inside the ErrorBoundary component.",name:"children",required:!1,type:{name:"ReactNode"}},errorMessage:{defaultValue:null,description:"The custom error message to be displayed. Defaults to a generic message.",name:"errorMessage",required:!1,type:{name:"ReactNode"}},showActionButton:{defaultValue:{value:"true"},description:"Determines whether to show an action button. Defaults to true.",name:"showActionButton",required:!1,type:{name:"boolean"}},actionLabel:{defaultValue:null,description:"The label to be used for the action button. Defaults to 'Reload'.",name:"actionLabel",required:!1,type:{name:"string"}},actionCallback:{defaultValue:null,description:"The callback function to be executed when the action button is clicked. Defaults to window.location.reload.\n@param error - The error that was caught.",name:"actionCallback",required:!1,type:{name:"((error: Error) => void)"}},resetErrorAfterAction:{defaultValue:{value:"true"},description:"Determines whether to reset the error boundary state after the action is performed. Defaults to true.",name:"resetErrorAfterAction",required:!1,type:{name:"boolean"}},onError:{defaultValue:null,description:"Callback function to be executed when an error is caught.\n@param error - The error that was caught.\n@param errorInfo - The error info object.",name:"onError",required:!1,type:{name:"((error: Error, errorInfo: ErrorInfo) => void)"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["../../packages/js/components/src/error-boundary/index.tsx#ErrorBoundary"]={docgenInfo:ErrorBoundary.__docgenInfo,name:"ErrorBoundary",path:"../../packages/js/components/src/error-boundary/index.tsx#ErrorBoundary"})}catch(__react_docgen_typescript_loader_error){}var ChildComponent=function ChildComponent(){throw new Error("This is a test error")},Template=function Template(args){return(0,react.createElement)(ErrorBoundary,args,(0,react.createElement)(ChildComponent,null))},Default=Template.bind({});Default.args={};var CustomErrorMessage=Template.bind({});CustomErrorMessage.args={errorMessage:"Custom error message"};var WithoutActionButton=Template.bind({});WithoutActionButton.args={showActionButton:!1};var CustomActionLabel=Template.bind({});CustomActionLabel.args={actionLabel:"Retry"};var CustomActionCallback=Template.bind({});CustomActionCallback.args={actionCallback:function actionCallback(){window.alert("Custom action callback triggered")}};const error_boundary_story={title:"WooCommerce Admin/experimental/Error Boundary",component:ErrorBoundary,argTypes:{errorMessage:{control:"text",defaultValue:"Oops, something went wrong. Please try again"},showActionButton:{control:"boolean",defaultValue:!0},actionLabel:{control:"text",defaultValue:"Reload"},actionCallback:{action:"clicked"}}};Default.parameters={...Default.parameters,docs:{...Default.parameters?.docs,source:{originalSource:"args => <ErrorBoundary {...args}>\n <ChildComponent />\n </ErrorBoundary>",...Default.parameters?.docs?.source}}},CustomErrorMessage.parameters={...CustomErrorMessage.parameters,docs:{...CustomErrorMessage.parameters?.docs,source:{originalSource:"args => <ErrorBoundary {...args}>\n <ChildComponent />\n </ErrorBoundary>",...CustomErrorMessage.parameters?.docs?.source}}},WithoutActionButton.parameters={...WithoutActionButton.parameters,docs:{...WithoutActionButton.parameters?.docs,source:{originalSource:"args => <ErrorBoundary {...args}>\n <ChildComponent />\n </ErrorBoundary>",...WithoutActionButton.parameters?.docs?.source}}},CustomActionLabel.parameters={...CustomActionLabel.parameters,docs:{...CustomActionLabel.parameters?.docs,source:{originalSource:"args => <ErrorBoundary {...args}>\n <ChildComponent />\n </ErrorBoundary>",...CustomActionLabel.parameters?.docs?.source}}},CustomActionCallback.parameters={...CustomActionCallback.parameters,docs:{...CustomActionCallback.parameters?.docs,source:{originalSource:"args => <ErrorBoundary {...args}>\n <ChildComponent />\n </ErrorBoundary>",...CustomActionCallback.parameters?.docs?.source}}}}}]);