@ikas/popup-renderer 1.0.200 → 1.0.202

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.
@@ -1 +1 @@
1
- import e from"react";import{observer as t}from"mobx-react";import{generateRandomId as r}from"../../../helpers/index.js";import{PhoneNumberInput as o}from"../phone-input-item-view/index.js";var n=t((function(t){var n=e.useState(!1),l=n[0],a=n[1];e.useRef(null);var i=e.useMemo((function(){return r()}),[]),c=t.placeholder,u=t.isRequired,s=t.inputLabel;t.updateCurrentInfo;var p=t.validationErrorMessage,d=t.formInputSettings,m=t.value,f=t.onValueChange,x=t.isPhoneInput,h=t.sfProps,v={width:"100%",backgroundColor:d.bgColor?"".concat(d.bgColor):"transparent",border:"".concat(d.borderWidth,"px solid ").concat(l?d.focusBorderColor:d.borderColor),borderRadius:"".concat(d.borderRadius,"px"),fontSize:"14px",padding:"10px 12px",height:"".concat(d.height,"px"),outline:"none"},g=function(e){f(e),u&&u.hasError&&e.length>0&&(u.hasError=!1)},y=u?((null==c?void 0:c.text)||"")+" *":(null==c?void 0:c.text)||"";return e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"}},(s||u)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},s&&e.createElement("label",{style:{color:d.titleColor,fontSize:"14px"}},s.text)),u&&u.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},u.validationErrorMessage),!!p&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},p)),x?e.createElement(o,{onChange:function(e){return g(e)},placeholder:y,value:m||"",inputStyle:v,defaultCountry:null==h?void 0:h.currentCountryCode,className:"ikas-form-input-item-view-".concat(i)}):e.createElement("input",{type:"text",placeholder:y,value:m||"",onChange:function(e){return g(e.target.value)},style:v,onFocus:function(){return a(!0)},onBlur:function(){return a(!1)},className:"ikas-form-input-item-view-".concat(i)}),e.createElement("style",null,"\n .ikas-form-input-item-view-".concat(i,"::placeholder {\n color: ").concat(d.placeholderColor,";\n }\n ")))}));export{n as default};
1
+ import e from"react";import{observer as t}from"mobx-react";import{generateRandomId as r}from"../../../helpers/index.js";import{PhoneNumberInput as o}from"../phone-input-item-view/index.js";var n=t((function(t){var n=e.useState(!1),l=n[0],a=n[1];e.useRef(null);var i=e.useMemo((function(){return r()}),[]),c=t.placeholder,u=t.isRequired,s=t.inputLabel;t.updateCurrentInfo;var p=t.validationErrorMessage,d=t.formInputSettings,m=t.value,f=t.onValueChange,x=t.isPhoneInput,h=t.sfProps,v={width:"100%",backgroundColor:d.bgColor?"".concat(d.bgColor):"transparent",border:"".concat(d.borderWidth,"px solid ").concat(l?d.focusBorderColor:d.borderColor),borderRadius:"".concat(d.borderRadius,"px"),fontSize:"14px",padding:"10px 12px",height:"".concat(d.height,"px"),outline:"none"},g=function(e){f(e),u&&u.hasError&&e.length>0&&(u.hasError=!1)},E=u?((null==c?void 0:c.text)||"")+" *":(null==c?void 0:c.text)||"";return e.createElement("div",{style:{width:"100%",display:"flex",gap:2,flexDirection:"column"}},(s||u)&&e.createElement("div",{style:{display:"flex",flexDirection:"column",gap:4,marginBottom:"6px"}},e.createElement("div",{style:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"}},s&&e.createElement("label",{style:{color:d.titleColor,fontSize:"14px"}},s.text)),u&&u.hasError&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},u.validationErrorMessage),!!p&&e.createElement("div",{style:{color:"red",fontSize:"12px"}},p)),x?e.createElement(o,{onChange:function(e){return g(e)},placeholder:E,value:m||"",inputStyle:v,sfProps:h,className:"ikas-form-input-item-view-".concat(i)}):e.createElement("input",{type:"text",placeholder:E,value:m||"",onChange:function(e){return g(e.target.value)},style:v,onFocus:function(){return a(!0)},onBlur:function(){return a(!1)},className:"ikas-form-input-item-view-".concat(i)}),e.createElement("style",null,"\n .ikas-form-input-item-view-".concat(i,"::placeholder {\n color: ").concat(d.placeholderColor,";\n }\n ")))}));export{n as default};
@@ -3,5 +3,5 @@ export type CountryType = {
3
3
  value: CountryCode;
4
4
  label: string | undefined;
5
5
  };
6
- declare const getCountries: () => Promise<CountryType[]>;
6
+ declare const getCountries: (currentLocale?: string) => Promise<CountryType[]>;
7
7
  export default getCountries;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as o}from'./../../../../ext/tslib/tslib.es6.mjs.js';import'./../../../../ext/libphonenumber-js/es6/PhoneNumberMatcher.js';import'./../../../../ext/libphonenumber-js/es6/AsYouTypeFormatter.js';import'./../../../../ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js';import'./../../../../ext/libphonenumber-js/min/exports/AsYouType.js';import{getCountries as n}from'./../../../../ext/libphonenumber-js/min/exports/getCountries.js';import'./../../../../ext/libphonenumber-js/min/exports/Metadata.js';import'./../../../../ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js';import'./../../../../ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js';var s=function(){return e(void 0,void 0,void 0,(function(){var e;return o(this,(function(o){switch(o.label){case 0:return"https://cdn.myikas.com/sf/static/locale/country/en.json",[4,fetch("https://cdn.myikas.com/sf/static/locale/country/en.json")];case 1:return[4,o.sent().json()];case 2:return e=o.sent(),[2,n().map((function(o){return{value:o,label:e[o]}})).sort((function(e,o){return function(e,o){return e.localeCompare(o)}(e.label,o.label)}))]}}))}))};export{s as default};
1
+ import{__awaiter as e,__generator as n}from'./../../../../ext/tslib/tslib.es6.mjs.js';import'./../../../../ext/libphonenumber-js/es6/PhoneNumberMatcher.js';import'./../../../../ext/libphonenumber-js/es6/AsYouTypeFormatter.js';import'./../../../../ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js';import'./../../../../ext/libphonenumber-js/min/exports/AsYouType.js';import{getCountries as o}from'./../../../../ext/libphonenumber-js/min/exports/getCountries.js';import'./../../../../ext/libphonenumber-js/min/exports/Metadata.js';import'./../../../../ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js';import'./../../../../ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js';var s=function(s){return e(void 0,void 0,void 0,(function(){var e,t;return n(this,(function(n){switch(n.label){case 0:return e=function(e){if(!e)return"https://cdn.myikas.com/sf/static/locale/country/en.json";var n=e;return["de","el","en","es","fi","fr","it","nb","pl","pt-BR","pt","ru","sv","tr","ua","vi"].some((function(e){return e===n}))||(n="en"),"https://cdn.myikas.com/sf/static/locale/country/".concat(n,".json")}(s),[4,fetch(e)];case 1:return[4,n.sent().json()];case 2:return t=n.sent(),[2,o().map((function(e){return{value:e,label:t[e]}})).sort((function(e,n){return function(e,n){return e.localeCompare(n)}(e.label,n.label)}))]}}))}))};export{s as default};
@@ -1,6 +1,7 @@
1
1
  import * as React from "react";
2
+ import { SFProps } from "popup-renderer/components";
2
3
  type Props = {
3
- defaultCountry?: string | null;
4
+ sfProps?: SFProps;
4
5
  disabled?: boolean;
5
6
  placeholder: string | undefined;
6
7
  value: string;
@@ -1 +1 @@
1
- import{__awaiter as e,__generator as t}from'./../../../../ext/tslib/tslib.es6.mjs.js';import*as o from"react";import'./../../../../ext/mobx-react-lite/es/index.js';import r from'./../../../../ext/libphonenumber-js/es6/parseIncompletePhoneNumber.js';import'./../../../../ext/libphonenumber-js/es6/PhoneNumberMatcher.js';import'./../../../../ext/libphonenumber-js/es6/AsYouTypeFormatter.js';import{parsePhoneNumber as n}from'./../../../../ext/libphonenumber-js/min/exports/parsePhoneNumber.js';import'./../../../../ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js';import'./../../../../ext/libphonenumber-js/min/exports/AsYouType.js';import{isSupportedCountry as i}from'./../../../../ext/libphonenumber-js/min/exports/isSupportedCountry.js';import{getCountryCallingCode as s}from'./../../../../ext/libphonenumber-js/min/exports/getCountryCallingCode.js';import'./../../../../ext/libphonenumber-js/min/exports/Metadata.js';import{formatIncompletePhoneNumber as l}from'./../../../../ext/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js';import'./../../../../ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js';import'./../../../../ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js';import a from"./get-countries.js";import{observer as m}from'./../../../../ext/mobx-react-lite/es/observer.js';var u=m((function(m){var u=m.defaultCountry,d=m.disabled,p=void 0!==d&&d,c=m.placeholder,b=m.value,h=m.onChange,f=m.inputStyle,v=m.className,x=o.useState([]),j=x[0],g=x[1],y=o.useState(u||"TR"),_=y[0],C=y[1],E=o.useState(""),N=E[0],S=E[1];o.useEffect((function(){w();var e=_;if(i(e)||(e="US"),b){var t=n(b);t&&t.country&&(e=t.country),S(l(b,e))}else P(e);C(e)}),[u]);var w=function(){return e(void 0,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:return[4,a()];case 1:return e=t.sent(),g(e),[2]}}))}))},P=function(e){var t=s(e);S("+".concat(t))},I=function(e){return l(e,_)};return o.createElement("div",{style:{position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center"}},o.createElement("div",{style:{position:"absolute",top:"26px",left:"16px"}},o.createElement("div",{style:{position:"relative",width:"35px",height:"24px",flex:"0 0 35px"}},o.createElement("div",{style:{position:"relative",width:"35px",height:"24px",display:"flex",alignItems:"center"}},o.createElement("img",{style:{width:"24px",flex:"0 0 24px"},alt:_,src:"https://cdn.myikas.com/sf/assets/flags/3x2/".concat(_,".svg")}),o.createElement("div",{style:{display:"block",width:"0.3em",height:"0.3em",marginLeft:"0.35em",marginTop:"-0.2em",borderStyle:"solid",borderColor:"inherit",borderTopWidth:0,borderBottomWidth:"1px",borderLeftWidth:0,borderRightWidth:"1px",transform:"rotate(45deg)",opacity:.45,flex:"0 0 0.3em"}})),o.createElement("select",{style:{position:"absolute",top:0,left:0,zIndex:1,padding:0,opacity:0,border:0,width:"100%",height:"100%",cursor:"pointer"},value:_,onChange:function(e){if(e.target.value){var t=e.target.value;C(t),P(t)}},disabled:p},j.map((function(e){return o.createElement("option",{key:e.value,value:e.value},e.label)}))))),o.createElement("input",{type:"tel",autoComplete:"tel",value:N,onChange:function(e){var t=j.find((function(t){var o;return t.value===(null===(o=n(e.target.value))||void 0===o?void 0:o.country)}));t&&C(t.value);var o=I(e.target.value);S(o),h(o?r(o):e.target.value)},placeholder:c,disabled:p,style:f,className:v}))}));export{u as PhoneNumberInput};
1
+ import{__awaiter as e,__assign as t,__generator as o}from'./../../../../ext/tslib/tslib.es6.mjs.js';import*as r from"react";import'./../../../../ext/mobx-react-lite/es/index.js';import n from'./../../../../ext/libphonenumber-js/es6/parseIncompletePhoneNumber.js';import'./../../../../ext/libphonenumber-js/es6/PhoneNumberMatcher.js';import'./../../../../ext/libphonenumber-js/es6/AsYouTypeFormatter.js';import{parsePhoneNumber as i}from'./../../../../ext/libphonenumber-js/min/exports/parsePhoneNumber.js';import'./../../../../ext/libphonenumber-js/min/exports/PhoneNumberMatcher.js';import'./../../../../ext/libphonenumber-js/min/exports/AsYouType.js';import{isSupportedCountry as s}from'./../../../../ext/libphonenumber-js/min/exports/isSupportedCountry.js';import{getCountryCallingCode as l}from'./../../../../ext/libphonenumber-js/min/exports/getCountryCallingCode.js';import'./../../../../ext/libphonenumber-js/min/exports/Metadata.js';import{formatIncompletePhoneNumber as a}from'./../../../../ext/libphonenumber-js/min/exports/formatIncompletePhoneNumber.js';import'./../../../../ext/libphonenumber-js/es6/findNumbers/isValidCandidate.js';import'./../../../../ext/libphonenumber-js/index.es6.exports/PhoneNumberSearch.js';import m from"./get-countries.js";import{observer as u}from'./../../../../ext/mobx-react-lite/es/observer.js';var d=u((function(u){var d=u.disabled,p=void 0!==d&&d,c=u.placeholder,b=u.value,h=u.onChange,v=u.inputStyle,f=u.className,g=u.sfProps,j=r.useState([]),x=j[0],y=j[1],C=r.useState((null==g?void 0:g.currentCountryCode)||"TR"),_=C[0],E=C[1],N=r.useState(""),w=N[0],S=N[1];r.useEffect((function(){P();var e=_;if(s(e)||(e="US"),b){var t=i(b);t&&t.country&&(e=t.country),S(a(b,e))}else k(e);E(e)}),[null==g?void 0:g.currentCountryCode]);var P=function(){return e(void 0,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return[4,m(null==g?void 0:g.currentLocale)];case 1:return e=t.sent(),y(e),[2]}}))}))},k=function(e){var t=l(e);S("+".concat(t))},I=function(e){return a(e,_)};return r.createElement("div",{style:t({position:"relative",width:"100%",height:"100%",display:"flex",alignItems:"center",gap:8,pointerEvents:g?void 0:"none"},v)},r.createElement("div",{style:{}},r.createElement("div",{style:{position:"relative",width:"35px",height:"24px",flex:"0 0 35px"}},r.createElement("div",{style:{position:"relative",width:"35px",height:"24px",display:"flex",alignItems:"center"}},r.createElement("img",{style:{width:"24px",flex:"0 0 24px"},alt:_,src:"https://cdn.myikas.com/sf/assets/flags/3x2/".concat(_,".svg")}),r.createElement("div",{style:{display:"block",width:"0.3em",height:"0.3em",marginLeft:"0.35em",marginTop:"-0.2em",borderStyle:"solid",borderColor:"inherit",borderTopWidth:0,borderBottomWidth:"1px",borderLeftWidth:0,borderRightWidth:"1px",transform:"rotate(45deg)",opacity:.45,flex:"0 0 0.3em"}})),r.createElement("select",{style:{position:"absolute",top:0,left:0,zIndex:1,padding:0,opacity:0,border:0,width:"100%",height:"100%",cursor:"pointer"},value:_,onChange:function(e){if(e.target.value){var t=e.target.value;E(t),k(t)}},disabled:p},x.map((function(e){return r.createElement("option",{key:e.value,value:e.value},e.label)}))))),r.createElement("input",{type:"tel",autoComplete:"tel",value:w,onChange:function(e){var t=x.find((function(t){var o;return t.value===(null===(o=i(e.target.value))||void 0===o?void 0:o.country)}));t&&E(t.value);var o=I(e.target.value);S(o),h(o?n(o):e.target.value)},placeholder:c,disabled:p,className:f,style:{width:"100%",backgroundColor:"transparent",background:"transparent",border:"none",outline:"none"}}))}));export{d as PhoneNumberInput};
@@ -6,6 +6,7 @@ import { PopupProduct } from "popup-renderer/models/modal/step/elements/product"
6
6
  export type SFProps = {
7
7
  isCustomerLoggedIn: boolean;
8
8
  currentCountryCode?: string;
9
+ currentLocale?: string;
9
10
  addProductToCart: (popupProduct: PopupProduct) => Promise<boolean>;
10
11
  onModalClose: (addToLocalStorage?: boolean) => void;
11
12
  onCustomerSave: (customer: PopupRendererSaveCustomerInput) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/popup-renderer",
3
- "version": "1.0.200",
3
+ "version": "1.0.202",
4
4
  "description": "",
5
5
  "author": "ucy",
6
6
  "license": "ISC",