forked from BuilderIO/demo-editor
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path267.af8cf498.chunk.js.download
1 lines (1 loc) · 8.43 KB
/
267.af8cf498.chunk.js.download
1
(this["webpackJsonp@builder.io/app"]=this["webpackJsonp@builder.io/app"]||[]).push([[267],{3169:function(module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__(49);Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireDefault(__webpack_require__(3)),_createSvgIcon=_interopRequireDefault(__webpack_require__(51)),_default=(0,_createSvgIcon.default)(_react.default.createElement("g",null,_react.default.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})),"Error");exports.default=_default},3213:function(module,exports,__webpack_require__){"use strict";var _interopRequireDefault=__webpack_require__(49);Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _react=_interopRequireDefault(__webpack_require__(3)),_createSvgIcon=_interopRequireDefault(__webpack_require__(51)),_default=(0,_createSvgIcon.default)(_react.default.createElement("g",null,_react.default.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"})),"Info");exports.default=_default},6347:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var tslib__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5),_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(0),_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(40),_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_2___default=__webpack_require__.n(_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_2__),mobx__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__(4),mobx_react__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__(16),react__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__(3),react__WEBPACK_IMPORTED_MODULE_5___default=__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__),_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__(1),_classes_destroyable_component_class__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__(52),_material_ui_icons__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__(3169),_material_ui_icons__WEBPACK_IMPORTED_MODULE_8___default=__webpack_require__.n(_material_ui_icons__WEBPACK_IMPORTED_MODULE_8__),_material_ui_icons__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__(3213),_material_ui_icons__WEBPACK_IMPORTED_MODULE_9___default=__webpack_require__.n(_material_ui_icons__WEBPACK_IMPORTED_MODULE_9__),_constants_theme_constant__WEBPACK_IMPORTED_MODULE_10__=__webpack_require__(7),_functions_track_function__WEBPACK_IMPORTED_MODULE_11__=__webpack_require__(14),_functions_capitalize_function__WEBPACK_IMPORTED_MODULE_12__=__webpack_require__(394);const DAYS_THRESHOLD=10;let TrialSnackbar=class extends _classes_destroyable_component_class__WEBPACK_IMPORTED_MODULE_7__.a{constructor(){super(...arguments),this.move=!0}get showSnackbar(){var _a,_b;const hasCompletedOnboarding=(_a=_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.settings)===null||_a===void 0?void 0:_a.value.hasCompletedOnboarding,isPayingSubscriber=(_b=_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.subscriptionInfo)===null||_b===void 0?void 0:_b.price,expired=_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.trialExpired,days=_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.trialDaysLeft,isDeveloperStore=!!(_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.isShopify&&_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.shopify.isDeveloperAffiliateStore);return!_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.isShopify&&expired?!1:hasCompletedOnboarding&&(_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.isTrial&&days<DAYS_THRESHOLD||expired)&&!isDeveloperStore&&!isPayingSubscriber}componentDidMount(){const hideUntilDate=parseInt(localStorage.getItem("hideTrialSnackbar")||"",10);!(isNaN(hideUntilDate)?!1:hideUntilDate>Date.now())&&this.showSnackbar&&setTimeout(()=>{this.move=!1},5e3),this.safeReaction(()=>_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.trialExpired,expired=>{expired&&Object(_functions_track_function__WEBPACK_IMPORTED_MODULE_11__.c)("trialExpired")})}async handleDismiss(){if(this.move=!0,_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.trialExpired)await fetch(`${_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.config.apiRoot()}/api/v1/organizations?apiKey=${_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.apiKey}`,{method:"PATCH",body:JSON.stringify({dismissTrial:!0}),headers:_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.authHeaders}),Object(_functions_track_function__WEBPACK_IMPORTED_MODULE_11__.c)("trialOptOut");else{const days=_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.trialDaysLeft;let daysToHideFor;days>=14?daysToHideFor=7:days>7?daysToHideFor=days-7:daysToHideFor=1,localStorage.setItem("hideTrialSnackbar",String(Date.now()+daysToHideFor*1e3*60*60*24))}}render(){var _a,_b,_c;const days=_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.trialDaysLeft,expired=_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.trialExpired,{small}=_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.document,subscriptionTrialName=(_c=(_b=(_a=_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.user.organization)===null||_a===void 0?void 0:_a.value)===null||_b===void 0?void 0:_b.trialName)!==null&&_c!==void 0?_c:"growth";return this.showSnackbar?Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.c)("div",Object.assign({css:{backgroundColor:expired?"var(--red)":_constants_theme_constant__WEBPACK_IMPORTED_MODULE_10__.a.colors.primaryDark,textAlign:"center",color:"white",position:"fixed",width:"100vw",bottom:0,padding:15,boxShadow:"0 0 2px rgb(0 0 0 / 70%)",zIndex:1e4,transition:"transform 0.3s var(--smooth), opacity 0.3s var(--smooth) !important",transform:this.move?`translate3d(0, ${small?"160px":"100px"}, 0)`:"none",display:"flex",flexDirection:small?"column":"row",justifyContent:"center",alignItems:"center"}},{children:[Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.c)("div",Object.assign({css:{display:"flex",alignItems:"center",justifyContent:"center",margin:"0 20px"}},{children:[expired?Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_icons__WEBPACK_IMPORTED_MODULE_8___default.a,{css:{marginRight:15}}):Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_icons__WEBPACK_IMPORTED_MODULE_9___default.a,{css:{marginRight:15}}),expired?"Your trial has expired":Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.c)(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.a,{children:["Your ",Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.c)("b",Object.assign({css:{margin:"0 3px"}},{children:[" ",Object(_functions_capitalize_function__WEBPACK_IMPORTED_MODULE_12__.a)(subscriptionTrialName)," Plan "]}))," trial ends in ",days," days"]})]})),Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_2___default.a,Object.assign({onClick:e=>{e.stopPropagation(),_constants_app_state_constant__WEBPACK_IMPORTED_MODULE_6__.appState.globalState.showUpgradeDialog(void 0,"trial snackbar")},css:Object.assign({pointerEvents:"auto",color:_constants_theme_constant__WEBPACK_IMPORTED_MODULE_10__.a.colors.primaryDark,backgroundColor:"var(--background)"},small&&{width:"calc(100vw - 90px)",marginTop:10,marginBottom:10}),variant:"contained"},{children:days<=7?"Subscribe":"Learn More"})),Object(_emotion_react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.b)(_material_ui_core_Button__WEBPACK_IMPORTED_MODULE_2___default.a,Object.assign({css:{marginLeft:small?0:15,color:"white",opacity:.9},onClick:()=>this.handleDismiss()},{children:"Dismiss"}))]})):null}};Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)([mobx__WEBPACK_IMPORTED_MODULE_3__.observable],TrialSnackbar.prototype,"move",void 0),Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)([mobx__WEBPACK_IMPORTED_MODULE_3__.computed],TrialSnackbar.prototype,"showSnackbar",null),TrialSnackbar=Object(tslib__WEBPACK_IMPORTED_MODULE_0__.a)([mobx_react__WEBPACK_IMPORTED_MODULE_4__.observer],TrialSnackbar),__webpack_exports__.default=TrialSnackbar}}]);