@planningcenter/url 2.6.5 → 2.7.2

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 CHANGED
@@ -1,4 +1,4 @@
1
- export declare type Environment = "production" | "staging" | "development" | "test";
1
+ export declare type Environment = "production" | "staging" | "development" | "test" | "prototype";
2
2
  export declare type Product = "api" | "accounts" | "calendar" | "check-ins" | "giving" | "groups" | "login" | "people" | "publishing" | "registrations" | "services";
3
3
  declare const _default: (env: Environment) => (productName: Product) => string;
4
4
  export default _default;
package/dist/url.js CHANGED
@@ -1,2 +1,2 @@
1
- var t=function(){var t=location.hostname.match(/planningcenter(online)?.com/);return null===t?"planningcenteronline.com":t[0]};module.exports=function(n){return function(e){if(n&&e)switch(n){case"production":return"https://"+e+"."+t();case"staging":return"https://"+e+"-staging."+t();case"development":var o="test";try{o=location.hostname.match(/\pco\.(\w+)$/)[1]}catch(t){"localhost"!==location.hostname&&console.error(location.hostname+" is not a supported dev TLD")}return"http://"+e+".pco."+o;case"test":return"http://"+e+".pco.test";default:return"http://"+e+"."+t()}}};
1
+ var t=function(){var t=location.hostname.match(/planningcenter(online)?.com/);return null===t?"planningcenteronline.com":t[0]};module.exports=function(n){return function(e){if(n&&e)switch(n){case"production":return"https://"+e+"."+t();case"staging":return"https://"+e+"-staging."+t();case"development":var o="test";try{o=location.hostname.match(/\pco\.(\w+)$/)[1]}catch(t){"localhost"!==location.hostname&&console.error(location.hostname+" is not a supported dev TLD")}return"http://"+e+".pco."+o;case"prototype":return"https://"+((r=null==(a=location)||null==(c=a.hostname)?void 0:c.match(/(?:www\.)?(.+)\..+\.planningcenter\.ninja/))&&"localhost"!==r[1]?r[1]:"main")+"."+e+".planningcenter.ninja";case"test":return"http://"+e+".pco.test";default:return"http://"+e+"."+t()}var a,c,r}};
2
2
  //# sourceMappingURL=url.js.map
