@hiver/connector-admin 4.18.0-multiStore-beta.3 → 4.18.0-multiStore-beta.4

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/index.umd.js CHANGED
@@ -3594,7 +3594,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
3594
3594
  transform: rotate(360deg);
3595
3595
  }
3596
3596
  }
3597
- `,x1=e=>{const{isLoading:t=!1}=e;return t?l.jsx(c.Stack,{className:"h-[38px] w-[58px] justify-center items-center",children:l.jsx(IX,{})}):l.jsx(c.Switch,{...e})},pX="Add New Store",BX="Add New Store",hX="Each store has its own configuration. Choose a descriptive name to help distinguish it from other stores.",QX="Enter Store name",mX="Enter Store name",yX="Submit",bX="Cancel",xX=(e,t)=>`${e}/${t} stores used`,vX="Added successfully",v1={NAME_TAKEN:"A connector with this name already exists.",LIMIT_REACHED:"You've reached the maximum number of stores.",MULTI_STORE_DISABLED:"Adding stores isn't available for this app.",PARENT_INVALID:"Something went wrong. Please try again."},wX={"A connector with this name already exists":"NAME_TAKEN","Store limit reached for this template":"LIMIT_REACHED","Multi-store is not enabled for this template":"MULTI_STORE_DISABLED","Invalid parent connector for this store":"PARENT_INVALID"},SX="Something went wrong. Please try again.",TX=({shown:e,setShown:t,onSubmit:n,isSubmitting:r=!1,errorMessage:o})=>{const[A,s]=m.useState("");m.useEffect(()=>{e||s("")},[e]);const a=A.trim(),i=a.length>0&&!r,u=()=>{i&&n(a)},g=()=>{t(!1)};return l.jsx(Xo,{shown:e,setShown:t,showCloseButton:!0,children:l.jsxs(c.Stack,{"data-testid":"add-new-store-panel",padding:"30px",width:"440px",children:[l.jsxs(c.Stack,{gap:"4px",marginBottom:"24px",children:[l.jsx(c.Typography,{variant:"h2",children:BX}),l.jsx(c.Typography,{variant:"body2",children:hX})]}),l.jsxs(c.Stack,{gap:"6px",marginBottom:"36px",children:[l.jsx(qC,{fullWidth:!0,variant:"outlined",label:mX,placeholder:QX,value:A,disabled:r,error:!!o,inputProps:{"data-testid":"add-new-store-input"},onChange:d=>s(d.target.value)}),o?l.jsx(c.Typography,{"data-testid":"add-new-store-error",variant:"body2",color:"error",children:o}):null]}),l.jsxs(c.Stack,{direction:"row",justifyContent:"flex-end",gap:"12px",children:[l.jsx(c.Button,{"data-testid":"add-new-store-cancel-button",onClick:g,variant:"outlined",color:"tertiary",size:"medium",disabled:r,sx:{height:"32px"},children:bX}),l.jsx(c.Button,{"data-testid":"add-new-store-submit-button",onClick:u,variant:"contained",color:"primary",size:"medium",sx:{height:"32px"},disabled:!i,children:r?l.jsx(c.CircularProgress,{sx:{color:"#97A3B7"},size:20}):l.jsx("div",{children:yX})})]})]})})},w1=e=>e&&e in v1?v1[e]:SX,_X=e=>{if(typeof e!="object"||e===null)return;const t=e.response;if(typeof t!="object"||t===null)return;const n=t.data;if(typeof n!="object"||n===null)return;const r=n.error;return typeof r=="string"?r:void 0},OX=e=>{const t=_X(e);return w1(t?wX[t]:void 0)},DX=({connectorDetails:e})=>{const[t,n]=m.useState(!1),[r,o]=m.useState(!1),[A,s]=m.useState(void 0),a=jt(),i=Pn(),u=!!(e!=null&&e.showAddStore),g=!!(e!=null&&e.isStore),d=async Q=>{if(!e)return;s(void 0),o(!0);const y=e.templateId??"";try{const{valid:b,reason:w}=await IW({templateId:y,parentConnectorId:e.id,name:Q});if(!b){s(w1(w)),o(!1);return}await pW({templateId:y,parentConnectorId:e.id,name:Q}),n(!1),Ot({message:vX,type:mr}),i(FA()),a(`${Oe.BASEPATH}${Oe.DASHBOARD}`)}catch(b){s(OX(b)),o(!1)}};if(!u||g)return null;const I=!!(e!=null&&e.canAddStore),B=(e==null?void 0:e.storesUsed)??0,f=(e==null?void 0:e.maxStores)??0,C=!I,E=C?xX(B,f):"",h=()=>{s(void 0),n(!0)},p=l.jsx(c.Button,{"data-testid":"add-new-store-button",variant:"outlined",color:"tertiary",size:"medium",disabled:C,sx:{height:"32px",textTransform:"none",borderColor:"#D6DDE8",padding:"8px 12px !important",color:"#343C45","&:hover":{borderColor:"#D6DDE8"}},onClick:h,children:pX});return l.jsxs(l.Fragment,{children:[C?l.jsx(c.Tooltip,{title:E,placement:"bottom",children:l.jsx("span",{"data-testid":"add-new-store-button-tooltip-wrapper",children:p})}):p,l.jsx("div",{"data-testid":"add-new-store-divider",className:"w-px h-6 bg-[#D6DDE8] mx-2"}),l.jsx(TX,{shown:t,setShown:n,onSubmit:d,isSubmitting:r,errorMessage:A})]})},QE="authSuccedded",S1="authFaield",LX="token",FX="connector_id",et={IDLE:"idle",PENDING:"pending",OAUTH_SUCCESS:"oauth_success",OAUTH_FAILED:"oauth_failed",API_KEY_SUCCESS:"api_success",API_KEY_FAILED:"api_failed",BASIC_AUTH_SUCCESS:"basic_auth_success",BASIC_AUTH_FAILED:"basic_auth_failed",OAUTH1_SUCCESS:"oauth1_success",OAUTH1_FAILED:"oauth1_failed",REQUEST_FAILED:"request_failed"},kX="Successfully authorized",PX="Authorization failed",NX="Copied to clipboard",RX="Successfully saved details",T1="Please enter a valid URL",MX="URL must start with https://",jX="URL should not end with a slash",VX="What's new?",GX="A new upgrade is available for your app that requires action from your side:",HX="Required steps:",WX="View upgrade guide",_1="App upgraded successfully",O1="App upgrade failed",zX="\\{\\{([\\w_]+)\\}\\}",YX=c.styled(c.Accordion)`
3597
+ `,x1=e=>{const{isLoading:t=!1}=e;return t?l.jsx(c.Stack,{className:"h-[38px] w-[58px] justify-center items-center",children:l.jsx(IX,{})}):l.jsx(c.Switch,{...e})},pX="Add New Store",BX="Add New Store",hX="Each instance has its own configuration. Choose a descriptive name to help distinguish it from other instances",QX="Enter app name",mX="App Name",yX="Submit",bX="Cancel",xX=(e,t)=>`${e}/${t} stores used`,vX=e=>`${e} added successfully`,v1={NAME_TAKEN:"A connector with this name already exists.",LIMIT_REACHED:"You've reached the maximum number of stores.",MULTI_STORE_DISABLED:"Adding stores isn't available for this app.",PARENT_INVALID:"Something went wrong. Please try again."},wX={"A connector with this name already exists":"NAME_TAKEN","Store limit reached for this template":"LIMIT_REACHED","Multi-store is not enabled for this template":"MULTI_STORE_DISABLED","Invalid parent connector for this store":"PARENT_INVALID"},SX="Something went wrong. Please try again.",TX=({shown:e,setShown:t,onSubmit:n,isSubmitting:r=!1,errorMessage:o})=>{var d,I;const[A,s]=m.useState("");m.useEffect(()=>{e||s("")},[e]);const a=A.trim(),i=a.length>0&&!r,u=()=>{i&&n(a)},g=()=>{t(!1)};return l.jsx(Xo,{shown:e,setShown:t,showCloseButton:!0,closeButtonSize:20,children:l.jsxs(c.Stack,{"data-testid":"add-new-store-panel",padding:"16px",width:"559px",children:[l.jsxs(c.Stack,{marginBottom:"24px",children:[l.jsx(c.Typography,{variant:"h2",children:BX}),l.jsx(c.Typography,{variant:"body2",style:{marginRight:"30px"},children:hX})]}),l.jsxs(c.Stack,{gap:"8px",marginBottom:"16px",children:[l.jsx(qC,{fullWidth:!0,variant:"outlined",label:mX,placeholder:QX,value:A,disabled:r,error:!!o,inputProps:{"data-testid":"add-new-store-input"},onChange:B=>s(B.target.value)}),o?l.jsx(c.Typography,{"data-testid":"add-new-store-error",variant:"body2",color:"error",children:o}):null]}),l.jsxs(c.Stack,{direction:"row",justifyContent:"flex-end",alignItems:"center",gap:"5px",children:[l.jsx(c.Button,{"data-testid":"add-new-store-cancel-button",onClick:g,variant:"text",disableRipple:!0,disabled:r,sx:{textTransform:"none",fontWeight:500,fontSize:"14px",lineHeight:"18px",padding:"4px 20px",borderRadius:0,color:((d=c.theme.palette.gray)==null?void 0:d.gray3)??"#6F7C90",backgroundColor:"transparent","&:hover":{backgroundColor:"transparent",color:((I=c.theme.palette.gray)==null?void 0:I.gray2)??"#4D596C"}},children:bX}),l.jsx(c.Button,{"data-testid":"add-new-store-submit-button",onClick:u,variant:"contained",color:"primary",sx:{textTransform:"none",fontWeight:500,fontSize:"14px",lineHeight:"18px",padding:"9px 12px",borderRadius:"4px",minWidth:"89px",boxShadow:"none","&:hover":{boxShadow:"none"}},disabled:!i,children:r?l.jsx(c.CircularProgress,{sx:{color:"#97A3B7"},size:20}):l.jsx("div",{children:yX})})]})]})})},w1=e=>e&&e in v1?v1[e]:SX,_X=e=>{if(typeof e!="object"||e===null)return;const t=e.response;if(typeof t!="object"||t===null)return;const n=t.data;if(typeof n!="object"||n===null)return;const r=n.error;return typeof r=="string"?r:void 0},OX=e=>{const t=_X(e);return w1(t?wX[t]:void 0)},DX=({connectorDetails:e})=>{const[t,n]=m.useState(!1),[r,o]=m.useState(!1),[A,s]=m.useState(void 0),a=jt(),i=Pn(),u=!!(e!=null&&e.showAddStore),g=!!(e!=null&&e.isStore),d=!!(e!=null&&e.isAuthenticated)&&!!(e!=null&&e.isEnabled),I=async y=>{if(!e)return;s(void 0),o(!0);const b=e.templateId??"";try{const{valid:w,reason:v}=await IW({templateId:b,parentConnectorId:e.id,name:y});if(!w){s(w1(v)),o(!1);return}await pW({templateId:b,parentConnectorId:e.id,name:y}),n(!1),Ot({message:vX(y),type:mr}),i(FA()),a(`${Oe.BASEPATH}${Oe.DASHBOARD}`)}catch(w){s(OX(w)),o(!1)}};if(!u||g||!d)return null;const B=!!(e!=null&&e.canAddStore),f=(e==null?void 0:e.storesUsed)??0,C=(e==null?void 0:e.maxStores)??0,E=!B,h=E?xX(f,C):"",p=()=>{s(void 0),n(!0)},Q=l.jsx(c.Button,{"data-testid":"add-new-store-button",variant:"outlined",color:"tertiary",size:"medium",disabled:E,sx:{height:"32px",textTransform:"none",borderColor:"#D6DDE8",padding:"8px 12px !important",color:"#343C45","&:hover":{borderColor:"#D6DDE8"}},onClick:p,children:pX});return l.jsxs(l.Fragment,{children:[E?l.jsx(c.Tooltip,{title:h,placement:"bottom",children:l.jsx("span",{"data-testid":"add-new-store-button-tooltip-wrapper",children:Q})}):Q,l.jsx("div",{"data-testid":"add-new-store-divider",className:"w-px h-6 bg-[#D6DDE8] mx-2"}),l.jsx(TX,{shown:t,setShown:n,onSubmit:I,isSubmitting:r,errorMessage:A})]})},QE="authSuccedded",S1="authFaield",LX="token",FX="connector_id",et={IDLE:"idle",PENDING:"pending",OAUTH_SUCCESS:"oauth_success",OAUTH_FAILED:"oauth_failed",API_KEY_SUCCESS:"api_success",API_KEY_FAILED:"api_failed",BASIC_AUTH_SUCCESS:"basic_auth_success",BASIC_AUTH_FAILED:"basic_auth_failed",OAUTH1_SUCCESS:"oauth1_success",OAUTH1_FAILED:"oauth1_failed",REQUEST_FAILED:"request_failed"},kX="Successfully authorized",PX="Authorization failed",NX="Copied to clipboard",RX="Successfully saved details",T1="Please enter a valid URL",MX="URL must start with https://",jX="URL should not end with a slash",VX="What's new?",GX="A new upgrade is available for your app that requires action from your side:",HX="Required steps:",WX="View upgrade guide",_1="App upgraded successfully",O1="App upgrade failed",zX="\\{\\{([\\w_]+)\\}\\}",YX=c.styled(c.Accordion)`
3598
3598
  box-shadow: none;
