@nosto/nosto-react 1.0.0 → 2.0.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.
- package/dist/index.d.ts +86 -760
- package/dist/index.es.js +538 -569
- package/dist/index.umd.js +9 -9
- package/package.json +3 -1
- package/src/components/Nosto404.tsx +4 -9
- package/src/components/NostoCategory.tsx +4 -7
- package/src/components/NostoCheckout.tsx +4 -9
- package/src/components/NostoHome.tsx +4 -8
- package/src/components/NostoOrder.tsx +5 -7
- package/src/components/NostoOther.tsx +4 -9
- package/src/components/NostoProduct.tsx +4 -8
- package/src/components/NostoProvider.tsx +12 -68
- package/src/components/NostoSearch.tsx +4 -7
- package/src/components/NostoSession.tsx +1 -2
- package/src/components/helpers.ts +3 -0
- package/src/components/index.ts +0 -3
- package/src/context.ts +31 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useDeepCompareEffect.ts +21 -0
- package/src/hooks/useNostoApi.ts +22 -0
- package/src/hooks/useNostoContext.ts +18 -0
- package/src/hooks/useRenderCampaigns.tsx +60 -0
- package/src/index.ts +2 -0
- package/src/types.ts +73 -1
- package/src/components/context.ts +0 -55
- package/src/utils/hooks.ts +0 -41
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(E,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("react"),require("react-dom/client")):typeof define=="function"&&define.amd?define(["exports","react","react-dom/client"],_):(E=typeof globalThis<"u"?globalThis:E||self,_(E["@nosto/nosto-react"]={},E.React,E.ReactDOM))})(this,function(E,_,We){"use strict";const ce=r=>String(r)==="[object Object]";function le(r){if(!ce(r))return!1;const o=r.constructor;if(o===void 0)return!0;const a=o.prototype;return!(!ce(a)||!a.hasOwnProperty("isPrototypeOf"))}function Z(r,o){if(r===o)return!0;if(r instanceof Date&&o instanceof Date)return r.getTime()===o.getTime();if(r instanceof Array&&o instanceof Array)return r.length!==o.length?!1:r.every((a,s)=>Z(a,o[s]));if(le(r)&&le(o)){const a=Object.entries(r);return a.length!==Object.keys(o).length?!1:a.every(([s,d])=>Z(d,o[s]))}return!1}function fe(r,o){return _.useEffect(r,Ve(o))}function Ve(r){const o=_.useRef(r),a=_.useRef(0);return Z(r,o.current)||(o.current=r,a.current+=1),_.useMemo(()=>o.current,[a.current])}const Q=_.createContext({account:"",currentVariation:"",responseMode:"HTML",clientScriptLoaded:!1});function B(){const r=_.useContext(Q);if(!r)throw new Error("No nosto context found");return r}function k(r,o,a){const{clientScriptLoaded:s,currentVariation:d,responseMode:v}=B();(a!=null&&a.deep?fe:_.useEffect)(()=>{s&&window.nostojs(g=>{g.defaultSession().setVariation(d).setResponseMode(v),r(g)})},[s,d,v,...o??[]])}var ee={exports:{}},W={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var de;function Ye(){if(de)return W;de=1;var r=_,o=Symbol.for("react.element"),a=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,d=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,v={key:!0,ref:!0,__self:!0,__source:!0};function l(g,y,T){var w,S={},j=null,F=null;T!==void 0&&(j=""+T),y.key!==void 0&&(j=""+y.key),y.ref!==void 0&&(F=y.ref);for(w in y)s.call(y,w)&&!v.hasOwnProperty(w)&&(S[w]=y[w]);if(g&&g.defaultProps)for(w in y=g.defaultProps,y)S[w]===void 0&&(S[w]=y[w]);return{$$typeof:o,type:g,key:j,ref:F,props:S,_owner:d.current}}return W.Fragment=a,W.jsx=l,W.jsxs=l,W}var V={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var me;function Me(){return me||(me=1,process.env.NODE_ENV!=="production"&&function(){var r=_,o=Symbol.for("react.element"),a=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),d=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),g=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),S=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),F=Symbol.for("react.offscreen"),M=Symbol.iterator,p="@@iterator";function N(e){if(e===null||typeof e!="object")return null;var t=M&&e[M]||e[p];return typeof t=="function"?t:null}var C=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function R(e){{for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];it("error",e,n)}}function it(e,t,n){{var i=C.ReactDebugCurrentFrame,f=i.getStackAddendum();f!==""&&(t+="%s",n=n.concat([f]));var m=n.map(function(c){return String(c)});m.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,m)}}var st=!1,ut=!1,ct=!1,lt=!1,ft=!1,pe;pe=Symbol.for("react.module.reference");function dt(e){return!!(typeof e=="string"||typeof e=="function"||e===s||e===v||ft||e===d||e===T||e===w||lt||e===F||st||ut||ct||typeof e=="object"&&e!==null&&(e.$$typeof===j||e.$$typeof===S||e.$$typeof===l||e.$$typeof===g||e.$$typeof===y||e.$$typeof===pe||e.getModuleId!==void 0))}function mt(e,t,n){var i=e.displayName;if(i)return i;var f=t.displayName||t.name||"";return f!==""?n+"("+f+")":n}function ge(e){return e.displayName||"Context"}function x(e){if(e==null)return null;if(typeof e.tag=="number"&&R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case s:return"Fragment";case a:return"Portal";case v:return"Profiler";case d:return"StrictMode";case T:return"Suspense";case w:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case g:var t=e;return ge(t)+".Consumer";case l:var n=e;return ge(n._context)+".Provider";case y:return mt(e,e.render,"ForwardRef");case S:var i=e.displayName||null;return i!==null?i:x(e.type)||"Memo";case j:{var f=e,m=f._payload,c=f._init;try{return x(c(m))}catch{return null}}}return null}var L=Object.assign,U=0,ye,he,Ee,be,_e,we,Re;function Ce(){}Ce.__reactDisabledLog=!0;function vt(){{if(U===0){ye=console.log,he=console.info,Ee=console.warn,be=console.error,_e=console.group,we=console.groupCollapsed,Re=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}U++}}function pt(){{if(U--,U===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:L({},e,{value:ye}),info:L({},e,{value:he}),warn:L({},e,{value:Ee}),error:L({},e,{value:be}),group:L({},e,{value:_e}),groupCollapsed:L({},e,{value:we}),groupEnd:L({},e,{value:Re})})}U<0&&R("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=C.ReactCurrentDispatcher,re;function z(e,t,n){{if(re===void 0)try{throw Error()}catch(f){var i=f.stack.trim().match(/\n( *(at )?)/);re=i&&i[1]||""}return`
|
|
18
|
+
`+re+e}}var ne=!1,J;{var gt=typeof WeakMap=="function"?WeakMap:Map;J=new gt}function Pe(e,t){if(!e||ne)return"";{var n=J.get(e);if(n!==void 0)return n}var i;ne=!0;var f=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var m;m=te.current,te.current=null,vt();try{if(t){var c=function(){throw Error()};if(Object.defineProperty(c.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(c,[])}catch(A){i=A}Reflect.construct(e,[],c)}else{try{c.call()}catch(A){i=A}e.call(c.prototype)}}else{try{throw Error()}catch(A){i=A}e()}}catch(A){if(A&&i&&typeof A.stack=="string"){for(var u=A.stack.split(`
|
|
19
|
+
`),P=i.stack.split(`
|
|
20
|
+
`),h=u.length-1,b=P.length-1;h>=1&&b>=0&&u[h]!==P[b];)b--;for(;h>=1&&b>=0;h--,b--)if(u[h]!==P[b]){if(h!==1||b!==1)do if(h--,b--,b<0||u[h]!==P[b]){var O=`
|
|
21
|
+
`+u[h].replace(" at new "," at ");return e.displayName&&O.includes("<anonymous>")&&(O=O.replace("<anonymous>",e.displayName)),typeof e=="function"&&J.set(e,O),O}while(h>=1&&b>=0);break}}}finally{ne=!1,te.current=m,pt(),Error.prepareStackTrace=f}var $=e?e.displayName||e.name:"",$e=$?z($):"";return typeof e=="function"&&J.set(e,$e),$e}function yt(e,t,n){return Pe(e,!1)}function ht(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function G(e,t,n){if(e==null)return"";if(typeof e=="function")return Pe(e,ht(e));if(typeof e=="string")return z(e);switch(e){case T:return z("Suspense");case w:return z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case y:return yt(e.render);case S:return G(e.type,t,n);case j:{var i=e,f=i._payload,m=i._init;try{return G(m(f),t,n)}catch{}}}return""}var K=Object.prototype.hasOwnProperty,Se={},Oe=C.ReactDebugCurrentFrame;function X(e){if(e){var t=e._owner,n=G(e.type,e._source,t?t.type:null);Oe.setExtraStackFrame(n)}else Oe.setExtraStackFrame(null)}function Et(e,t,n,i,f){{var m=Function.call.bind(K);for(var c in e)if(m(e,c)){var u=void 0;try{if(typeof e[c]!="function"){var P=Error((i||"React class")+": "+n+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw P.name="Invariant Violation",P}u=e[c](t,c,i,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(h){u=h}u&&!(u instanceof Error)&&(X(f),R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",i||"React class",n,c,typeof u),X(null)),u instanceof Error&&!(u.message in Se)&&(Se[u.message]=!0,X(f),R("Failed %s type: %s",n,u.message),X(null))}}}var bt=Array.isArray;function oe(e){return bt(e)}function _t(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,n=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function wt(e){try{return Te(e),!1}catch{return!0}}function Te(e){return""+e}function je(e){if(wt(e))return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",_t(e)),Te(e)}var q=C.ReactCurrentOwner,Rt={key:!0,ref:!0,__self:!0,__source:!0},Ne,xe,ae;ae={};function Ct(e){if(K.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function Pt(e){if(K.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function St(e,t){if(typeof e.ref=="string"&&q.current&&t&&q.current.stateNode!==t){var n=x(q.current.type);ae[n]||(R('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',x(q.current.type),e.ref),ae[n]=!0)}}function Ot(e,t){{var n=function(){Ne||(Ne=!0,R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function Tt(e,t){{var n=function(){xe||(xe=!0,R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var jt=function(e,t,n,i,f,m,c){var u={$$typeof:o,type:e,key:t,ref:n,props:c,_owner:m};return u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(u,"_self",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.defineProperty(u,"_source",{configurable:!1,enumerable:!1,writable:!1,value:f}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u};function Nt(e,t,n,i,f){{var m,c={},u=null,P=null;n!==void 0&&(je(n),u=""+n),Pt(t)&&(je(t.key),u=""+t.key),Ct(t)&&(P=t.ref,St(t,f));for(m in t)K.call(t,m)&&!Rt.hasOwnProperty(m)&&(c[m]=t[m]);if(e&&e.defaultProps){var h=e.defaultProps;for(m in h)c[m]===void 0&&(c[m]=h[m])}if(u||P){var b=typeof e=="function"?e.displayName||e.name||"Unknown":e;u&&Ot(c,b),P&&Tt(c,b)}return jt(e,u,P,f,i,q.current,c)}}var ie=C.ReactCurrentOwner,Ae=C.ReactDebugCurrentFrame;function I(e){if(e){var t=e._owner,n=G(e.type,e._source,t?t.type:null);Ae.setExtraStackFrame(n)}else Ae.setExtraStackFrame(null)}var se;se=!1;function ue(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function ke(){{if(ie.current){var e=x(ie.current.type);if(e)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function xt(e){return""}var De={};function At(e){{var t=ke();if(!t){var n=typeof e=="string"?e:e.displayName||e.name;n&&(t=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+n+">.")}return t}}function Fe(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=At(t);if(De[n])return;De[n]=!0;var i="";e&&e._owner&&e._owner!==ie.current&&(i=" It was passed a child from "+x(e._owner.type)+"."),I(e),R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,i),I(null)}}function Le(e,t){{if(typeof e!="object")return;if(oe(e))for(var n=0;n<e.length;n++){var i=e[n];ue(i)&&Fe(i,t)}else if(ue(e))e._store&&(e._store.validated=!0);else if(e){var f=N(e);if(typeof f=="function"&&f!==e.entries)for(var m=f.call(e),c;!(c=m.next()).done;)ue(c.value)&&Fe(c.value,t)}}}function kt(e){{var t=e.type;if(t==null||typeof t=="string")return;var n;if(typeof t=="function")n=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===y||t.$$typeof===S))n=t.propTypes;else return;if(n){var i=x(t);Et(n,e.props,"prop",i,e)}else if(t.PropTypes!==void 0&&!se){se=!0;var f=x(t);R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",f||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Dt(e){{for(var t=Object.keys(e.props),n=0;n<t.length;n++){var i=t[n];if(i!=="children"&&i!=="key"){I(e),R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",i),I(null);break}}e.ref!==null&&(I(e),R("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}function Ie(e,t,n,i,f,m){{var c=dt(e);if(!c){var u="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(u+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var P=xt();P?u+=P:u+=ke();var h;e===null?h="null":oe(e)?h="array":e!==void 0&&e.$$typeof===o?(h="<"+(x(e.type)||"Unknown")+" />",u=" Did you accidentally export a JSX literal instead of a component?"):h=typeof e,R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",h,u)}var b=Nt(e,t,n,f,m);if(b==null)return b;if(c){var O=t.children;if(O!==void 0)if(i)if(oe(O)){for(var $=0;$<O.length;$++)Le(O[$],e);Object.freeze&&Object.freeze(O)}else R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Le(O,e)}return e===s?Dt(b):kt(b),b}}function Ft(e,t,n){return Ie(e,t,n,!0)}function Lt(e,t,n){return Ie(e,t,n,!1)}var It=Lt,$t=Ft;V.Fragment=s,V.jsx=It,V.jsxs=$t}()),V}process.env.NODE_ENV==="production"?ee.exports=Ye():ee.exports=Me();var ve=ee.exports;const H=ve.jsx,Ue=ve.Fragment;function qe(r){return _.cloneElement(r.recommendationComponent,{nostoRecommendation:r.nostoRecommendation})}function Be(r){if(!window.nostojs)throw new Error("Nosto has not yet been initialized");window.nostojs(o=>{o.placements.injectCampaigns(r.recommendations)})}function D(){const{responseMode:r,recommendationComponent:o}=B(),a=_.useRef({});if(r=="HTML")return{renderCampaigns:Be};function s(d){var l;const v=((l=d.campaigns)==null?void 0:l.recommendations)??{};for(const g in v){const y=v[g],T="#"+g,w=document.querySelector(T);w&&(a.current[g]||(a.current[g]=We.createRoot(w)),a.current[g].render(H(qe,{recommendationComponent:o,nostoRecommendation:y})))}}return{renderCampaigns:s}}function He(r){const{renderCampaigns:o}=D();return k(async a=>{const s=await a.defaultSession().viewNotFound().setPlacements(r.placements||a.placements.getPlacements()).load();o(s)}),null}function ze(r){const{renderCampaigns:o}=D();return k(async a=>{const s=await a.defaultSession().viewOther().setPlacements(r.placements||a.placements.getPlacements()).load();o(s)}),null}function Je(r){const{renderCampaigns:o}=D();return k(async a=>{const s=await a.defaultSession().viewCart().setPlacements(r.placements||a.placements.getPlacements()).load();o(s)}),null}function Ge(r){const{product:o,tagging:a,placements:s}=r,{renderCampaigns:d}=D();return k(async v=>{const l=await v.defaultSession().viewProduct(a??o).setPlacements(s||v.placements.getPlacements()).load();d(l)},[o,a==null?void 0:a.selected_sku_id]),null}function Ke(r){const{category:o,placements:a}=r,{renderCampaigns:s}=D();return k(async d=>{const v=await d.defaultSession().viewCategory(o).setPlacements(a||d.placements.getPlacements()).load();s(v)},[o]),null}function Xe(r){const{query:o,placements:a}=r,{renderCampaigns:s}=D();return k(async d=>{const v=await d.defaultSession().viewSearch(o).setPlacements(a||d.placements.getPlacements()).load();s(v)},[o]),null}function Y(r){return!r||typeof r!="object"||Ze(r)||Qe(r)?r:Array.isArray(r)?r.map(Y):Object.keys(r).reduce((o,a)=>{const s=a[0].toLowerCase()+a.slice(1).replace(/([A-Z]+)/g,(d,v)=>"_"+v.toLowerCase());return o[s]=Y(r[a]),o},{})}function Ze(r){return Object.prototype.toString.call(r)==="[object Date]"}function Qe(r){return Object.prototype.toString.call(r)==="[object RegExp]"}function et(r){const{order:o,placements:a}=r,{renderCampaigns:s}=D();return k(async d=>{const v=await d.defaultSession().addOrder(Y(o)).setPlacements(a||d.placements.getPlacements()).load();s(v)},[o],{deep:!0}),null}function tt(r){const{renderCampaigns:o}=D();return k(async a=>{const s=await a.defaultSession().viewFrontPage().setPlacements(r.placements||a.placements.getPlacements()).load();o(s)}),null}function rt(r){const{id:o,pageType:a}=r;return H("div",{className:"nosto_element",id:o},o+(a||""))}function nt(){return typeof window.nosto<"u"}function ot(r){const{account:o,multiCurrency:a=!1,host:s,children:d,recommendationComponent:v,shopifyMarkets:l}=r,[g,y]=_.useState(!1),T=_.useMemo(()=>g,[g]),w=a?r.currentVariation:"",S=_.isValidElement(v)?"JSON_ORIGINAL":"HTML";return _.useEffect(()=>{var j,F,M;if(window.nostojs||(window.nostojs=p=>{(window.nostojs.q=window.nostojs.q||[]).push(p)},window.nostojs(p=>p.setAutoLoad(!1))),!nt()&&!l){const p=document.createElement("script");p.type="text/javascript",p.src="//"+(s||"connect.nosto.com")+"/include/"+o,p.async=!0,p.setAttribute("nosto-client-script",""),p.onload=()=>{var N;typeof jest<"u"&&((N=window.nosto)==null||N.reload({site:"localhost"})),y(!0)},document.body.appendChild(p)}if(l){const p=document.querySelector("[nosto-client-script]"),N=document.querySelector("#nosto-sandbox");if(!p||(p==null?void 0:p.getAttribute("nosto-language"))!==(l==null?void 0:l.language)||(p==null?void 0:p.getAttribute("nosto-market-id"))!==(l==null?void 0:l.marketId)){g&&y(!1),(j=p==null?void 0:p.parentNode)==null||j.removeChild(p),(F=N==null?void 0:N.parentNode)==null||F.removeChild(N);const C=document.createElement("script");C.type="text/javascript",C.src="//"+(s||"connect.nosto.com")+`/script/shopify/market/nosto.js?merchant=${o}&market=${l.marketId||""}&locale=${((M=l==null?void 0:l.language)==null?void 0:M.toLowerCase())||""}`,C.async=!0,C.setAttribute("nosto-client-script",""),C.setAttribute("nosto-language",(l==null?void 0:l.language)||""),C.setAttribute("nosto-market-id",String(l==null?void 0:l.marketId)),C.onload=()=>{var R;typeof jest<"u"&&((R=window.nosto)==null||R.reload({site:"localhost"})),y(!0)},document.body.appendChild(C)}}},[g,l]),H(Q.Provider,{value:{account:o,clientScriptLoaded:T,currentVariation:w,responseMode:S,recommendationComponent:v},children:d})}function at(r){const{cart:o,customer:a}=r??{},{clientScriptLoaded:s}=B();return fe(()=>{const d=o?Y(o):void 0,v=a?Y(a):void 0;s&&window.nostojs(l=>{l.defaultSession().setResponseMode("HTML").setCart(d).setCustomer(v).viewOther().load()})},[s,o,a]),H(Ue,{})}E.Nosto404=He,E.NostoCategory=Ke,E.NostoCheckout=Je,E.NostoContext=Q,E.NostoHome=tt,E.NostoOrder=et,E.NostoOther=ze,E.NostoPlacement=rt,E.NostoProduct=Ge,E.NostoProvider=ot,E.NostoSearch=Xe,E.NostoSession=at,E.useNostoContext=B,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nosto/nosto-react",
|
|
3
3
|
"description": "Component library to simply implementing Nosto on React.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"author": "Mridang Agarwalla, Dominik Gilg",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"repository": {
|
|
@@ -48,6 +48,8 @@
|
|
|
48
48
|
"prettier": "^2.0.5",
|
|
49
49
|
"react": "*",
|
|
50
50
|
"react-dom": "*",
|
|
51
|
+
"react-router": "^6.25.1",
|
|
52
|
+
"react-router-dom": "^6.25.1",
|
|
51
53
|
"rimraf": "^3.0.2",
|
|
52
54
|
"ts-jest": "^29.1.0",
|
|
53
55
|
"typedoc": "^0.24.1",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useNostoApi } from "../utils/hooks"
|
|
1
|
+
import { useNostoApi, useRenderCampaigns } from "../hooks"
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* You can personalise your cart and checkout pages by using the `Nosto404` component.
|
|
@@ -22,9 +21,7 @@ import { useNostoApi } from "../utils/hooks"
|
|
|
22
21
|
* @group Components
|
|
23
22
|
*/
|
|
24
23
|
export default function Nosto404(props: { placements?: string[] }) {
|
|
25
|
-
const {
|
|
26
|
-
|
|
27
|
-
const { renderCampaigns, pageTypeUpdated } = useRenderCampaigns("404")
|
|
24
|
+
const { renderCampaigns } = useRenderCampaigns()
|
|
28
25
|
|
|
29
26
|
useNostoApi(
|
|
30
27
|
async (api) => {
|
|
@@ -32,9 +29,7 @@ export default function Nosto404(props: { placements?: string[] }) {
|
|
|
32
29
|
.viewNotFound()
|
|
33
30
|
.setPlacements(props.placements || api.placements.getPlacements())
|
|
34
31
|
.load()
|
|
35
|
-
renderCampaigns(data
|
|
36
|
-
}
|
|
37
|
-
[recommendationComponent, pageTypeUpdated]
|
|
38
|
-
)
|
|
32
|
+
renderCampaigns(data)
|
|
33
|
+
})
|
|
39
34
|
return null
|
|
40
35
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useNostoApi } from "../utils/hooks"
|
|
1
|
+
import { useNostoApi, useRenderCampaigns } from "../hooks"
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* You can personalise your category and collection pages by using the NostoCategory component.
|
|
@@ -25,9 +24,7 @@ import { useNostoApi } from "../utils/hooks"
|
|
|
25
24
|
*/
|
|
26
25
|
export default function NostoCategory(props: { category: string; placements?: string[] }) {
|
|
27
26
|
const { category, placements } = props
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
const { renderCampaigns, pageTypeUpdated } = useRenderCampaigns("home")
|
|
27
|
+
const { renderCampaigns } = useRenderCampaigns()
|
|
31
28
|
|
|
32
29
|
useNostoApi(
|
|
33
30
|
async (api) => {
|
|
@@ -35,9 +32,9 @@ export default function NostoCategory(props: { category: string; placements?: st
|
|
|
35
32
|
.viewCategory(category)
|
|
36
33
|
.setPlacements(placements || api.placements.getPlacements())
|
|
37
34
|
.load()
|
|
38
|
-
renderCampaigns(data
|
|
35
|
+
renderCampaigns(data)
|
|
39
36
|
},
|
|
40
|
-
[category
|
|
37
|
+
[category]
|
|
41
38
|
)
|
|
42
39
|
return null
|
|
43
40
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useNostoApi } from "../utils/hooks"
|
|
1
|
+
import { useNostoApi, useRenderCampaigns } from "../hooks"
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* You can personalise your cart and checkout pages by using the NostoCheckout component.
|
|
@@ -21,9 +20,7 @@ import { useNostoApi } from "../utils/hooks"
|
|
|
21
20
|
* @group Components
|
|
22
21
|
*/
|
|
23
22
|
export default function NostoCheckout(props: { placements?: string[] }) {
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
const { renderCampaigns, pageTypeUpdated } = useRenderCampaigns("checkout")
|
|
23
|
+
const { renderCampaigns } = useRenderCampaigns()
|
|
27
24
|
|
|
28
25
|
useNostoApi(
|
|
29
26
|
async (api) => {
|
|
@@ -31,9 +28,7 @@ export default function NostoCheckout(props: { placements?: string[] }) {
|
|
|
31
28
|
.viewCart()
|
|
32
29
|
.setPlacements(props.placements || api.placements.getPlacements())
|
|
33
30
|
.load()
|
|
34
|
-
renderCampaigns(data
|
|
35
|
-
}
|
|
36
|
-
[recommendationComponent, pageTypeUpdated]
|
|
37
|
-
)
|
|
31
|
+
renderCampaigns(data)
|
|
32
|
+
})
|
|
38
33
|
return null
|
|
39
34
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useNostoApi } from "../utils/hooks"
|
|
1
|
+
import { useRenderCampaigns, useNostoApi } from "../hooks"
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* The `NostoHome` component must be used to personalise the home page. The component does not require any props.
|
|
@@ -25,9 +24,7 @@ import { useNostoApi } from "../utils/hooks"
|
|
|
25
24
|
* @group Components
|
|
26
25
|
*/
|
|
27
26
|
export default function NostoHome(props: { placements?: string[] }) {
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
const { renderCampaigns, pageTypeUpdated } = useRenderCampaigns("home")
|
|
27
|
+
const { renderCampaigns } = useRenderCampaigns()
|
|
31
28
|
|
|
32
29
|
useNostoApi(
|
|
33
30
|
async (api) => {
|
|
@@ -35,9 +32,8 @@ export default function NostoHome(props: { placements?: string[] }) {
|
|
|
35
32
|
.viewFrontPage()
|
|
36
33
|
.setPlacements(props.placements || api.placements.getPlacements())
|
|
37
34
|
.load()
|
|
38
|
-
renderCampaigns(data
|
|
39
|
-
}
|
|
40
|
-
[recommendationComponent, pageTypeUpdated]
|
|
35
|
+
renderCampaigns(data)
|
|
36
|
+
}
|
|
41
37
|
)
|
|
42
38
|
return null
|
|
43
39
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Order } from "../types"
|
|
2
|
-
import {
|
|
2
|
+
import { useRenderCampaigns, useNostoApi } from "../hooks"
|
|
3
3
|
import { snakeize } from "../utils/snakeize"
|
|
4
|
-
import { useNostoApi } from "../utils/hooks"
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* You can personalise your order-confirmation/thank-you page by using the `NostoOrder` component.
|
|
@@ -27,9 +26,7 @@ export default function NostoOrder(props: {
|
|
|
27
26
|
placements?: string[]
|
|
28
27
|
}) {
|
|
29
28
|
const { order, placements } = props
|
|
30
|
-
const {
|
|
31
|
-
|
|
32
|
-
const { renderCampaigns, pageTypeUpdated } = useRenderCampaigns("order")
|
|
29
|
+
const { renderCampaigns } = useRenderCampaigns()
|
|
33
30
|
|
|
34
31
|
useNostoApi(
|
|
35
32
|
async (api) => {
|
|
@@ -37,9 +34,10 @@ export default function NostoOrder(props: {
|
|
|
37
34
|
.addOrder(snakeize(order))
|
|
38
35
|
.setPlacements(placements || api.placements.getPlacements())
|
|
39
36
|
.load()
|
|
40
|
-
renderCampaigns(data
|
|
37
|
+
renderCampaigns(data)
|
|
41
38
|
},
|
|
42
|
-
[
|
|
39
|
+
[order],
|
|
40
|
+
{ deep: true }
|
|
43
41
|
)
|
|
44
42
|
return null
|
|
45
43
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useNostoApi } from "../utils/hooks"
|
|
1
|
+
import { useRenderCampaigns, useNostoApi } from "../hooks"
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* You can personalise your miscellaneous pages by using the NostoOther component.
|
|
@@ -21,9 +20,7 @@ import { useNostoApi } from "../utils/hooks"
|
|
|
21
20
|
* @group Components
|
|
22
21
|
*/
|
|
23
22
|
export default function NostoOther(props: { placements?: string[] }) {
|
|
24
|
-
const {
|
|
25
|
-
|
|
26
|
-
const { renderCampaigns, pageTypeUpdated } = useRenderCampaigns("other")
|
|
23
|
+
const { renderCampaigns } = useRenderCampaigns()
|
|
27
24
|
|
|
28
25
|
useNostoApi(
|
|
29
26
|
async (api) => {
|
|
@@ -31,9 +28,7 @@ export default function NostoOther(props: { placements?: string[] }) {
|
|
|
31
28
|
.viewOther()
|
|
32
29
|
.setPlacements(props.placements || api.placements.getPlacements())
|
|
33
30
|
.load()
|
|
34
|
-
renderCampaigns(data
|
|
35
|
-
}
|
|
36
|
-
[recommendationComponent, pageTypeUpdated]
|
|
37
|
-
)
|
|
31
|
+
renderCampaigns(data)
|
|
32
|
+
})
|
|
38
33
|
return null
|
|
39
34
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useNostoApi } from "../utils/hooks"
|
|
1
|
+
import { useRenderCampaigns, useNostoApi } from "../hooks"
|
|
3
2
|
import { Product } from "../types"
|
|
4
3
|
|
|
5
4
|
/**
|
|
@@ -32,9 +31,7 @@ export default function NostoProduct(props: {
|
|
|
32
31
|
placements?: string[]
|
|
33
32
|
}) {
|
|
34
33
|
const { product, tagging, placements } = props
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
const { renderCampaigns, pageTypeUpdated } = useRenderCampaigns("product")
|
|
34
|
+
const { renderCampaigns } = useRenderCampaigns()
|
|
38
35
|
|
|
39
36
|
useNostoApi(
|
|
40
37
|
async (api) => {
|
|
@@ -42,10 +39,9 @@ export default function NostoProduct(props: {
|
|
|
42
39
|
.viewProduct(tagging ?? product)
|
|
43
40
|
.setPlacements(placements || api.placements.getPlacements())
|
|
44
41
|
.load()
|
|
45
|
-
renderCampaigns(data
|
|
42
|
+
renderCampaigns(data)
|
|
46
43
|
},
|
|
47
|
-
[product,
|
|
48
|
-
{ deep: true }
|
|
44
|
+
[product, tagging?.selected_sku_id]
|
|
49
45
|
)
|
|
50
46
|
return null
|
|
51
47
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { useEffect, isValidElement
|
|
2
|
-
import { NostoContext } from "
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import React, { useEffect, isValidElement } from "react"
|
|
2
|
+
import { NostoContext, RecommendationComponent } from "../context"
|
|
3
|
+
import { NostoClient } from "../types"
|
|
4
|
+
import { isNostoLoaded } from "./helpers"
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @group Components
|
|
@@ -19,7 +19,10 @@ export interface NostoProviderProps {
|
|
|
19
19
|
* Indicates an url of a server
|
|
20
20
|
*/
|
|
21
21
|
host?: string
|
|
22
|
-
|
|
22
|
+
/**
|
|
23
|
+
* children
|
|
24
|
+
*/
|
|
25
|
+
children: React.ReactElement | React.ReactElement[]
|
|
23
26
|
/**
|
|
24
27
|
* Indicates if merchant uses multiple currencies
|
|
25
28
|
*/
|
|
@@ -27,9 +30,7 @@ export interface NostoProviderProps {
|
|
|
27
30
|
/**
|
|
28
31
|
* Recommendation component which holds nostoRecommendation object
|
|
29
32
|
*/
|
|
30
|
-
recommendationComponent?:
|
|
31
|
-
nostoRecommendation: Recommendation
|
|
32
|
-
}>
|
|
33
|
+
recommendationComponent?: RecommendationComponent
|
|
33
34
|
/**
|
|
34
35
|
* Enables Shopify markets with language and market id
|
|
35
36
|
*/
|
|
@@ -67,7 +68,7 @@ export default function NostoProvider(props: NostoProviderProps) {
|
|
|
67
68
|
host,
|
|
68
69
|
children,
|
|
69
70
|
recommendationComponent,
|
|
70
|
-
shopifyMarkets
|
|
71
|
+
shopifyMarkets
|
|
71
72
|
} = props
|
|
72
73
|
const [clientScriptLoadedState, setClientScriptLoadedState] = React.useState(false)
|
|
73
74
|
const clientScriptLoaded = React.useMemo(() => clientScriptLoadedState, [clientScriptLoadedState])
|
|
@@ -78,61 +79,6 @@ export default function NostoProvider(props: NostoProviderProps) {
|
|
|
78
79
|
// Set responseMode for loading campaigns:
|
|
79
80
|
const responseMode = isValidElement(recommendationComponent) ? "JSON_ORIGINAL" : "HTML"
|
|
80
81
|
|
|
81
|
-
// RecommendationComponent for client-side rendering:
|
|
82
|
-
function RecommendationComponentWrapper(props: { nostoRecommendation: Recommendation }) {
|
|
83
|
-
return React.cloneElement(recommendationComponent!, {
|
|
84
|
-
// eslint-disable-next-line react/prop-types
|
|
85
|
-
nostoRecommendation: props.nostoRecommendation,
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
// custom hook for rendering campaigns (CSR/SSR):
|
|
90
|
-
const [pageType, setPageType] = useState("")
|
|
91
|
-
function useRenderCampaigns(type: string = "") {
|
|
92
|
-
const placementRefs = useRef<Record<string, Root>>({})
|
|
93
|
-
useEffect(() => {
|
|
94
|
-
if (pageType !== type) {
|
|
95
|
-
setPageType(type)
|
|
96
|
-
}
|
|
97
|
-
}, [])
|
|
98
|
-
|
|
99
|
-
const pageTypeUpdated = type === pageType
|
|
100
|
-
|
|
101
|
-
function renderCampaigns(
|
|
102
|
-
data: {
|
|
103
|
-
recommendations: Record<string, Recommendation>
|
|
104
|
-
campaigns: {
|
|
105
|
-
recommendations: Record<string, Recommendation>
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
api: NostoClient
|
|
109
|
-
) {
|
|
110
|
-
if (responseMode == "HTML") {
|
|
111
|
-
// inject content campaigns as usual:
|
|
112
|
-
api.placements.injectCampaigns(data.recommendations)
|
|
113
|
-
} else {
|
|
114
|
-
// render recommendation component into placements:
|
|
115
|
-
const recommendations = data.campaigns.recommendations
|
|
116
|
-
for (const key in recommendations) {
|
|
117
|
-
const recommendation = recommendations[key]
|
|
118
|
-
const placementSelector = "#" + key
|
|
119
|
-
const placement = () => document.querySelector(placementSelector)
|
|
120
|
-
|
|
121
|
-
if (placement()) {
|
|
122
|
-
if (!placementRefs.current[key]) placementRefs.current[key] = createRoot(placement()!)
|
|
123
|
-
const root = placementRefs.current[key]!
|
|
124
|
-
root.render(
|
|
125
|
-
<RecommendationComponentWrapper
|
|
126
|
-
nostoRecommendation={recommendation}
|
|
127
|
-
></RecommendationComponentWrapper>
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
return { renderCampaigns, pageTypeUpdated }
|
|
134
|
-
}
|
|
135
|
-
|
|
136
82
|
useEffect(() => {
|
|
137
83
|
if (!window.nostojs) {
|
|
138
84
|
window.nostojs = (cb: (api: NostoClient) => void) => {
|
|
@@ -141,7 +87,7 @@ export default function NostoProvider(props: NostoProviderProps) {
|
|
|
141
87
|
window.nostojs(api => api.setAutoLoad(false))
|
|
142
88
|
}
|
|
143
89
|
|
|
144
|
-
if (!
|
|
90
|
+
if (!isNostoLoaded() && !shopifyMarkets) {
|
|
145
91
|
const script = document.createElement("script")
|
|
146
92
|
script.type = "text/javascript"
|
|
147
93
|
script.src = "//" + (host || "connect.nosto.com") + "/include/" + account
|
|
@@ -209,9 +155,7 @@ export default function NostoProvider(props: NostoProviderProps) {
|
|
|
209
155
|
clientScriptLoaded,
|
|
210
156
|
currentVariation,
|
|
211
157
|
responseMode,
|
|
212
|
-
recommendationComponent
|
|
213
|
-
useRenderCampaigns,
|
|
214
|
-
pageType,
|
|
158
|
+
recommendationComponent
|
|
215
159
|
}}
|
|
216
160
|
>
|
|
217
161
|
{children}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useNostoApi } from "../utils/hooks"
|
|
1
|
+
import { useRenderCampaigns, useNostoApi } from "../hooks"
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* You can personalise your search pages by using the NostoSearch component.
|
|
@@ -26,9 +25,7 @@ import { useNostoApi } from "../utils/hooks"
|
|
|
26
25
|
*/
|
|
27
26
|
export default function NostoSearch(props: { query: string; placements?: string[] }) {
|
|
28
27
|
const { query, placements } = props
|
|
29
|
-
const {
|
|
30
|
-
|
|
31
|
-
const { renderCampaigns, pageTypeUpdated } = useRenderCampaigns("search")
|
|
28
|
+
const { renderCampaigns } = useRenderCampaigns()
|
|
32
29
|
|
|
33
30
|
useNostoApi(
|
|
34
31
|
async (api) => {
|
|
@@ -36,9 +33,9 @@ export default function NostoSearch(props: { query: string; placements?: string[
|
|
|
36
33
|
.viewSearch(query)
|
|
37
34
|
.setPlacements(placements || api.placements.getPlacements())
|
|
38
35
|
.load()
|
|
39
|
-
renderCampaigns(data
|
|
36
|
+
renderCampaigns(data)
|
|
40
37
|
},
|
|
41
|
-
[query
|
|
38
|
+
[query]
|
|
42
39
|
)
|
|
43
40
|
return null
|
|
44
41
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { useNostoContext } from "
|
|
1
|
+
import { useNostoContext, useDeepCompareEffect } from "../hooks"
|
|
2
2
|
import { Cart, Customer } from "../types"
|
|
3
3
|
import { snakeize } from "../utils/snakeize"
|
|
4
|
-
import { useDeepCompareEffect } from "../utils/hooks"
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Nosto React requires that you pass it the details of current cart contents and the details of the currently logged-in customer, if any, on every route change.
|
package/src/components/index.ts
CHANGED
|
@@ -8,7 +8,4 @@ export { default as NostoOrder } from "./NostoOrder"
|
|
|
8
8
|
export { default as NostoHome } from "./NostoHome"
|
|
9
9
|
export { default as NostoPlacement } from "./NostoPlacement"
|
|
10
10
|
export { default as NostoProvider } from "./NostoProvider"
|
|
11
|
-
|
|
12
|
-
export { NostoContext, useNostoContext } from "./context"
|
|
13
|
-
export type { NostoContextType } from "./context"
|
|
14
11
|
export { default as NostoSession } from "./NostoSession"
|
package/src/context.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createContext } from "react"
|
|
2
|
+
import { Recommendation, RenderMode } from "./types"
|
|
3
|
+
|
|
4
|
+
type AnyFunction = (...args: unknown[]) => unknown
|
|
5
|
+
|
|
6
|
+
export type RecommendationComponent = React.ReactElement<{
|
|
7
|
+
nostoRecommendation: Recommendation
|
|
8
|
+
}>
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @group Types
|
|
12
|
+
*/
|
|
13
|
+
export interface NostoContextType {
|
|
14
|
+
account: string
|
|
15
|
+
clientScriptLoaded: boolean
|
|
16
|
+
currentVariation?: string
|
|
17
|
+
renderFunction?: AnyFunction
|
|
18
|
+
responseMode: RenderMode
|
|
19
|
+
recommendationComponent?: RecommendationComponent
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @group Essential Functions
|
|
24
|
+
*/
|
|
25
|
+
export const NostoContext = createContext<NostoContextType>({
|
|
26
|
+
account: "",
|
|
27
|
+
currentVariation: "",
|
|
28
|
+
responseMode: "HTML",
|
|
29
|
+
clientScriptLoaded: false
|
|
30
|
+
})
|
|
31
|
+
|