package/dist/url.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"url.js","sources":["../index.ts"],"sourcesContent":["export type Environment = \"production\" | \"staging\" | \"development\" | \"test\"\nexport type Product =\n | \"api\"\n | \"accounts\"\n | \"calendar\"\n | \"check-ins\"\n | \"giving\"\n | \"groups\"\n | \"login\"\n | \"people\"\n | \"publishing\"\n | \"registrations\"\n | \"services\"\n\nexport default (env: Environment) => (productName: Product) => {\n if (!(env && productName)) return\n\n switch (env) {\n case \"production\":\n return `https://${productName}.${domain()}`\n case \"staging\":\n return `https://${productName}-staging.${domain()}`\n case \"development\":\n let tld = \"test\"\n\n try {\n tld = location.hostname.match(/\\pco\\.(\\w+)$/)[1]\n } catch (error) {\n // don't show warning in Topbar's local dev env\n if (location.hostname !== \"localhost\") {\n console.error(`${location.hostname} is not a supported dev TLD`)\n }\n }\n\n return `http://${productName}.pco.${tld}`\n case \"test\":\n return `http://${productName}.pco.test`\n default:\n return `http://${productName}.${domain()}`\n }\n}\n\nconst domain = () => {\n const result = location.hostname.match(/planningcenter(online)?.com/)\n\n if (result === null) {\n return \"planningcenteronline.com\"\n } else {\n return result[0]\n }\n}\n"],"names":["domain","result","location","hostname","match","env","productName","tld","error","console"],"mappings":"AAcA,IA4BMA,EAAS,WACb,IAAMC,EAASC,SAASC,SAASC,MAAM,+BAEvC,OAAe,OAAXH,EACK,2BAEAA,EAAO,mBAlClB,SAAgBI,GAAqB,OAAA,SAACC,GACpC,GAAMD,GAAOC,EAEb,OAAQD,GACN,IAAK,aACH,MAAA,WAAkBC,EAAeN,IAAAA,IACnC,IAAK,UACH,MAAkBM,WAAAA,cAAuBN,IAC3C,IAAK,cACH,IAAIO,EAAM,OAEV,IACEA,EAAML,SAASC,SAASC,MAAM,gBAAgB,GAC9C,MAAOI,GAEmB,cAAtBN,SAASC,UACXM,QAAQD,MAASN,SAASC,SAC3B,+BAGH,MAAA,UAAiBG,EAAjB,QAAoCC,EACtC,IAAK,OACH,MAAiBD,UAAAA,EACnB,YAAA,QACE,MAAiBA,UAAAA,MAAeN"}
1
+ {"version":3,"file":"url.js","sources":["../index.ts"],"sourcesContent":["export type Environment = \"production\" | \"staging\" | \"development\" | \"test\" | \"prototype\"\nexport type Product =\n | \"api\"\n | \"accounts\"\n | \"calendar\"\n | \"check-ins\"\n | \"giving\"\n | \"groups\"\n | \"login\"\n | \"people\"\n | \"publishing\"\n | \"registrations\"\n | \"services\"\n\nexport default (env: Environment) => (productName: Product) => {\n if (!(env && productName)) return\n\n switch (env) {\n case \"production\":\n return `https://${productName}.${domain()}`\n case \"staging\":\n return `https://${productName}-staging.${domain()}`\n case \"development\":\n let tld = \"test\"\n\n try {\n tld = location.hostname.match(/\\pco\\.(\\w+)$/)[1]\n } catch (error) {\n // don't show warning in Topbar's local dev env\n if (location.hostname !== \"localhost\") {\n console.error(`${location.hostname} is not a supported dev TLD`)\n }\n }\n\n return `http://${productName}.pco.${tld}`\n case \"prototype\":\n return `https://${prototypeEnv()}.${productName}.planningcenter.ninja`\n case \"test\":\n return `http://${productName}.pco.test`\n default:\n return `http://${productName}.${domain()}`\n }\n}\n\n/**\n* If the hostname is a Protonova URL, get the env from the subdomain. Defaults to main.\n* Example: my-cool-change.accounts.planningcenter.ninja -> my-cool-change\n* @returns {string}\n*/\nconst prototypeEnv = () => {\n const result = location?.hostname?.match(/(?:www\\.)?(.+)\\..+\\.planningcenter\\.ninja/)\n\n if (result && result[1] !== \"localhost\") {\n return result[1]\n }\n\n return \"main\"\n}\n\nconst domain = () => {\n const result = location.hostname.match(/planningcenter(online)?.com/)\n\n if (result === null) {\n return \"planningcenteronline.com\"\n } else {\n return result[0]\n }\n}\n"],"names":["domain","result","location","hostname","match","env","productName","tld","error","console","prototypeEnv","_location","_location$hostname"],"mappings":"AAcA,IA6CMA,EAAS,WACb,IAAMC,EAASC,SAASC,SAASC,MAAM,+BAEvC,OAAe,OAAXH,EACK,2BAEAA,EAAO,EAEjB,iBArDc,SAACI,GAAqB,OAAA,SAACC,GACpC,GAAMD,GAAOC,EAEb,OAAQD,GACN,IAAK,aACH,MAAkBC,WAAAA,MAAeN,IACnC,IAAK,UACH,MAAkBM,WAAAA,cAAuBN,IAC3C,IAAK,cACH,IAAIO,EAAM,OAEV,IACEA,EAAML,SAASC,SAASC,MAAM,gBAAgB,EAM/C,CALC,MAAOI,GAEmB,cAAtBN,SAASC,UACXM,QAAQD,MAASN,SAASC,uCAE7B,CAED,MAAiBG,UAAAA,EAAmBC,QAAAA,EACtC,IAAK,YACH,MAAkBG,aAchBT,SAASC,EAAAA,oBAAAS,EAAUR,iBAAVS,EAAoBR,MAAM,+CAEb,cAAdH,EAAO,GACZA,EAAO,GAGT,QApBiCK,IAAAA,EACtC,wBAAA,IAAK,OACH,gBAAiBA,EAAjB,YACF,QACE,MAAiBA,UAAAA,MAAeN,IASjB,IAAKW,EAAAC,EAClBX,CARP,CA5BD"}
@@ -1,2 +1,2 @@
1
- var t=t=>e=>{if(t&&e)switch(t){case"production":return`https://${e}.${n()}`;case"staging":return`https://${e}-staging.${n()}`;case"development":let t="test";try{t=location.hostname.match(/\pco\.(\w+)$/)[1]}catch(t){"localhost"!==location.hostname&&console.error(`${location.hostname} is not a supported dev TLD`)}return`http://${e}.pco.${t}`;case"test":return`http://${e}.pco.test`;default:return`http://${e}.${n()}`}};const n=()=>{const t=location.hostname.match(/planningcenter(online)?.com/);return null===t?"planningcenteronline.com":t[0]};export{t as default};
1
+ var t=t=>o=>{if(t&&o)switch(t){case"production":return`https://${o}.${e()}`;case"staging":return`https://${o}-staging.${e()}`;case"development":let t="test";try{t=location.hostname.match(/\pco\.(\w+)$/)[1]}catch(t){"localhost"!==location.hostname&&console.error(`${location.hostname} is not a supported dev TLD`)}return`http://${o}.pco.${t}`;case"prototype":return`https://${n()}.${o}.planningcenter.ninja`;case"test":return`http://${o}.pco.test`;default:return`http://${o}.${e()}`}};const n=()=>{var t,n;const e=null==(t=location)||null==(n=t.hostname)?void 0:n.match(/(?:www\.)?(.+)\..+\.planningcenter\.ninja/);return e&&"localhost"!==e[1]?e[1]:"main"},e=()=>{const t=location.hostname.match(/planningcenter(online)?.com/);return null===t?"planningcenteronline.com":t[0]};export{t as default};
2
2
  //# sourceMappingURL=url.modern.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"url.modern.js","sources":["../index.ts"],"sourcesContent":["export type Environment = \"production\" | \"staging\" | \"development\" | \"test\"\nexport type Product =\n | \"api\"\n | \"accounts\"\n | \"calendar\"\n | \"check-ins\"\n | \"giving\"\n | \"groups\"\n | \"login\"\n | \"people\"\n | \"publishing\"\n | \"registrations\"\n | \"services\"\n\nexport default (env: Environment) => (productName: Product) => {\n if (!(env && productName)) return\n\n switch (env) {\n case \"production\":\n return `https://${productName}.${domain()}`\n case \"staging\":\n return `https://${productName}-staging.${domain()}`\n case \"development\":\n let tld = \"test\"\n\n try {\n tld = location.hostname.match(/\\pco\\.(\\w+)$/)[1]\n } catch (error) {\n // don't show warning in Topbar's local dev env\n if (location.hostname !== \"localhost\") {\n console.error(`${location.hostname} is not a supported dev TLD`)\n }\n }\n\n return `http://${productName}.pco.${tld}`\n case \"test\":\n return `http://${productName}.pco.test`\n default:\n return `http://${productName}.${domain()}`\n }\n}\n\nconst domain = () => {\n const result = location.hostname.match(/planningcenter(online)?.com/)\n\n if (result === null) {\n return \"planningcenteronline.com\"\n } else {\n return result[0]\n }\n}\n"],"names":["index","env","productName","domain","tld","location","hostname","match","error","console","result"],"mappings":"AAcA,IAAAA,EAAgBC,GAAsBC,IACpC,GAAMD,GAAOC,EAEb,OAAQD,GACN,IAAK,aACH,iBAAkBC,KAAeC,MACnC,IAAK,UACH,iBAAkBD,aAAuBC,MAC3C,IAAK,cACH,IAAIC,EAAM,OAEV,IACEA,EAAMC,SAASC,SAASC,MAAM,gBAAgB,GAC9C,MAAOC,GAEmB,cAAtBH,SAASC,UACXG,QAAQD,MAAM,GAAGH,SAASC,uCAI9B,MAAiB,UAAAJ,SAAmBE,IACtC,IAAK,OACH,MAAO,UAAUF,aACnB,QACE,gBAAiBA,KAAeC,QAItC,MAAMA,EAAS,KACb,MAAMO,EAASL,SAASC,SAASC,MAAM,+BAEvC,OAAe,OAAXG,EACK,2BAEAA,EAAO"}