3599
3599
  margin: 24px 0 0 0;
3600
3600
  background: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiver/connector-admin",
3
- "version": "4.18.0-multiStore-beta.3",
3
+ "version": "4.18.0-multiStore-beta.4",
4
4
  "main": "index.es.js",
5
5
  "module": "index.es.js",
6
6
  "types": "index.d.ts",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/features/add-new-store/components/add-new-store-button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAY9D,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAyH/D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/features/add-new-store/components/add-new-store-button/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAY9D,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC5C;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA6H/D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/features/add-new-store/components/add-new-store-modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC;iDAC6C;IAC7C,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,mEAAmE;IACnE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;sEACkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAkF7D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/features/add-new-store/components/add-new-store-modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAcnD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC;iDAC6C;IAC7C,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,mEAAmE;IACnE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;sEACkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA8G7D,CAAC"}
@@ -1,16 +1,17 @@
1
1
  import { ValidateStoreReason } from '../../auth/types/request';
2
2
  export declare const ADD_NEW_STORE_BUTTON_TEXT = "Add New Store";
3
3
  export declare const ADD_NEW_STORE_MODAL_TITLE = "Add New Store";
4
- export declare const ADD_NEW_STORE_MODAL_HELPER_TEXT = "Each store has its own configuration. Choose a descriptive name to help distinguish it from other stores.";
5
- export declare const ADD_NEW_STORE_INPUT_PLACEHOLDER = "Enter Store name";
6
- export declare const ADD_NEW_STORE_INPUT_LABEL = "Enter Store name";
4
+ export declare const ADD_NEW_STORE_MODAL_HELPER_TEXT = "Each instance has its own configuration. Choose a descriptive name to help distinguish it from other instances";
5
+ export declare const ADD_NEW_STORE_INPUT_PLACEHOLDER = "Enter app name";
6
+ export declare const ADD_NEW_STORE_INPUT_LABEL = "App Name";
7
7
  export declare const ADD_NEW_STORE_SUBMIT_TEXT = "Submit";
