@planningcenter/url 2.7.0 → 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/url.js.map CHANGED
@@ -1 +1 @@
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,mBAnDH,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,GAC9C,MAAOI,GAEmB,cAAtBN,SAASC,UACXM,QAAQD,MAASN,SAASC,wCAI9B,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"}
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 +1 @@
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,GAC9C,MAAOC,GAEmB,cAAtBH,SAASC,UACXG,QAAQD,MAAM,GAAGH,SAASC,uCAI9B,MAAiB,UAAAJ,SAAmBE,IACtC,IAAK,YACH,iBAAkBM,OAAkBR,yBACtC,IAAK,OACH,MAAO,UAAUA,aACnB,QACE,gBAAiBA,KAAeC,QAStC,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"}
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 +1 @@
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,GAC9C,MAAOC,GAEmB,cAAtBH,SAASC,UACXG,QAAQD,MAASH,SAASC,wCAI9B,MAAiBJ,UAAAA,EAAmBE,QAAAA,EACtC,IAAK,YACH,MAAkBM,WAAAA,IAAkBR,IAAAA,EACtC,wBAAA,IAAK,OACH,gBAAiBA,EAAjB,YACF,QACE,MAAiBA,UAAAA,MAAeC,OAShCO,EAAe,WAAK,IAAAC,EAAAC,EAClBC,SAASR,EAAAA,oBAAAM,EAAUL,iBAAVM,EAAoBL,MAAM,6CAEzC,OAAIM,GAAwB,cAAdA,EAAO,GACZA,EAAO,GAGT,QAGHV,EAAS,WACb,IAAMU,EAASR,SAASC,SAASC,MAAM,+BAEvC,OAAe,OAAXM,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"}
@@ -1 +1 @@
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,WAnDH,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,GAC9C,MAAOI,GAEmB,cAAtBN,SAASC,UACXM,QAAQD,MAASN,SAASC,wCAI9B,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"}
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.7.0",
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",