1
+ {"version":3,"file":"url.modern.js","sources":["../index.ts"],"sourcesContent":["export type Environment = \"production\" | \"staging\" | \"development\" | \"test\" | \"prototype\"\nexport type Product =\n | \"api\"\n | \"accounts\"\n | \"calendar\"\n | \"check-ins\"\n | \"giving\"\n | \"groups\"\n | \"login\"\n | \"people\"\n | \"publishing\"\n | \"registrations\"\n | \"services\"\n\nexport default (env: Environment) => (productName: Product) => {\n if (!(env && productName)) return\n\n switch (env) {\n case \"production\":\n return `https://${productName}.${domain()}`\n case \"staging\":\n return `https://${productName}-staging.${domain()}`\n case \"development\":\n let tld = \"test\"\n\n try {\n tld = location.hostname.match(/\\pco\\.(\\w+)$/)[1]\n } catch (error) {\n // don't show warning in Topbar's local dev env\n if (location.hostname !== \"localhost\") {\n console.error(`${location.hostname} is not a supported dev TLD`)\n }\n }\n\n return `http://${productName}.pco.${tld}`\n case \"prototype\":\n return `https://${prototypeEnv()}.${productName}.planningcenter.ninja`\n case \"test\":\n return `http://${productName}.pco.test`\n default:\n return `http://${productName}.${domain()}`\n }\n}\n\n/**\n* If the hostname is a Protonova URL, get the env from the subdomain. Defaults to main.\n* Example: my-cool-change.accounts.planningcenter.ninja -> my-cool-change\n* @returns {string}\n*/\nconst prototypeEnv = () => {\n const result = location?.hostname?.match(/(?:www\\.)?(.+)\\..+\\.planningcenter\\.ninja/)\n\n if (result && result[1] !== \"localhost\") {\n return result[1]\n }\n\n return \"main\"\n}\n\nconst domain = () => {\n const result = location.hostname.match(/planningcenter(online)?.com/)\n\n if (result === null) {\n return \"planningcenteronline.com\"\n } else {\n return result[0]\n }\n}\n"],"names":["index","env","productName","domain","tld","location","hostname","match","error","console","prototypeEnv","_location","_location$hostname","result"],"mappings":"AAcA,IAAAA,EAAgBC,GAAsBC,IACpC,GAAMD,GAAOC,EAEb,OAAQD,GACN,IAAK,aACH,iBAAkBC,KAAeC,MACnC,IAAK,UACH,iBAAkBD,aAAuBC,MAC3C,IAAK,cACH,IAAIC,EAAM,OAEV,IACEA,EAAMC,SAASC,SAASC,MAAM,gBAAgB,EAM/C,CALC,MAAOC,GAEmB,cAAtBH,SAASC,UACXG,QAAQD,MAAM,GAAGH,SAASC,sCAE7B,CAED,MAAiB,UAAAJ,SAAmBE,IACtC,IAAK,YACH,iBAAkBM,OAAkBR,yBACtC,IAAK,OACH,MAAO,UAAUA,aACnB,QACE,gBAAiBA,KAAeC,MAvBpC,EAgCF,MAAMO,EAAe,KACnB,IAAAC,EAAAC,EAAA,MAAMC,EAAS,OAAHF,EAAGN,WAAH,OAAGO,EAAAD,EAAUL,eAAV,EAAAM,EAAoBL,MAAM,6CAEzC,OAAIM,GAAwB,cAAdA,EAAO,GACZA,EAAO,GAGT,QAGHV,EAAS,KACb,MAAMU,EAASR,SAASC,SAASC,MAAM,+BAEvC,OAAe,OAAXM,EACK,2BAEAA,EAAO,EACf"}
@@ -1,2 +1,2 @@
1
- var t=function(t){return function(e){if(t&&e)switch(t){case"production":return"https://"+e+"."+n();case"staging":return"https://"+e+"-staging."+n();case"development":var o="test";try{o=location.hostname.match(/\pco\.(\w+)$/)[1]}catch(t){"localhost"!==location.hostname&&console.error(location.hostname+" is not a supported dev TLD")}return"http://"+e+".pco."+o;case"test":return"http://"+e+".pco.test";default:return"http://"+e+"."+n()}}},n=function(){var t=location.hostname.match(/planningcenter(online)?.com/);return null===t?"planningcenteronline.com":t[0]};export{t as default};
1
+ var t=function(t){return function(o){if(t&&o)switch(t){case"production":return"https://"+o+"."+e();case"staging":return"https://"+o+"-staging."+e();case"development":var a="test";try{a=location.hostname.match(/\pco\.(\w+)$/)[1]}catch(t){"localhost"!==location.hostname&&console.error(location.hostname+" is not a supported dev TLD")}return"http://"+o+".pco."+a;case"prototype":return"https://"+n()+"."+o+".planningcenter.ninja";case"test":return"http://"+o+".pco.test";default:return"http://"+o+"."+e()}}},n=function(){var t,n,e=null==(t=location)||null==(n=t.hostname)?void 0:n.match(/(?:www\.)?(.+)\..+\.planningcenter\.ninja/);return e&&"localhost"!==e[1]?e[1]:"main"},e=function(){var t=location.hostname.match(/planningcenter(online)?.com/);return null===t?"planningcenteronline.com":t[0]};export{t as default};
2
2
  //# sourceMappingURL=url.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"url.module.js","sources":["../index.ts"],"sourcesContent":["export type Environment = \"production\" | \"staging\" | \"development\" | \"test\"\nexport type Product =\n | \"api\"\n | \"accounts\"\n | \"calendar\"\n | \"check-ins\"\n | \"giving\"\n | \"groups\"\n | \"login\"\n | \"people\"\n | \"publishing\"\n | \"registrations\"\n | \"services\"\n\nexport default (env: Environment) => (productName: Product) => {\n if (!(env && productName)) return\n\n switch (env) {\n case \"production\":\n return `https://${productName}.${domain()}`\n case \"staging\":\n return `https://${productName}-staging.${domain()}`\n case \"development\":\n let tld = \"test\"\n\n try {\n tld = location.hostname.match(/\\pco\\.(\\w+)$/)[1]\n } catch (error) {\n // don't show warning in Topbar's local dev env\n if (location.hostname !== \"localhost\") {\n console.error(`${location.hostname} is not a supported dev TLD`)\n }\n }\n\n return `http://${productName}.pco.${tld}`\n case \"test\":\n return `http://${productName}.pco.test`\n default:\n return `http://${productName}.${domain()}`\n }\n}\n\nconst domain = () => {\n const result = location.hostname.match(/planningcenter(online)?.com/)\n\n if (result === null) {\n return \"planningcenteronline.com\"\n } else {\n return result[0]\n }\n}\n"],"names":["index","env","productName","domain","tld","location","hostname","match","error","console","result"],"mappings":"AAcA,IAAAA,EAAA,SAAgBC,GAAqB,OAAA,SAACC,GACpC,GAAMD,GAAOC,EAEb,OAAQD,GACN,IAAK,aACH,MAAA,WAAkBC,EAAeC,IAAAA,IACnC,IAAK,UACH,MAAkBD,WAAAA,cAAuBC,IAC3C,IAAK,cACH,IAAIC,EAAM,OAEV,IACEA,EAAMC,SAASC,SAASC,MAAM,gBAAgB,GAC9C,MAAOC,GAEmB,cAAtBH,SAASC,UACXG,QAAQD,MAASH,SAASC,SAC3B,+BAGH,MAAA,UAAiBJ,EAAjB,QAAoCE,EACtC,IAAK,OACH,MAAiBF,UAAAA,EACnB,YAAA,QACE,MAAiBA,UAAAA,MAAeC,OAIhCA,EAAS,WACb,IAAMO,EAASL,SAASC,SAASC,MAAM,+BAEvC,OAAe,OAAXG,EACK,2BAEAA,EAAO"}
