@tiendanube/nexo 1.2.1 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,14 @@
1
+ ---
2
+ alwaysApply: true
3
+ always_on: true
4
+ trigger: always_on
5
+ applyTo: "**"
6
+ description: Snyk Security At Inception
7
+ ---
8
+
9
+ # Project security best practices
10
+
11
+ - Always run snyk_code_scan tool for new first party code that is generated in a Snyk-supported language.
12
+ - If any security issues are found based on newly introduced or modified code or dependencies, attempt to fix the issues using the results context from Snyk.
13
+ - Rescan the code after fixing the issues to ensure that the issues were fixed and that there are no newly introduced issues.
14
+ - Repeat this process until no new issues are found.
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ 18
package/CHANGELOG.md CHANGED
@@ -1,6 +1,63 @@
1
1
  # Changelog
2
2
 
3
- Nexo provides resources to facilitate communication between an external application and the Nuvemshop administrator. This interaction between the admin and the app is established through messages, following the observer pattern, allowing for event subscription and unsubscription.
3
+ Nexo provides resources to facilitate communication between an external application and the Nuvemshop administrator. This interaction between the admin and the app is established through the observer pattern, allowing for event subscription and unsubscription.
4
+
5
+ ## 2025-06-30 `1.2.1`
6
+
7
+ #### 🎉 New features
8
+
9
+ - **feat**: Added store feature validation and upsell related helpers. ([#29](https://github.com/TiendaNube/admin-nexo/pull/29) by [@matiasmcf](https://github.com/matiasmcf))
10
+ - Added actions and types for upsell related functionality
11
+ - Added comprehensive helpers for upsell related flows
12
+ - **feat**: Added fullscreen support for enhanced user experience. ([#28](https://github.com/TiendaNube/admin-nexo/pull/28) by [@cristian-preiti](https://github.com/cristian-preiti))
13
+
14
+ #### 🐛 Bug fixes
15
+
16
+ - **fix**: Exported new types for upsell related flows to ensure proper TypeScript support. ([#31](https://github.com/TiendaNube/admin-nexo/pull/31) by [@matiasmcf](https://github.com/matiasmcf))
17
+
18
+ ## 2024-11-01 `1.1.0+`
19
+
20
+ #### 🎉 New features
21
+
22
+ - **Admin Info**: Added user ID in store info response for enhanced admin identification. ([#26](https://github.com/TiendaNube/admin-nexo/pull/26) by [@carlos-montes](https://github.com/carlos-montes))
23
+ - **Store Info Enhancement**: Added available languages and admin name in store info response. ([#24](https://github.com/TiendaNube/admin-nexo/pull/24) by [@carlos-montes](https://github.com/carlos-montes))
24
+ - Added available languages list
25
+ - Included admin name and roles information
26
+ - Enhanced store information response with admin details
27
+
28
+ ## 2024-02-01 `0.3.0`
29
+
30
+ #### 🎉 New features
31
+
32
+ - **Device Browser Support**: Added new event to open content in device browser for better mobile experience. ([#19](https://github.com/TiendaNube/admin-nexo/pull/19) by [@caio-cares](https://github.com/caio-cares))
33
+
34
+ ## 2024-01-XX - CI/CD Improvements
35
+
36
+ #### 🔒 Security improvements
37
+
38
+ - **BREAKING**: Replaced unsafe branch protection disabling with secure automated Pull Request workflow. ([PR](https://github.com/TiendaNube/admin-nexo/pull/TBD))
39
+ - Removed insecure `Branch protection OFF/ON` steps that temporarily disabled repository security
40
+ - Implemented automated PR creation for release updates using `peter-evans/create-pull-request`
41
+ - Added intelligent loop prevention to avoid infinite workflow triggers
42
+ - Enhanced commit message formatting with version information
43
+
44
+ #### 📚 3rd party library updates
45
+
46
+ - Updated `actions/checkout` from v2 → v4 for better security and Node.js 20 support
47
+ - Updated `actions/setup-node` from v2 → v4 with integrated yarn cache support
48
+ - Updated `peter-evans/create-pull-request` from v5 → v7 for latest features and security fixes
49
+ - Updated `rickstaa/action-create-tag` from v1 → v1.7.2
50
+ - Updated `8BitJonny/gh-get-current-pr` from v2.2.0 → v3.0.0 for better PR detection
51
+ - Updated `ncipollo/release-action` from v1 → v1.18.0
52
+ - Updated `martinbeentjes/npm-get-version-action` from @main → v1.3.1 (pinned to stable version)
53
+
54
+ #### 💡 Others
55
+
56
+ - Fixed deprecated `--frozen-lockfile` yarn flag, replaced with modern `--immutable` flag
57
+ - Corrected GitHub Actions expression syntax for conditional workflow execution
58
+ - Added comprehensive documentation in English for workflow components
59
+ - Improved workflow reliability with better error handling and status checks
60
+ - Enhanced commit message format using conventional commits (`chore: release vX.Y.Z`)
4
61
 
5
62
  ## 2023-09-11 `1.0.0`
6
63
 
package/dist/index.d.ts CHANGED
@@ -99,6 +99,7 @@ export type RunWithUpsellHelperParams = {
99
99
  featureKey: string;
100
100
  modalTitle: string;
101
101
  trackingSource: string;
102
+ minValue?: number;
102
103
  callback: () => void;
103
104
  onDeclined?: () => void;
104
105
  onPlansRedirect?: () => void;
@@ -109,6 +110,7 @@ export type StoreUpsellRequest = {
109
110
  featureKey: string;
110
111
  modalTitle: string;
111
112
  trackingSource: string;
113
+ minValue?: number;
112
114
  };
113
115
  export type StoreUpsellResponse = {
114
116
  result: UpsellResultEnum;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["@tiendanube/nexo"]=t(require("react")):e["@tiendanube/nexo"]=t(e.react)}(global,(e=>(()=>{"use strict";var t={713:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ACTION_STORE_UPSELL=t.ACTION_STORE_FEATURE=t.ACTION_LOG_ERROR=t.ACTION_NAVIGATE_HEADER=t.ACTION_NAVIGATE_GOTO_OLD_ADMIN=t.ACTION_UTILS_OPEN_IN_DEFAULT_BROWSER=t.ACTION_UTILS_COPY_TO_CLIPBOARD=t.ACTION_USER_ADMIN_INFO=t.ACTION_STORE_INFO=t.ACTION_DEVICE=t.ACTION_AUTH_SESSION_TOKEN=t.ACTION_NAVIGATE_FULLSCREEN=t.ACTION_NAVIGATE_SYNC=t.ACTION_NAVIGATE_PATHNAME=t.ACTION_NAVIGATE_GOTO=t.ACTION_NAVIGATE_BACK=t.ACTION_NAVIGATE_EXIT=t.ACTION_CONNECTED=t.ACTION_READY=void 0,t.ACTION_READY="app/ready",t.ACTION_CONNECTED="app/connected",t.ACTION_NAVIGATE_EXIT="app/navigate/exit",t.ACTION_NAVIGATE_BACK="app/navigate/back",t.ACTION_NAVIGATE_GOTO="app/navigate/goTo",t.ACTION_NAVIGATE_PATHNAME="app/navigate/pathname",t.ACTION_NAVIGATE_SYNC="app/navigate/sync",t.ACTION_NAVIGATE_FULLSCREEN="app/navigate/fullscreen",t.ACTION_AUTH_SESSION_TOKEN="app/auth/sessionToken",t.ACTION_DEVICE="app/device",t.ACTION_STORE_INFO="app/store/info",t.ACTION_USER_ADMIN_INFO="app/user/info",t.ACTION_UTILS_COPY_TO_CLIPBOARD="app/utils/copyToClipboard",t.ACTION_UTILS_OPEN_IN_DEFAULT_BROWSER="app/utils/openInDefaultBrowser",t.ACTION_NAVIGATE_GOTO_OLD_ADMIN="app/navigate/goToOldAdmin",t.ACTION_NAVIGATE_HEADER="app/navigate/header",t.ACTION_LOG_ERROR="app/log/error",t.ACTION_STORE_FEATURE="app/store/feature",t.ACTION_STORE_UPSELL="app/store/upsell",t.default={ACTION_READY:t.ACTION_READY,ACTION_CONNECTED:t.ACTION_CONNECTED,ACTION_NAVIGATE_EXIT:t.ACTION_NAVIGATE_EXIT,ACTION_NAVIGATE_BACK:t.ACTION_NAVIGATE_BACK,ACTION_NAVIGATE_GOTO:t.ACTION_NAVIGATE_GOTO,ACTION_NAVIGATE_PATHNAME:t.ACTION_NAVIGATE_PATHNAME,ACTION_NAVIGATE_SYNC:t.ACTION_NAVIGATE_SYNC,ACTION_NAVIGATE_FULLSCREEN:t.ACTION_NAVIGATE_FULLSCREEN,ACTION_AUTH_SESSION_TOKEN:t.ACTION_AUTH_SESSION_TOKEN,ACTION_DEVICE:t.ACTION_DEVICE,ACTION_STORE_INFO:t.ACTION_STORE_INFO,ACTION_USER_ADMIN_INFO:t.ACTION_USER_ADMIN_INFO,ACTION_UTILS_COPY_TO_CLIPBOARD:t.ACTION_UTILS_COPY_TO_CLIPBOARD,ACTION_UTILS_OPEN_IN_DEFAULT_BROWSER:t.ACTION_UTILS_OPEN_IN_DEFAULT_BROWSER,ACTION_NAVIGATE_GOTO_OLD_ADMIN:t.ACTION_NAVIGATE_GOTO_OLD_ADMIN,ACTION_NAVIGATE_HEADER:t.ACTION_NAVIGATE_HEADER,ACTION_LOG_ERROR:t.ACTION_LOG_ERROR,ACTION_STORE_FEATURE:t.ACTION_STORE_FEATURE,ACTION_STORE_UPSELL:t.ACTION_STORE_UPSELL}},70:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UpsellResultEnum=void 0,function(e){e.ACCEPTED="accepted",e.DECLINED="declined",e.PLANS_REDIRECT="plans_redirect",e.SKIPPED="skipped",e.UNAVAILABLE="unavailable",e.ERROR="error"}(t.UpsellResultEnum||(t.UpsellResultEnum={}))},133:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=a(n(713));o(n(713),t),t.default=i.default},55:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(156),i=n(133),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={hasError:!1},t}return o(t,e),t.getDerivedStateFromError=function(e){return{hasError:!0}},t.prototype.componentDidCatch=function(e,t){this.props.nexo.dispatch({type:i.ACTION_LOG_ERROR,payload:{stack:t.componentStack,message:e.message,url:window.location.href}}),this.setState({hasError:!0})},t.prototype.render=function(){return this.state.hasError?null:this.props.children},t}(a.Component);t.default=u},563:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(55);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r(o).default}})},740:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=void 0;var o=n(563);Object.defineProperty(t,"ErrorBoundary",{enumerable:!0,get:function(){return r(o).default}})},676:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.create=void 0;var r=n(827);Object.defineProperty(t,"create",{enumerable:!0,get:function(){return r.create}})},827:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.create=void 0;var r=n(133),o=n(939);t.create=function(e){var t=e.clientId,n=e.log,a=void 0!==n&&n,i=!1,u=(0,o.registerIframe)(a),c=u.dispatch,s=u.suscribe;return{clientId:t,dispatch:c,suscribe:s,onReady:function(e){if(i)throw new Error("onReady should be run only once");var t=s(r.ACTION_CONNECTED,(function(){e(),t(),i=!0}));c({type:r.ACTION_CONNECTED})}}}},939:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.registerIframe=t.suscribeAndUnsuscribeHandlers=t.createHandler=void 0;var n=function(e){window.parent!==window&&("postMessage"in window.parent||console.error("can not send a event",e),r("dispatched",e.type,e.payload),window.parent.postMessage(e,"*"))};t.createHandler=function(e,t){return function(n){n.type===e&&(r("received",n.type,n.payload),t(n.payload))}};var r=function(e,t,n){if(o){var r="dispatched"===e?"#f5ec7f":"#00cc35";console.group("%c "+e,"color: "+r),console.log("👉 ",t);var a=JSON.stringify(n);a&&console.log("📦 "+a),console.groupEnd()}};t.suscribeAndUnsuscribeHandlers=function(e,t){return e.push(t),function(){e.splice(e.indexOf(t),1)}};var o=!1;t.registerIframe=function(e){void 0===e&&(e=!1),o=e;var r=[];return window.addEventListener("message",(function(e){r.forEach((function(t){return t(e.data)}))})),{dispatch:n,suscribe:function(e,n){var o=(0,t.createHandler)(e,n);return(0,t.suscribeAndUnsuscribeHandlers)(r,o)}}}},488:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.asyncAction=t.message=void 0;t.message=function(e,t){return{type:e,payload:t}};t.asyncAction=function(e,n,r){return new Promise((function(o){var a=e.suscribe(n,(function(e){o(e),a()}));e.dispatch((0,t.message)(n,r))}))}},200:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function u(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,u)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.runWithUpsell=t.getFeatureStatus=t.navigateHeaderRemove=t.navigateHeader=t.copyToClipboard=t.goToOldAdmin=t.openInDefaultBrowser=t.goTo=t.getIsMobileDevice=t.getUserAdminInfo=t.getStoreInfo=t.syncPathname=t.getCurrentPathname=t.getSessionToken=t.navigateFullscren=t.navigateBack=t.navigateExit=t.iAmReady=t.connect=void 0;var a=n(133),i=n(70),u=n(488);t.connect=function(e,t){return void 0===t&&(t=3e3),new Promise((function(n,r){var o=setTimeout((function(){r(new Error("Timeout"))}),t);e.onReady((function(){n(),clearTimeout(o)}))}))};t.iAmReady=function(e){e.dispatch((0,u.message)(a.ACTION_READY))};t.navigateExit=function(e){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_EXIT))};t.navigateBack=function(e){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_BACK))};t.navigateFullscren=function(e,t){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_FULLSCREEN,{mode:t}))};t.getSessionToken=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_AUTH_SESSION_TOKEN)];case 1:return[2,t.sent().token]}}))}))};t.getCurrentPathname=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_NAVIGATE_PATHNAME)];case 1:return[2,t.sent().pathname]}}))}))};t.syncPathname=function(e,t){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_SYNC,{pathname:t}))};t.getStoreInfo=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_STORE_INFO)];case 1:return[2,t.sent()]}}))}))};t.getUserAdminInfo=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_USER_ADMIN_INFO)];case 1:return[2,t.sent()]}}))}))};t.getIsMobileDevice=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_DEVICE)];case 1:return[2,t.sent().isMobile]}}))}))};t.goTo=function(e,t){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_GOTO,{pathname:t}))};t.openInDefaultBrowser=function(e,t){e.dispatch((0,u.message)(a.ACTION_UTILS_OPEN_IN_DEFAULT_BROWSER,{pathname:t}))};t.goToOldAdmin=function(e,t){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_GOTO_OLD_ADMIN,{pathToOldAdmin:t}))};t.copyToClipboard=function(e,t){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_UTILS_COPY_TO_CLIPBOARD,{text:t})];case 1:return[2,n.sent().success]}}))}))};t.navigateHeader=function(e,t){e.dispatch({type:a.ACTION_NAVIGATE_HEADER,payload:t})};t.navigateHeaderRemove=function(e){e.dispatch({type:a.ACTION_NAVIGATE_HEADER,payload:{remove:!0}})};t.getFeatureStatus=function(e,t){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_STORE_FEATURE,{featureKey:t})];case 1:return[2,n.sent()]}}))}))};t.runWithUpsell=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r,c;return o(this,(function(o){switch(o.label){case 0:return[4,(0,u.asyncAction)(e.nexo,a.ACTION_STORE_UPSELL,{featureKey:e.featureKey,modalTitle:e.modalTitle,trackingSource:e.trackingSource})];case 1:switch(o.sent().result){case i.UpsellResultEnum.ACCEPTED:case i.UpsellResultEnum.SKIPPED:e.callback();break;case i.UpsellResultEnum.DECLINED:null===(t=e.onDeclined)||void 0===t||t.call(e);break;case i.UpsellResultEnum.PLANS_REDIRECT:null===(n=e.onPlansRedirect)||void 0===n||n.call(e);break;case i.UpsellResultEnum.UNAVAILABLE:null===(r=e.onUnavailable)||void 0===r||r.call(e);break;case i.UpsellResultEnum.ERROR:null===(c=e.onError)||void 0===c||c.call(e)}return[2]}}))}))}},489:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0});var u=a(n(200));i(n(200),t),t.default=u},607:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=t.create=t.UpsellResultEnum=void 0;var u=n(676);Object.defineProperty(t,"create",{enumerable:!0,get:function(){return u.create}});var c=n(740);Object.defineProperty(t,"ErrorBoundary",{enumerable:!0,get:function(){return c.ErrorBoundary}});var s=i(n(133)),_=i(n(489)),l=n(70);Object.defineProperty(t,"UpsellResultEnum",{enumerable:!0,get:function(){return l.UpsellResultEnum}}),a(n(133),t),a(n(489),t),a(n(740),t),t.default=r(r({ErrorBoundary:c.ErrorBoundary,create:u.create},s.default),_.default)},156:t=>{t.exports=e}},n={};var r=function e(r){var o=n[r];if(void 0!==o)return o.exports;var a=n[r]={exports:{}};return t[r].call(a.exports,a,a.exports,e),a.exports}(607);return r})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["@tiendanube/nexo"]=t(require("react")):e["@tiendanube/nexo"]=t(e.react)}(global,(e=>(()=>{"use strict";var t={713:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ACTION_STORE_UPSELL=t.ACTION_STORE_FEATURE=t.ACTION_LOG_ERROR=t.ACTION_NAVIGATE_HEADER=t.ACTION_NAVIGATE_GOTO_OLD_ADMIN=t.ACTION_UTILS_OPEN_IN_DEFAULT_BROWSER=t.ACTION_UTILS_COPY_TO_CLIPBOARD=t.ACTION_USER_ADMIN_INFO=t.ACTION_STORE_INFO=t.ACTION_DEVICE=t.ACTION_AUTH_SESSION_TOKEN=t.ACTION_NAVIGATE_FULLSCREEN=t.ACTION_NAVIGATE_SYNC=t.ACTION_NAVIGATE_PATHNAME=t.ACTION_NAVIGATE_GOTO=t.ACTION_NAVIGATE_BACK=t.ACTION_NAVIGATE_EXIT=t.ACTION_CONNECTED=t.ACTION_READY=void 0,t.ACTION_READY="app/ready",t.ACTION_CONNECTED="app/connected",t.ACTION_NAVIGATE_EXIT="app/navigate/exit",t.ACTION_NAVIGATE_BACK="app/navigate/back",t.ACTION_NAVIGATE_GOTO="app/navigate/goTo",t.ACTION_NAVIGATE_PATHNAME="app/navigate/pathname",t.ACTION_NAVIGATE_SYNC="app/navigate/sync",t.ACTION_NAVIGATE_FULLSCREEN="app/navigate/fullscreen",t.ACTION_AUTH_SESSION_TOKEN="app/auth/sessionToken",t.ACTION_DEVICE="app/device",t.ACTION_STORE_INFO="app/store/info",t.ACTION_USER_ADMIN_INFO="app/user/info",t.ACTION_UTILS_COPY_TO_CLIPBOARD="app/utils/copyToClipboard",t.ACTION_UTILS_OPEN_IN_DEFAULT_BROWSER="app/utils/openInDefaultBrowser",t.ACTION_NAVIGATE_GOTO_OLD_ADMIN="app/navigate/goToOldAdmin",t.ACTION_NAVIGATE_HEADER="app/navigate/header",t.ACTION_LOG_ERROR="app/log/error",t.ACTION_STORE_FEATURE="app/store/feature",t.ACTION_STORE_UPSELL="app/store/upsell",t.default={ACTION_READY:t.ACTION_READY,ACTION_CONNECTED:t.ACTION_CONNECTED,ACTION_NAVIGATE_EXIT:t.ACTION_NAVIGATE_EXIT,ACTION_NAVIGATE_BACK:t.ACTION_NAVIGATE_BACK,ACTION_NAVIGATE_GOTO:t.ACTION_NAVIGATE_GOTO,ACTION_NAVIGATE_PATHNAME:t.ACTION_NAVIGATE_PATHNAME,ACTION_NAVIGATE_SYNC:t.ACTION_NAVIGATE_SYNC,ACTION_NAVIGATE_FULLSCREEN:t.ACTION_NAVIGATE_FULLSCREEN,ACTION_AUTH_SESSION_TOKEN:t.ACTION_AUTH_SESSION_TOKEN,ACTION_DEVICE:t.ACTION_DEVICE,ACTION_STORE_INFO:t.ACTION_STORE_INFO,ACTION_USER_ADMIN_INFO:t.ACTION_USER_ADMIN_INFO,ACTION_UTILS_COPY_TO_CLIPBOARD:t.ACTION_UTILS_COPY_TO_CLIPBOARD,ACTION_UTILS_OPEN_IN_DEFAULT_BROWSER:t.ACTION_UTILS_OPEN_IN_DEFAULT_BROWSER,ACTION_NAVIGATE_GOTO_OLD_ADMIN:t.ACTION_NAVIGATE_GOTO_OLD_ADMIN,ACTION_NAVIGATE_HEADER:t.ACTION_NAVIGATE_HEADER,ACTION_LOG_ERROR:t.ACTION_LOG_ERROR,ACTION_STORE_FEATURE:t.ACTION_STORE_FEATURE,ACTION_STORE_UPSELL:t.ACTION_STORE_UPSELL}},70:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UpsellResultEnum=void 0,function(e){e.ACCEPTED="accepted",e.DECLINED="declined",e.PLANS_REDIRECT="plans_redirect",e.SKIPPED="skipped",e.UNAVAILABLE="unavailable",e.ERROR="error"}(t.UpsellResultEnum||(t.UpsellResultEnum={}))},133:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=a(n(713));o(n(713),t),t.default=i.default},55:function(e,t,n){var r,o=this&&this.__extends||(r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(156),i=n(133),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={hasError:!1},t}return o(t,e),t.getDerivedStateFromError=function(e){return{hasError:!0}},t.prototype.componentDidCatch=function(e,t){this.props.nexo.dispatch({type:i.ACTION_LOG_ERROR,payload:{stack:t.componentStack,message:e.message,url:window.location.href}}),this.setState({hasError:!0})},t.prototype.render=function(){return this.state.hasError?null:this.props.children},t}(a.Component);t.default=u},563:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=n(55);Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r(o).default}})},740:function(e,t,n){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=void 0;var o=n(563);Object.defineProperty(t,"ErrorBoundary",{enumerable:!0,get:function(){return r(o).default}})},676:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.create=void 0;var r=n(827);Object.defineProperty(t,"create",{enumerable:!0,get:function(){return r.create}})},827:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.create=void 0;var r=n(133),o=n(939);t.create=function(e){var t=e.clientId,n=e.log,a=void 0!==n&&n,i=!1,u=(0,o.registerIframe)(a),c=u.dispatch,s=u.suscribe;return{clientId:t,dispatch:c,suscribe:s,onReady:function(e){if(i)throw new Error("onReady should be run only once");var t=s(r.ACTION_CONNECTED,(function(){e(),t(),i=!0}));c({type:r.ACTION_CONNECTED})}}}},939:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.registerIframe=t.suscribeAndUnsuscribeHandlers=t.createHandler=void 0;var n=function(e){window.parent!==window&&("postMessage"in window.parent||console.error("can not send a event",e),r("dispatched",e.type,e.payload),window.parent.postMessage(e,"*"))};t.createHandler=function(e,t){return function(n){n.type===e&&(r("received",n.type,n.payload),t(n.payload))}};var r=function(e,t,n){if(o){var r="dispatched"===e?"#f5ec7f":"#00cc35";console.group("%c "+e,"color: "+r),console.log("👉 ",t);var a=JSON.stringify(n);a&&console.log("📦 "+a),console.groupEnd()}};t.suscribeAndUnsuscribeHandlers=function(e,t){return e.push(t),function(){e.splice(e.indexOf(t),1)}};var o=!1;t.registerIframe=function(e){void 0===e&&(e=!1),o=e;var r=[];return window.addEventListener("message",(function(e){r.forEach((function(t){return t(e.data)}))})),{dispatch:n,suscribe:function(e,n){var o=(0,t.createHandler)(e,n);return(0,t.suscribeAndUnsuscribeHandlers)(r,o)}}}},488:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.asyncAction=t.message=void 0;t.message=function(e,t){return{type:e,payload:t}};t.asyncAction=function(e,n,r){return new Promise((function(o){var a=e.suscribe(n,(function(e){o(e),a()}));e.dispatch((0,t.message)(n,r))}))}},200:function(e,t,n){var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,a){function i(e){try{c(r.next(e))}catch(e){a(e)}}function u(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,u)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.runWithUpsell=t.getFeatureStatus=t.navigateHeaderRemove=t.navigateHeader=t.copyToClipboard=t.goToOldAdmin=t.openInDefaultBrowser=t.goTo=t.getIsMobileDevice=t.getUserAdminInfo=t.getStoreInfo=t.syncPathname=t.getCurrentPathname=t.getSessionToken=t.navigateFullscren=t.navigateBack=t.navigateExit=t.iAmReady=t.connect=void 0;var a=n(133),i=n(70),u=n(488);t.connect=function(e,t){return void 0===t&&(t=3e3),new Promise((function(n,r){var o=setTimeout((function(){r(new Error("Timeout"))}),t);e.onReady((function(){n(),clearTimeout(o)}))}))};t.iAmReady=function(e){e.dispatch((0,u.message)(a.ACTION_READY))};t.navigateExit=function(e){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_EXIT))};t.navigateBack=function(e){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_BACK))};t.navigateFullscren=function(e,t){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_FULLSCREEN,{mode:t}))};t.getSessionToken=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_AUTH_SESSION_TOKEN)];case 1:return[2,t.sent().token]}}))}))};t.getCurrentPathname=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_NAVIGATE_PATHNAME)];case 1:return[2,t.sent().pathname]}}))}))};t.syncPathname=function(e,t){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_SYNC,{pathname:t}))};t.getStoreInfo=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_STORE_INFO)];case 1:return[2,t.sent()]}}))}))};t.getUserAdminInfo=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_USER_ADMIN_INFO)];case 1:return[2,t.sent()]}}))}))};t.getIsMobileDevice=function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_DEVICE)];case 1:return[2,t.sent().isMobile]}}))}))};t.goTo=function(e,t){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_GOTO,{pathname:t}))};t.openInDefaultBrowser=function(e,t){e.dispatch((0,u.message)(a.ACTION_UTILS_OPEN_IN_DEFAULT_BROWSER,{pathname:t}))};t.goToOldAdmin=function(e,t){e.dispatch((0,u.message)(a.ACTION_NAVIGATE_GOTO_OLD_ADMIN,{pathToOldAdmin:t}))};t.copyToClipboard=function(e,t){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_UTILS_COPY_TO_CLIPBOARD,{text:t})];case 1:return[2,n.sent().success]}}))}))};t.navigateHeader=function(e,t){e.dispatch({type:a.ACTION_NAVIGATE_HEADER,payload:t})};t.navigateHeaderRemove=function(e){e.dispatch({type:a.ACTION_NAVIGATE_HEADER,payload:{remove:!0}})};t.getFeatureStatus=function(e,t){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return[4,(0,u.asyncAction)(e,a.ACTION_STORE_FEATURE,{featureKey:t})];case 1:return[2,n.sent()]}}))}))};t.runWithUpsell=function(e){return r(void 0,void 0,void 0,(function(){var t,n,r,c;return o(this,(function(o){switch(o.label){case 0:return[4,(0,u.asyncAction)(e.nexo,a.ACTION_STORE_UPSELL,{featureKey:e.featureKey,modalTitle:e.modalTitle,trackingSource:e.trackingSource,minValue:e.minValue})];case 1:switch(o.sent().result){case i.UpsellResultEnum.ACCEPTED:case i.UpsellResultEnum.SKIPPED:e.callback();break;case i.UpsellResultEnum.DECLINED:null===(t=e.onDeclined)||void 0===t||t.call(e);break;case i.UpsellResultEnum.PLANS_REDIRECT:null===(n=e.onPlansRedirect)||void 0===n||n.call(e);break;case i.UpsellResultEnum.UNAVAILABLE:null===(r=e.onUnavailable)||void 0===r||r.call(e);break;case i.UpsellResultEnum.ERROR:null===(c=e.onError)||void 0===c||c.call(e)}return[2]}}))}))}},489:function(e,t,n){var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),o=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return o(t,e),t},i=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||r(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0});var u=a(n(200));i(n(200),t),t.default=u},607:function(e,t,n){var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)},o=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),a=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||o(t,e,n)},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.ErrorBoundary=t.create=t.UpsellResultEnum=void 0;var u=n(676);Object.defineProperty(t,"create",{enumerable:!0,get:function(){return u.create}});var c=n(740);Object.defineProperty(t,"ErrorBoundary",{enumerable:!0,get:function(){return c.ErrorBoundary}});var s=i(n(133)),_=i(n(489)),l=n(70);Object.defineProperty(t,"UpsellResultEnum",{enumerable:!0,get:function(){return l.UpsellResultEnum}}),a(n(133),t),a(n(489),t),a(n(740),t),t.default=r(r({ErrorBoundary:c.ErrorBoundary,create:u.create},s.default),_.default)},156:t=>{t.exports=e}},n={};var r=function e(r){var o=n[r];if(void 0!==o)return o.exports;var a=n[r]={exports:{}};return t[r].call(a.exports,a,a.exports,e),a.exports}(607);return r})()));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiendanube/nexo",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Nexo provides tools for communication between an external application and the Nuvemshop administrator.",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -8,7 +8,7 @@
8
8
  "scripts": {
9
9
  "build": "yarn clean && webpack && yarn build:fix-type-defs",
10
10
  "build:fix-type-defs": "node ./.scripts/fix-type-defs-imports",
11
- "publish:release": "yarn bump:check && yarn bump:stable && yarn build && npm publish --tolerate-republish --access public",
11
+ "publish:release": "yarn bump:stable && yarn build && npm publish --tolerate-republish --access public",
12
12
  "publish:next": "yarn bump:check && yarn bump:next && npm run build && npm publish --tolerate-republish --access public --tag next",
13
13
  "test": "echo \"Error: no test specified\" && exit 1",
14
14
  "lint": "eslint .",
@@ -56,6 +56,6 @@
56
56
  "webpack-shell-plugin-next": "^2.3.1"
57
57
  },
58
58
  "engines": {
59
- "node": ">=16.x"
59
+ "node": ">=18.0.0"
60
60
  }
61
61
  }