@pexip-engage-public/plugin-configuration-parser
Advanced tools
Comparing version
# @pexip-engage-public/plugin-configuration-parser | ||
## 1.0.8 | ||
### Patch Changes | ||
- 03e95fd46: bug: fix incorrect dom param migrations | ||
## 1.0.7 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@pexip-engage-public/plugin-configuration-parser", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"homepage": "https://github.com/skedify/frontend-mono/tree/develop/apps/plugin-remix/packages/configuration-parser#readme", | ||
@@ -5,0 +5,0 @@ "bugs": { |
@@ -118,15 +118,10 @@ import type { PluginConfiguration } from "@pexip-engage-public/plugin-configuration"; | ||
function createDOMParamWarnings(config: LegacyPluginHashConfiguration) { | ||
const unsupported = getUnsupportedKeys(config, "html"); | ||
function createDOMParamWarnings(hashConfig: LegacyPluginHashConfiguration) { | ||
if (Object.keys(hashConfig).length === 0) return null; | ||
const unsupported = getUnsupportedKeys(hashConfig, "html"); | ||
const config = legacyHashToPluginInputConfiguration(hashConfig); | ||
const migrations = Object.entries(config) | ||
.map(([key, value]) => { | ||
const newKey = DOM_ATTR_MAPPING[key as keyof LegacyPluginHashConfiguration]; | ||
if (!newKey) { | ||
return ""; | ||
} | ||
return `${newKey}="${value}"`; | ||
}) | ||
.map(([key, value]) => value && `${ATTR_PREFIX}${key}="${value}"`) | ||
.filter(Boolean); | ||
@@ -140,9 +135,10 @@ | ||
function createHashParamWarnings(config: LegacyPluginHashConfiguration) { | ||
if (Object.keys(config).length === 0) return null; | ||
function createHashParamWarnings(hashConfig: LegacyPluginHashConfiguration) { | ||
if (Object.keys(hashConfig).length === 0) return null; | ||
const unsupported = getUnsupportedKeys(config, "hash"); | ||
const modernConfig = legacyHashToPluginInputConfiguration(config); | ||
const modernHash = encodeConfigAsHash(modernConfig); | ||
const unsupported = getUnsupportedKeys(hashConfig, "hash"); | ||
const config = legacyHashToPluginInputConfiguration(hashConfig); | ||
const modernHash = encodeConfigAsHash(config); | ||
return { migration: modernHash, unsupported }; | ||
@@ -235,66 +231,2 @@ } | ||
const DOM_ATTR_MAPPING: Record< | ||
keyof LegacyPluginHashConfiguration, | ||
`${typeof ATTR_PREFIX}${keyof PluginConfiguration}` | null | ||
> = { | ||
/** OAUTH */ | ||
rco: "data-pexip-oauth-resource_code", | ||
// token: getAttribute("oauth.token"), | ||
/** SESSION */ | ||
cas: `data-pexip-session-status`, | ||
sid: `data-pexip-session-id`, | ||
sst: `data-pexip-session-source_tags`, | ||
/** CUSTOMER */ | ||
ctz: `data-pexip-customer-timezone`, | ||
cfn: `data-pexip-customer-first_name`, | ||
cln: `data-pexip-customer-last_name`, | ||
cem: `data-pexip-customer-email`, | ||
cpn: `data-pexip-customer-phone_number`, | ||
ccn: `data-pexip-customer-customer_number`, | ||
cgl: `data-pexip-customer-location-geolocation`, | ||
cci: `data-pexip-customer-location-city`, | ||
cco: `data-pexip-customer-location-country`, | ||
cpc: `data-pexip-customer-location-postal_code`, | ||
csa: `data-pexip-customer-location-state`, | ||
cst: `data-pexip-customer-location-street_1`, | ||
ccom: "data-pexip-customer-customer_number", | ||
cdob: "data-pexip-customer-date_of_birth", | ||
ceid: "data-pexip-customer-external_id", | ||
cgr: "data-pexip-customer-gender", | ||
cid: "data-pexip-customer-id", | ||
cie: "data-pexip-customer-is_existing", | ||
clng: "data-pexip-customer-language", | ||
cpci: "data-pexip-customer-preferred_contact_id", | ||
cpoi: "data-pexip-customer-preferred_office_id", | ||
/** APPOINTMENT */ | ||
off: `data-pexip-office-ids`, | ||
sub: `data-pexip-subject-ids`, | ||
lis: `data-pexip-listing-id`, | ||
/** EXTERNAL */ | ||
esb: `data-pexip-subject-type="externalId" data-pexip-subject-ids` as any, | ||
eof: `data-pexip-office-type="externalId" data-pexip-office-ids` as any, | ||
eli: `data-pexip-listing-type="externalId" data-pexip-listing-id` as any, | ||
lsc: `data-pexip-lead_segment-id`, | ||
/** HINTS */ | ||
con: `data-pexip-employee-ids`, | ||
eco: `data-pexip-employee-type="externalId" data-pexip-employee-ids` as any, | ||
act: `data-pexip-intent`, | ||
lng: `data-pexip-language`, | ||
mty: `data-pexip-meeting_types`, | ||
/** APPLICATION */ | ||
ets: `data-pexip-application-timezone_selection`, | ||
/** LOCATION */ | ||
lfa: `data-pexip-location-initial_search`, | ||
sco: `data-pexip-search_countries`, | ||
flo: `data-pexip-flow`, | ||
/** DEPRECATED */ | ||
scr: null, | ||
lgl: null, | ||
lci: null, | ||
lco: null, | ||
lpc: null, | ||
lsa: null, | ||
lst: null, | ||
}; | ||
const UNSUPPORTED_HASH_KEY_TO_JS = { | ||
@@ -301,0 +233,0 @@ scr: "application.scroll", |
@@ -50,7 +50,7 @@ import type { PluginConfiguration } from "@pexip-engage-public/plugin-configuration"; | ||
if (!element) return {}; | ||
const attributes = element.getAttributeNames().filter((name) => name.startsWith("data-pexip-")); | ||
const attributes = element.getAttributeNames().filter((name) => name.startsWith(ATTR_PREFIX)); | ||
const object: Record<string, string | undefined> = {}; | ||
for (const attribute of attributes) { | ||
const key = attribute.replace("data-pexip-", ""); | ||
const key = attribute.replace(ATTR_PREFIX, ""); | ||
@@ -57,0 +57,0 @@ object[key] = element.getAttribute(attribute)?.trim() || undefined; |
@@ -14,3 +14,3 @@ import type { PluginConfiguration } from "@pexip-engage-public/plugin-configuration"; | ||
unsupported: ("scr" | "lgl" | "lci" | "lco" | "lpc" | "lsa" | "lst")[] | ("application.scroll" | "location.geolocation" | "location.city" | "location.country" | "location.postal_code" | "location.state" | "location.street_1")[] | ("skedify:application.scroll" | "skedify:location.geolocation" | "skedify:location.city" | "skedify:location.country" | "skedify:location.postal_code" | "skedify:location.state" | "skedify:location.street_1")[] | null; | ||
migration: string[] | null; | ||
migration: any[] | null; | ||
} | null; | ||
@@ -17,0 +17,0 @@ hash: { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
135759
-2.86%2234
-5.1%