1
+ {"version":3,"file":"url.module.js","sources":["../index.ts"],"sourcesContent":["export type Environment = \"production\" | \"staging\" | \"development\" | \"test\" | \"prototype\"\nexport type Product =\n | \"api\"\n | \"accounts\"\n | \"calendar\"\n | \"check-ins\"\n | \"giving\"\n | \"groups\"\n | \"login\"\n | \"people\"\n | \"publishing\"\n | \"registrations\"\n | \"services\"\n\nexport default (env: Environment) => (productName: Product) => {\n if (!(env && productName)) return\n\n switch (env) {\n case \"production\":\n return `https://${productName}.${domain()}`\n case \"staging\":\n return `https://${productName}-staging.${domain()}`\n case \"development\":\n let tld = \"test\"\n\n try {\n tld = location.hostname.match(/\\pco\\.(\\w+)$/)[1]\n } catch (error) {\n // don't show warning in Topbar's local dev env\n if (location.hostname !== \"localhost\") {\n console.error(`${location.hostname} is not a supported dev TLD`)\n }\n }\n\n return `http://${productName}.pco.${tld}`\n case \"prototype\":\n return `https://${prototypeEnv()}.${productName}.planningcenter.ninja`\n case \"test\":\n return `http://${productName}.pco.test`\n default:\n return `http://${productName}.${domain()}`\n }\n}\n\n/**\n* If the hostname is a Protonova URL, get the env from the subdomain. Defaults to main.\n* Example: my-cool-change.accounts.planningcenter.ninja -> my-cool-change\n* @returns {string}\n*/\nconst prototypeEnv = () => {\n const result = location?.hostname?.match(/(?:www\\.)?(.+)\\..+\\.planningcenter\\.ninja/)\n\n if (result && result[1] !== \"localhost\") {\n return result[1]\n }\n\n return \"main\"\n}\n\nconst domain = () => {\n const result = location.hostname.match(/planningcenter(online)?.com/)\n\n if (result === null) {\n return \"planningcenteronline.com\"\n } else {\n return result[0]\n }\n}\n"],"names":["index","env","productName","domain","tld","location","hostname","match","error","console","prototypeEnv","_location","_location$hostname","result"],"mappings":"AAcA,IAAeA,EAAA,SAACC,GAAqB,OAAA,SAACC,GACpC,GAAMD,GAAOC,EAEb,OAAQD,GACN,IAAK,aACH,MAAkBC,WAAAA,MAAeC,IACnC,IAAK,UACH,MAAkBD,WAAAA,cAAuBC,IAC3C,IAAK,cACH,IAAIC,EAAM,OAEV,IACEA,EAAMC,SAASC,SAASC,MAAM,gBAAgB,EAM/C,CALC,MAAOC,GAEmB,cAAtBH,SAASC,UACXG,QAAQD,MAASH,SAASC,uCAE7B,CAED,MAAiBJ,UAAAA,EAAmBE,QAAAA,EACtC,IAAK,YACH,MAAkBM,WAAAA,IAAkBR,IAAAA,EACtC,wBAAA,IAAK,OACH,gBAAiBA,EAAjB,YACF,QACE,MAAiBA,UAAAA,MAAeC,IAErC,CA5BD,EAmCMO,EAAe,WAAK,IAAAC,EAAAC,EAClBC,SAASR,EAAAA,oBAAAM,EAAUL,iBAAVM,EAAoBL,MAAM,6CAEzC,OAAIM,GAAwB,cAAdA,EAAO,GACZA,EAAO,GAGT,MACR,EAEKV,EAAS,WACb,IAAMU,EAASR,SAASC,SAASC,MAAM,+BAEvC,OAAe,OAAXM,EACK,2BAEAA,EAAO,EAEjB"}
package/dist/url.umd.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):((t||self).PLANNINGCENTER=t.PLANNINGCENTER||{},t.PLANNINGCENTER.url=n())}(this,function(){var t=function(){var t=location.hostname.match(/planningcenter(online)?.com/);return null===t?"planningcenteronline.com":t[0]};return function(n){return function(e){if(n&&e)switch(n){case"production":return"https://"+e+"."+t();case"staging":return"https://"+e+"-staging."+t();case"development":var o="test";try{o=location.hostname.match(/\pco\.(\w+)$/)[1]}catch(t){"localhost"!==location.hostname&&console.error(location.hostname+" is not a supported dev TLD")}return"http://"+e+".pco."+o;case"test":return"http://"+e+".pco.test";default:return"http://"+e+"."+t()}}}});
1
+ !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((n||self).PLANNINGCENTER=n.PLANNINGCENTER||{},n.PLANNINGCENTER.url=t())}(this,function(){var n=function(){var n=location.hostname.match(/planningcenter(online)?.com/);return null===n?"planningcenteronline.com":n[0]};return function(t){return function(e){if(t&&e)switch(t){case"production":return"https://"+e+"."+n();case"staging":return"https://"+e+"-staging."+n();case"development":var o="test";try{o=location.hostname.match(/\pco\.(\w+)$/)[1]}catch(n){"localhost"!==location.hostname&&console.error(location.hostname+" is not a supported dev TLD")}return"http://"+e+".pco."+o;case"prototype":return"https://"+((r=null==(a=location)||null==(c=a.hostname)?void 0:c.match(/(?:www\.)?(.+)\..+\.planningcenter\.ninja/))&&"localhost"!==r[1]?r[1]:"main")+"."+e+".planningcenter.ninja";case"test":return"http://"+e+".pco.test";default:return"http://"+e+"."+n()}var a,c,r}}});
2
2
  //# sourceMappingURL=url.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"url.umd.js","sources":["../index.ts"],"sourcesContent":["export type Environment = \"production\" | \"staging\" | \"development\" | \"test\"\nexport type Product =\n | \"api\"\n | \"accounts\"\n | \"calendar\"\n | \"check-ins\"\n | \"giving\"\n | \"groups\"\n | \"login\"\n | \"people\"\n | \"publishing\"\n | \"registrations\"\n | \"services\"\n\nexport default (env: Environment) => (productName: Product) => {\n if (!(env && productName)) return\n\n switch (env) {\n case \"production\":\n return `https://${productName}.${domain()}`\n case \"staging\":\n return `https://${productName}-staging.${domain()}`\n case \"development\":\n let tld = \"test\"\n\n try {\n tld = location.hostname.match(/\\pco\\.(\\w+)$/)[1]\n } catch (error) {\n // don't show warning in Topbar's local dev env\n if (location.hostname !== \"localhost\") {\n console.error(`${location.hostname} is not a supported dev TLD`)\n }\n }\n\n return `http://${productName}.pco.${tld}`\n case \"test\":\n return `http://${productName}.pco.test`\n default:\n return `http://${productName}.${domain()}`\n }\n}\n\nconst domain = () => {\n const result = location.hostname.match(/planningcenter(online)?.com/)\n\n if (result === null) {\n return \"planningcenteronline.com\"\n } else {\n return result[0]\n }\n}\n"],"names":["domain","result","location","hostname","match","env","productName","tld","error","console"],"mappings":"6QAcA,IA4BMA,EAAS,WACb,IAAMC,EAASC,SAASC,SAASC,MAAM,+BAEvC,OAAe,OAAXH,EACK,2BAEAA,EAAO,WAlClB,SAAgBI,GAAqB,OAAA,SAACC,GACpC,GAAMD,GAAOC,EAEb,OAAQD,GACN,IAAK,aACH,MAAA,WAAkBC,EAAeN,IAAAA,IACnC,IAAK,UACH,MAAkBM,WAAAA,cAAuBN,IAC3C,IAAK,cACH,IAAIO,EAAM,OAEV,IACEA,EAAML,SAASC,SAASC,MAAM,gBAAgB,GAC9C,MAAOI,GAEmB,cAAtBN,SAASC,UACXM,QAAQD,MAASN,SAASC,SAC3B,+BAGH,MAAA,UAAiBG,EAAjB,QAAoCC,EACtC,IAAK,OACH,MAAiBD,UAAAA,EACnB,YAAA,QACE,MAAiBA,UAAAA,MAAeN"}