8
8
  export declare const ADD_NEW_STORE_CANCEL_TEXT = "Cancel";
9
9
  /** Tooltip shown when the cap is reached, e.g. "3/3 stores used". */
10
10
  export declare const storesUsedTooltip: (storesUsed: number, maxStores: number) => string;
11
- /** Toast shown once the store row is created, i.e. at modal Submit. The store is
12
- * created credential-less, so this no longer waits on auth completing. */
13
- export declare const ADD_NEW_STORE_SUCCESS_TOAST = "Added successfully";
11
+ /** Toast shown once the store row is created, i.e. at modal Submit, e.g.
12
+ * "Shopify Acme added successfully". The store is created credential-less, so
13
+ * this no longer waits on auth completing. */
14
+ export declare const addNewStoreSuccessToast: (storeName: string) => string;
14
15
  /** Inline messages for each `validateNewStore` failure reason (M6 contract). */
15
16
  export declare const VALIDATE_STORE_ERROR_MESSAGES: {
16
17
  readonly NAME_TAKEN: "A connector with this name already exists.";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/add-new-store/constants/index.ts"],"names":[],"mappings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C/C,eAAO,MAAM,uBAAuB,cAAe,MAAM,KAAG,MAA2C,CAAC;AAExG,gFAAgF;AAChF,eAAO,MAAM,6BAA6B;;;;;CAKhC,CAAC;AAEX;;;;0CAI0C;AAC1C,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAK1E,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,2BAA2B,4CAA4C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"connector-template.d.ts","sourceRoot":"","sources":["../../../../../src/v2/testing/mocks/handlers/connector-template.ts"],"names":[],"mappings":"AA4VA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyB,CAAC;AAwErD,eAAO,MAAM,QAAQ,6BAYpB,CAAC"}
1
+ {"version":3,"file":"connector-template.d.ts","sourceRoot":"","sources":["../../../../../src/v2/testing/mocks/handlers/connector-template.ts"],"names":[],"mappings":"AAgWA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAyB,CAAC;AAwErD,eAAO,MAAM,QAAQ,6BAYpB,CAAC"}