1
+ {"version":3,"file":"url.umd.js","sources":["../index.ts"],"sourcesContent":["export type Environment = \"production\" | \"staging\" | \"development\" | \"test\" | \"prototype\"\nexport type Product =\n | \"api\"\n | \"accounts\"\n | \"calendar\"\n | \"check-ins\"\n | \"giving\"\n | \"groups\"\n | \"login\"\n | \"people\"\n | \"publishing\"\n | \"registrations\"\n | \"services\"\n\nexport default (env: Environment) => (productName: Product) => {\n if (!(env && productName)) return\n\n switch (env) {\n case \"production\":\n return `https://${productName}.${domain()}`\n case \"staging\":\n return `https://${productName}-staging.${domain()}`\n case \"development\":\n let tld = \"test\"\n\n try {\n tld = location.hostname.match(/\\pco\\.(\\w+)$/)[1]\n } catch (error) {\n // don't show warning in Topbar's local dev env\n if (location.hostname !== \"localhost\") {\n console.error(`${location.hostname} is not a supported dev TLD`)\n }\n }\n\n return `http://${productName}.pco.${tld}`\n case \"prototype\":\n return `https://${prototypeEnv()}.${productName}.planningcenter.ninja`\n case \"test\":\n return `http://${productName}.pco.test`\n default:\n return `http://${productName}.${domain()}`\n }\n}\n\n/**\n* If the hostname is a Protonova URL, get the env from the subdomain. Defaults to main.\n* Example: my-cool-change.accounts.planningcenter.ninja -> my-cool-change\n* @returns {string}\n*/\nconst prototypeEnv = () => {\n const result = location?.hostname?.match(/(?:www\\.)?(.+)\\..+\\.planningcenter\\.ninja/)\n\n if (result && result[1] !== \"localhost\") {\n return result[1]\n }\n\n return \"main\"\n}\n\nconst domain = () => {\n const result = location.hostname.match(/planningcenter(online)?.com/)\n\n if (result === null) {\n return \"planningcenteronline.com\"\n } else {\n return result[0]\n }\n}\n"],"names":["domain","result","location","hostname","match","env","productName","tld","error","console","prototypeEnv","_location","_location$hostname"],"mappings":"6QAce,IA6CTA,EAAS,WACb,IAAMC,EAASC,SAASC,SAASC,MAAM,+BAEvC,OAAe,OAAXH,EACK,2BAEAA,EAAO,EAEjB,SArDc,SAACI,GAAqB,OAAA,SAACC,GACpC,GAAMD,GAAOC,EAEb,OAAQD,GACN,IAAK,aACH,MAAkBC,WAAAA,MAAeN,IACnC,IAAK,UACH,MAAkBM,WAAAA,cAAuBN,IAC3C,IAAK,cACH,IAAIO,EAAM,OAEV,IACEA,EAAML,SAASC,SAASC,MAAM,gBAAgB,EAM/C,CALC,MAAOI,GAEmB,cAAtBN,SAASC,UACXM,QAAQD,MAASN,SAASC,uCAE7B,CAED,MAAiBG,UAAAA,EAAmBC,QAAAA,EACtC,IAAK,YACH,MAAkBG,aAchBT,SAASC,EAAAA,oBAAAS,EAAUR,iBAAVS,EAAoBR,MAAM,+CAEb,cAAdH,EAAO,GACZA,EAAO,GAGT,QApBiCK,IAAAA,EACtC,wBAAA,IAAK,OACH,gBAAiBA,EAAjB,YACF,QACE,MAAiBA,UAAAA,MAAeN,IASjB,IAAKW,EAAAC,EAClBX,CARP,CA5BD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/url",
3
- "version": "2.6.5",
3
+ "version": "2.7.2",
4
4
  "description": "url utilities for planning center apps",
5
5
  "source": "index.ts",
6
6
  "main": "./dist/url.js",