@salesforce/vite-plugin-lwc-ui-bundle 11.13.2 → 11.14.0

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.
Files changed (35) hide show
  1. package/dist/index.d.ts +32 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +30 -5
  4. package/dist/index.js.map +1 -1
  5. package/dist/providers/access-check.d.ts.map +1 -1
  6. package/dist/providers/gate.d.ts.map +1 -1
  7. package/dist/providers/i18n.d.ts +16 -0
  8. package/dist/providers/i18n.d.ts.map +1 -1
  9. package/dist/providers/index.d.ts +2 -0
  10. package/dist/providers/index.d.ts.map +1 -1
  11. package/dist/providers/index.js +3 -178
  12. package/dist/providers/index.js.map +1 -1
  13. package/dist/providers/labels-graphql/index.d.ts.map +1 -1
  14. package/dist/providers/labels-graphql/index.js +12 -3
  15. package/dist/providers/labels-graphql/index.js.map +1 -1
  16. package/dist/providers/labels-graphql/runtime.d.ts +21 -14
  17. package/dist/providers/labels-graphql/runtime.d.ts.map +1 -1
  18. package/dist/providers/labels-graphql/runtime.js +39 -26
  19. package/dist/providers/labels-graphql/runtime.js.map +1 -1
  20. package/dist/providers/platform-graphql/constants.d.ts +15 -0
  21. package/dist/providers/platform-graphql/constants.d.ts.map +1 -0
  22. package/dist/providers/platform-graphql/i18n-static.d.ts +19 -0
  23. package/dist/providers/platform-graphql/i18n-static.d.ts.map +1 -0
  24. package/dist/providers/platform-graphql/index.d.ts +58 -0
  25. package/dist/providers/platform-graphql/index.d.ts.map +1 -0
  26. package/dist/providers/platform-graphql/index.js +312 -0
  27. package/dist/providers/platform-graphql/index.js.map +1 -0
  28. package/dist/providers/platform-graphql/runtime.d.ts +30 -0
  29. package/dist/providers/platform-graphql/runtime.d.ts.map +1 -0
  30. package/dist/providers/platform-graphql/runtime.js +189 -0
  31. package/dist/providers/platform-graphql/runtime.js.map +1 -0
  32. package/docs/consumer-guide.md +120 -4
  33. package/package.json +5 -5
  34. package/skills/setup-lwc-vite-plugin/SKILL.md +44 -1
  35. package/skills/setup-lwc-vite-plugin/references/known-pitfalls.md +57 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/providers/label.ts","../../src/providers/i18n.ts","../../src/providers/gate.ts","../../src/providers/access-check.ts","../../src/providers/apex.ts","../../src/providers/client.ts","../../src/providers/message-channel.ts","../../src/providers/message-service.ts","../../src/providers/navigation.ts","../../src/providers/primitive-utils.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst LABEL_DEFAULTS: Record<string, string> = {\n\t\"LightningForm.edit\": \"Edit\",\n\t\"LightningForm.save\": \"Save\",\n\t\"LightningForm.cancel\": \"Cancel\",\n\t\"LightningForm.error\": \"Error\",\n\t\"RecordDetailUC.Expand\": \"Expand\",\n\t\"RecordDetailUC.Collapse\": \"Collapse\",\n\t\"Global_Entity.created_by\": \"Created By\",\n\t\"Global_Entity.last_modified_by\": \"Last Modified By\",\n\t\"DetailError.GenericSaveError\": \"An error occurred while saving.\",\n\t\"MobileWebError.NoPreEditAccess\": \"You don't have access to edit this record.\",\n\t\"DuplicateList.ToastMessageBlock\": \"Duplicate records were found.\",\n\t\"DuplicateList.NonBlockingHeaderText\": \"Duplicate records found\",\n\t\"DuplicateList.ToastMessageAlertEdit\": \"Duplicate records were found. You can continue editing.\",\n\t\"Errors.ErrorPopoverHeading\": \"Error\",\n};\n\nexport function label(overrides: Record<string, string> = {}): Provider {\n\tconst defaults = { ...LABEL_DEFAULTS, ...overrides };\n\treturn {\n\t\tprefix: \"@salesforce/label/\",\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(\"@salesforce/label/\")) return null;\n\n\t\t\tconst key = specifier.slice(\"@salesforce/label/\".length);\n\t\t\tconst fallbackLabel = key\n\t\t\t\t.split(\".\")\n\t\t\t\t.at(-1)!\n\t\t\t\t.replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n\t\t\t\t.replace(/_/g, \" \")\n\t\t\t\t.trim();\n\t\t\tconst value = defaults[key] ?? fallbackLabel;\n\t\t\treturn `export default ${JSON.stringify(value)};`;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst BROWSER_DERIVED = new Set([\n\t\"lang\",\n\t\"dir\",\n\t\"locale\",\n\t\"currency\",\n\t\"timeZone\",\n\t\"firstDayOfWeek\",\n]);\n\nconst STATIC_DEFAULTS: Record<string, string> = {\n\t\"dateTime.shortDateFormat\": \"M/d/yyyy\",\n\t\"dateTime.mediumDateFormat\": \"MMM d, yyyy\",\n\t\"dateTime.longDateFormat\": \"MMMM d, yyyy\",\n\t\"dateTime.shortTimeFormat\": \"h:mm a\",\n\t\"dateTime.mediumTimeFormat\": \"h:mm:ss a\",\n\t\"dateTime.longTimeFormat\": \"h:mm:ss a z\",\n\t\"dateTime.shortDateTimeFormat\": \"M/d/yyyy, h:mm a\",\n\t\"number.numberFormat\": \"#,##0.##\",\n\t\"number.currencyFormat\": \"¤#,##0.00\",\n\t\"number.decimalSeparator\": \".\",\n\t\"number.groupingSeparator\": \",\",\n\t\"number.percentFormat\": \"#,##0%\",\n\t\"number.percentSign\": \"%\",\n\t\"number.plusSign\": \"+\",\n\t\"number.minusSign\": \"-\",\n\t\"number.exponentialSign\": \"E\",\n\t\"number.superscriptingExponentSign\": \"×\",\n\t\"number.perMilleSign\": \"‰\",\n\t\"number.infinity\": \"∞\",\n\t\"number.nan\": \"NaN\",\n\t\"number.currencySymbol\": \"$\",\n\tdefaultCalendar: \"gregory\",\n\tdefaultNumberingSystem: \"latn\",\n};\n\nconst MONTHS_WIDE = [\n\t\"January\",\n\t\"February\",\n\t\"March\",\n\t\"April\",\n\t\"May\",\n\t\"June\",\n\t\"July\",\n\t\"August\",\n\t\"September\",\n\t\"October\",\n\t\"November\",\n\t\"December\",\n];\nconst MONTHS_ABBR = [\n\t\"Jan\",\n\t\"Feb\",\n\t\"Mar\",\n\t\"Apr\",\n\t\"May\",\n\t\"Jun\",\n\t\"Jul\",\n\t\"Aug\",\n\t\"Sep\",\n\t\"Oct\",\n\t\"Nov\",\n\t\"Dec\",\n];\nconst DAYS_WIDE = [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"];\nconst DAYS_ABBR = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n\nconst OBJECT_DEFAULTS: Record<string, unknown> = {\n\t\"common.digits\": { latn: \"0123456789\" },\n\t\"common.calendarData\": {\n\t\tgregory: { calendarSystem: \"solar\", eras: {} },\n\t},\n\tcalendarData: {\n\t\tgregory: {\n\t\t\tmonths: {\n\t\t\t\tformat: {\n\t\t\t\t\twide: MONTHS_WIDE,\n\t\t\t\t\tabbreviated: MONTHS_ABBR,\n\t\t\t\t\tnarrow: MONTHS_ABBR,\n\t\t\t\t},\n\t\t\t},\n\t\t\tdays: {\n\t\t\t\tformat: {\n\t\t\t\t\twide: DAYS_WIDE,\n\t\t\t\t\tabbreviated: DAYS_ABBR,\n\t\t\t\t\tnarrow: DAYS_ABBR,\n\t\t\t\t},\n\t\t\t},\n\t\t\tdayPeriods: {\n\t\t\t\tformat: {\n\t\t\t\t\twide: [\"AM\", \"PM\"],\n\t\t\t\t\tabbreviated: [\"am\", \"pm\"],\n\t\t\t\t\tnarrow: [\"a\", \"p\"],\n\t\t\t\t},\n\t\t\t},\n\t\t\teras: {\n\t\t\t\teraAbbr: [\"AD\"],\n\t\t\t\teraNames: [\"Anno Domini\"],\n\t\t\t\teraNarrow: [\"A\"],\n\t\t\t},\n\t\t},\n\t},\n};\n\nconst RUNTIME_SOURCE = `\nconst RTL_LANGS = new Set([\n 'ar', 'arc', 'dv', 'fa', 'ha', 'he', 'khw', 'ks', 'ku', 'ps', 'ur', 'yi',\n]);\n\nfunction getLocale() {\n if (typeof navigator === 'undefined') return 'en-US';\n return navigator.language || 'en-US';\n}\n\nfunction getLang() {\n return getLocale().split('-')[0];\n}\n\nfunction getDir() {\n return RTL_LANGS.has(getLang()) ? 'rtl' : 'ltr';\n}\n\nfunction getCurrency() {\n try {\n const parts = new Intl.NumberFormat(getLocale(), {\n style: 'currency',\n currency: 'USD',\n currencyDisplay: 'code',\n }).resolvedOptions();\n return parts.currency || 'USD';\n } catch {\n return 'USD';\n }\n}\n\nfunction getTimeZone() {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC';\n } catch {\n return 'UTC';\n }\n}\n\nfunction getFirstDayOfWeek() {\n try {\n const loc = new Intl.Locale(getLocale());\n if (loc.weekInfo) return String(loc.weekInfo.firstDay);\n if (typeof loc.getWeekInfo === 'function') return String(loc.getWeekInfo().firstDay);\n } catch { /* unsupported in this browser */ }\n return '7';\n}\n\nconst values = {\n lang: getLang(),\n dir: getDir(),\n locale: getLocale(),\n currency: getCurrency(),\n timeZone: getTimeZone(),\n firstDayOfWeek: getFirstDayOfWeek(),\n};\n\nexport default values['__KEY__'];\n`;\n\nexport interface I18nOptions {\n\tstaticOverrides?: Record<string, string>;\n\tobjectOverrides?: Record<string, unknown>;\n}\n\nexport function i18n(options: I18nOptions = {}): Provider {\n\tconst { staticOverrides = {}, objectOverrides = {} } = options;\n\tconst statics = { ...STATIC_DEFAULTS, ...staticOverrides };\n\tconst objects = { ...OBJECT_DEFAULTS, ...objectOverrides };\n\n\treturn {\n\t\tprefix: \"@salesforce/i18n/\",\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(\"@salesforce/i18n/\")) return null;\n\n\t\t\tconst key = specifier.slice(\"@salesforce/i18n/\".length);\n\n\t\t\tif (BROWSER_DERIVED.has(key)) {\n\t\t\t\treturn RUNTIME_SOURCE.replace(\"__KEY__\", key);\n\t\t\t}\n\n\t\t\tif (key in objects) {\n\t\t\t\treturn `export default ${JSON.stringify(objects[key])};`;\n\t\t\t}\n\n\t\t\tconst value = statics[key] ?? key;\n\t\t\treturn `export default ${JSON.stringify(value)};`;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nexport function gate(overrides: Record<string, boolean> = {}): Provider {\n\treturn {\n\t\tprefix: \"@salesforce/gate/\",\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(\"@salesforce/gate/\")) return null;\n\t\t\tconst name = specifier.slice(\"@salesforce/gate/\".length);\n\t\t\tconst isOpen = overrides[name] ?? true;\n\t\t\treturn `export default { isOpen: () => ${isOpen} };`;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nexport function accessCheck(overrides: Record<string, boolean> = {}): Provider {\n\treturn {\n\t\tprefix: \"@salesforce/accessCheck/\",\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(\"@salesforce/accessCheck/\")) return null;\n\t\t\tconst name = specifier.slice(\"@salesforce/accessCheck/\".length);\n\t\t\tconst value = overrides[name] ?? false;\n\t\t\treturn `export default ${value};`;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst PREFIX = \"@salesforce/apex/\";\n\nconst STUB_SOURCE = `\nconst UNSUPPORTED_MSG = '[LWC UI Bundle] Imperative Apex (@salesforce/apex) is not supported in static bundles. Use the Platform Data SDK instead.';\n\nexport default async function apexStub() {\n console.warn(UNSUPPORTED_MSG);\n throw new Error(UNSUPPORTED_MSG);\n}\n`;\n\nexport function apex(): Provider {\n\treturn {\n\t\tprefix: PREFIX,\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(PREFIX)) return null;\n\t\t\treturn STUB_SOURCE;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst FORM_FACTOR_SOURCE = `\nfunction getFormFactor() {\n if (typeof window === 'undefined') return 'Large';\n if (window.matchMedia('(max-width: 767px)').matches) return 'Small';\n if (window.matchMedia('(max-width: 1023px)').matches) return 'Medium';\n return 'Large';\n}\n\nexport default getFormFactor();\n`;\n\nexport function client(): Provider {\n\treturn {\n\t\tprefix: \"@salesforce/client/\",\n\t\tresolve(specifier) {\n\t\t\tif (specifier === \"@salesforce/client/formFactor\") {\n\t\t\t\treturn FORM_FACTOR_SOURCE;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst PREFIX = \"@salesforce/messageChannel/\";\n\nexport function messageChannel(): Provider {\n\treturn {\n\t\tprefix: PREFIX,\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(PREFIX)) return null;\n\t\t\treturn `export default Symbol('${specifier}:stub');`;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst SPECIFIER = \"lightning/messageService\";\n\nconst STUB_SOURCE = `\nconst WARN_MSG = '[LWC UI Bundle] lightning/messageService is not supported in static bundles.';\n\nexport function createMessageContext() { return {}; }\nexport function releaseMessageContext() {}\nexport function publish(_ctx, _channel, _message) {\n console.warn(WARN_MSG);\n}\nexport function subscribe(_ctx, _channel, _handler, _options) {\n console.warn(WARN_MSG);\n return {};\n}\nexport function unsubscribe(_subscription) {}\nexport const APPLICATION_SCOPE = Symbol('APPLICATION_SCOPE');\nexport const MessageContext = {};\nexport default {\n createMessageContext,\n releaseMessageContext,\n publish,\n subscribe,\n unsubscribe,\n APPLICATION_SCOPE,\n MessageContext,\n};\n`;\n\nexport function messageService(): Provider {\n\treturn {\n\t\tmatch(id) {\n\t\t\treturn id === SPECIFIER;\n\t\t},\n\t\tresolve(specifier) {\n\t\t\tif (specifier !== SPECIFIER) return null;\n\t\t\treturn STUB_SOURCE;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst SPECIFIER = \"lightning/navigation\";\n\nconst STUB_SOURCE = `\nconst WARN_MSG = '[LWC UI Bundle] lightning/navigation is not supported in static bundles.';\n\nexport const NavigationMixin = (Base) => {\n return class extends Base {\n [Symbol.for('NavigationMixin.Navigate')](pageRef, replace) {\n console.warn(WARN_MSG, { pageRef, replace });\n }\n [Symbol.for('NavigationMixin.GenerateUrl')](pageRef) {\n console.warn(WARN_MSG, { pageRef });\n return Promise.resolve('#');\n }\n };\n};\n\nNavigationMixin.Navigate = Symbol.for('NavigationMixin.Navigate');\nNavigationMixin.GenerateUrl = Symbol.for('NavigationMixin.GenerateUrl');\n\nexport default NavigationMixin;\n`;\n\nexport function navigation(): Provider {\n\treturn {\n\t\tmatch(id) {\n\t\t\treturn id === SPECIFIER;\n\t\t},\n\t\tresolve(specifier) {\n\t\t\tif (specifier !== SPECIFIER) return null;\n\t\t\treturn STUB_SOURCE;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nexport function primitiveUtils(): Provider {\n\treturn {\n\t\tprefix: \"lightning/primitiveUtils\",\n\t\tmatch(id) {\n\t\t\treturn id === \"lightning/primitiveUtils\";\n\t\t},\n\t\tresolve(specifier) {\n\t\t\tif (specifier !== \"lightning/primitiveUtils\") return null;\n\n\t\t\treturn `export function normalizeBoolean(value) {\n return typeof value === 'string' || !!value;\n}\n\nexport function reflectAttribute(element, attrName, value) {\n if (!element) return;\n if (typeof value === 'string') {\n element.setAttribute(attrName, value);\n } else if (value === true) {\n element.setAttribute(attrName, '');\n } else if (!value) {\n element.removeAttribute(attrName);\n } else {\n console.warn(\\`Invalid attribute value for \"\\${attrName}\": \\${value}\\`);\n }\n}\n`;\n\t\t},\n\t};\n}\n"],"names":["PREFIX","STUB_SOURCE","SPECIFIER"],"mappings":";;AAOA,MAAM,iBAAyC;AAAA,EAC9C,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,yBAAyB;AAAA,EACzB,2BAA2B;AAAA,EAC3B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,gCAAgC;AAAA,EAChC,kCAAkC;AAAA,EAClC,mCAAmC;AAAA,EACnC,uCAAuC;AAAA,EACvC,uCAAuC;AAAA,EACvC,8BAA8B;AAC/B;AAEO,SAAS,MAAM,YAAoC,IAAc;AACvE,QAAM,WAAW,EAAE,GAAG,gBAAgB,GAAG,UAAA;AACzC,SAAO;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ,WAAW;AAClB,UAAI,CAAC,UAAU,WAAW,oBAAoB,EAAG,QAAO;AAExD,YAAM,MAAM,UAAU,MAAM,qBAAqB,MAAM;AACvD,YAAM,gBAAgB,IACpB,MAAM,GAAG,EACT,GAAG,EAAE,EACL,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,MAAM,GAAG,EACjB,KAAA;AACF,YAAM,QAAQ,SAAS,GAAG,KAAK;AAC/B,aAAO,kBAAkB,KAAK,UAAU,KAAK,CAAC;AAAA,IAC/C;AAAA,EAAA;AAEF;ACnCA,MAAM,sCAAsB,IAAI;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAED,MAAM,kBAA0C;AAAA,EAC/C,4BAA4B;AAAA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providers/label.ts","../../src/providers/gate.ts","../../src/providers/access-check.ts","../../src/providers/apex.ts","../../src/providers/client.ts","../../src/providers/message-channel.ts","../../src/providers/message-service.ts","../../src/providers/navigation.ts","../../src/providers/primitive-utils.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst LABEL_DEFAULTS: Record<string, string> = {\n\t\"LightningForm.edit\": \"Edit\",\n\t\"LightningForm.save\": \"Save\",\n\t\"LightningForm.cancel\": \"Cancel\",\n\t\"LightningForm.error\": \"Error\",\n\t\"RecordDetailUC.Expand\": \"Expand\",\n\t\"RecordDetailUC.Collapse\": \"Collapse\",\n\t\"Global_Entity.created_by\": \"Created By\",\n\t\"Global_Entity.last_modified_by\": \"Last Modified By\",\n\t\"DetailError.GenericSaveError\": \"An error occurred while saving.\",\n\t\"MobileWebError.NoPreEditAccess\": \"You don't have access to edit this record.\",\n\t\"DuplicateList.ToastMessageBlock\": \"Duplicate records were found.\",\n\t\"DuplicateList.NonBlockingHeaderText\": \"Duplicate records found\",\n\t\"DuplicateList.ToastMessageAlertEdit\": \"Duplicate records were found. You can continue editing.\",\n\t\"Errors.ErrorPopoverHeading\": \"Error\",\n};\n\nexport function label(overrides: Record<string, string> = {}): Provider {\n\tconst defaults = { ...LABEL_DEFAULTS, ...overrides };\n\treturn {\n\t\tprefix: \"@salesforce/label/\",\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(\"@salesforce/label/\")) return null;\n\n\t\t\tconst key = specifier.slice(\"@salesforce/label/\".length);\n\t\t\tconst fallbackLabel = key\n\t\t\t\t.split(\".\")\n\t\t\t\t.at(-1)!\n\t\t\t\t.replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n\t\t\t\t.replace(/_/g, \" \")\n\t\t\t\t.trim();\n\t\t\tconst value = defaults[key] ?? fallbackLabel;\n\t\t\treturn `export default ${JSON.stringify(value)};`;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\n// Static resolution by design — and it must stay static. A GraphQL field for\n// gate state exists (uiapi.platform.gates) but is restricted to a UiTier context\n// and is NOT reachable off-core: verified against the org it returns either\n// \"Field 'gates' is undefined\" or \"'platform.gates' can only be executed in a\n// UiTier context.\" So unlike i18n / userPermission / customPermission / label\n// (which DO resolve off-core via platform-graphql / labels-graphql), gates have\n// no off-core GraphQL path; they resolve from build-time overrides (W-22167030).\nexport function gate(overrides: Record<string, boolean> = {}): Provider {\n\treturn {\n\t\tprefix: \"@salesforce/gate/\",\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(\"@salesforce/gate/\")) return null;\n\t\t\tconst name = specifier.slice(\"@salesforce/gate/\".length);\n\t\t\tconst isOpen = overrides[name] ?? true;\n\t\t\treturn `export default { isOpen: () => ${isOpen} };`;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\n// Static build-time resolution — now an OPT-OUT. By default,\n// @salesforce/accessCheck/* resolves at runtime via GraphQL\n// (uiapi.platform.userPermissions) through builtins.platformGraphql(); see\n// providers/platform-graphql. Use this static provider explicitly when you want\n// build-time-only access-check values with no runtime fetch (W-22167030).\nexport function accessCheck(overrides: Record<string, boolean> = {}): Provider {\n\treturn {\n\t\tprefix: \"@salesforce/accessCheck/\",\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(\"@salesforce/accessCheck/\")) return null;\n\t\t\tconst name = specifier.slice(\"@salesforce/accessCheck/\".length);\n\t\t\tconst value = overrides[name] ?? false;\n\t\t\treturn `export default ${value};`;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst PREFIX = \"@salesforce/apex/\";\n\nconst STUB_SOURCE = `\nconst UNSUPPORTED_MSG = '[LWC UI Bundle] Imperative Apex (@salesforce/apex) is not supported in static bundles. Use the Platform Data SDK instead.';\n\nexport default async function apexStub() {\n console.warn(UNSUPPORTED_MSG);\n throw new Error(UNSUPPORTED_MSG);\n}\n`;\n\nexport function apex(): Provider {\n\treturn {\n\t\tprefix: PREFIX,\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(PREFIX)) return null;\n\t\t\treturn STUB_SOURCE;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst FORM_FACTOR_SOURCE = `\nfunction getFormFactor() {\n if (typeof window === 'undefined') return 'Large';\n if (window.matchMedia('(max-width: 767px)').matches) return 'Small';\n if (window.matchMedia('(max-width: 1023px)').matches) return 'Medium';\n return 'Large';\n}\n\nexport default getFormFactor();\n`;\n\nexport function client(): Provider {\n\treturn {\n\t\tprefix: \"@salesforce/client/\",\n\t\tresolve(specifier) {\n\t\t\tif (specifier === \"@salesforce/client/formFactor\") {\n\t\t\t\treturn FORM_FACTOR_SOURCE;\n\t\t\t}\n\t\t\treturn null;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst PREFIX = \"@salesforce/messageChannel/\";\n\nexport function messageChannel(): Provider {\n\treturn {\n\t\tprefix: PREFIX,\n\t\tresolve(specifier) {\n\t\t\tif (!specifier.startsWith(PREFIX)) return null;\n\t\t\treturn `export default Symbol('${specifier}:stub');`;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst SPECIFIER = \"lightning/messageService\";\n\nconst STUB_SOURCE = `\nconst WARN_MSG = '[LWC UI Bundle] lightning/messageService is not supported in static bundles.';\n\nexport function createMessageContext() { return {}; }\nexport function releaseMessageContext() {}\nexport function publish(_ctx, _channel, _message) {\n console.warn(WARN_MSG);\n}\nexport function subscribe(_ctx, _channel, _handler, _options) {\n console.warn(WARN_MSG);\n return {};\n}\nexport function unsubscribe(_subscription) {}\nexport const APPLICATION_SCOPE = Symbol('APPLICATION_SCOPE');\nexport const MessageContext = {};\nexport default {\n createMessageContext,\n releaseMessageContext,\n publish,\n subscribe,\n unsubscribe,\n APPLICATION_SCOPE,\n MessageContext,\n};\n`;\n\nexport function messageService(): Provider {\n\treturn {\n\t\tmatch(id) {\n\t\t\treturn id === SPECIFIER;\n\t\t},\n\t\tresolve(specifier) {\n\t\t\tif (specifier !== SPECIFIER) return null;\n\t\t\treturn STUB_SOURCE;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nconst SPECIFIER = \"lightning/navigation\";\n\nconst STUB_SOURCE = `\nconst WARN_MSG = '[LWC UI Bundle] lightning/navigation is not supported in static bundles.';\n\nexport const NavigationMixin = (Base) => {\n return class extends Base {\n [Symbol.for('NavigationMixin.Navigate')](pageRef, replace) {\n console.warn(WARN_MSG, { pageRef, replace });\n }\n [Symbol.for('NavigationMixin.GenerateUrl')](pageRef) {\n console.warn(WARN_MSG, { pageRef });\n return Promise.resolve('#');\n }\n };\n};\n\nNavigationMixin.Navigate = Symbol.for('NavigationMixin.Navigate');\nNavigationMixin.GenerateUrl = Symbol.for('NavigationMixin.GenerateUrl');\n\nexport default NavigationMixin;\n`;\n\nexport function navigation(): Provider {\n\treturn {\n\t\tmatch(id) {\n\t\t\treturn id === SPECIFIER;\n\t\t},\n\t\tresolve(specifier) {\n\t\t\tif (specifier !== SPECIFIER) return null;\n\t\t\treturn STUB_SOURCE;\n\t\t},\n\t};\n}\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport type { Provider } from \"../types\";\n\nexport function primitiveUtils(): Provider {\n\treturn {\n\t\tprefix: \"lightning/primitiveUtils\",\n\t\tmatch(id) {\n\t\t\treturn id === \"lightning/primitiveUtils\";\n\t\t},\n\t\tresolve(specifier) {\n\t\t\tif (specifier !== \"lightning/primitiveUtils\") return null;\n\n\t\t\treturn `export function normalizeBoolean(value) {\n return typeof value === 'string' || !!value;\n}\n\nexport function reflectAttribute(element, attrName, value) {\n if (!element) return;\n if (typeof value === 'string') {\n element.setAttribute(attrName, value);\n } else if (value === true) {\n element.setAttribute(attrName, '');\n } else if (!value) {\n element.removeAttribute(attrName);\n } else {\n console.warn(\\`Invalid attribute value for \"\\${attrName}\": \\${value}\\`);\n }\n}\n`;\n\t\t},\n\t};\n}\n"],"names":["PREFIX","STUB_SOURCE","SPECIFIER"],"mappings":";;;AAOA,MAAM,iBAAyC;AAAA,EAC9C,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,yBAAyB;AAAA,EACzB,2BAA2B;AAAA,EAC3B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,gCAAgC;AAAA,EAChC,kCAAkC;AAAA,EAClC,mCAAmC;AAAA,EACnC,uCAAuC;AAAA,EACvC,uCAAuC;AAAA,EACvC,8BAA8B;AAC/B;AAEO,SAAS,MAAM,YAAoC,IAAc;AACvE,QAAM,WAAW,EAAE,GAAG,gBAAgB,GAAG,UAAA;AACzC,SAAO;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ,WAAW;AAClB,UAAI,CAAC,UAAU,WAAW,oBAAoB,EAAG,QAAO;AAExD,YAAM,MAAM,UAAU,MAAM,qBAAqB,MAAM;AACvD,YAAM,gBAAgB,IACpB,MAAM,GAAG,EACT,GAAG,EAAE,EACL,QAA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"index.d.ts","sourceRoot":"","sources":["../../../src/providers/labels-graphql/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAsBpD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,CAwBxE;AAUD,iBAAS,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM1C;AAED,eAAO,MAAM,QAAQ;;;CAAqC,CAAC;AAC3D,YAAY,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/labels-graphql/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAsBpD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,MAAM,CAwBxE;AAmBD,iBAAS,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAM1C;AAED,eAAO,MAAM,QAAQ;;;CAAqC,CAAC;AAC3D,YAAY,EAAE,QAAQ,EAAE,CAAC"}
@@ -44,10 +44,19 @@ function labelsGraphql(options = {}) {
44
44
  };
45
45
  }
46
46
  function generateLabelModule(key, fallback) {
47
+ const k = JSON.stringify(key);
48
+ const fb = JSON.stringify(fallback);
47
49
  return [
48
- `import { getLabel } from "${RUNTIME_MODULE_ID}";`,
49
- `const label = getLabel(${JSON.stringify(key)}, ${JSON.stringify(fallback)});`,
50
- `export default label;`
50
+ `import { getLabel, subscribe as __subscribe } from "${RUNTIME_MODULE_ID}";`,
51
+ // Default export: the build-time string (resolves synchronously to the
52
+ // fallback, then to the cached org value on subsequent reads). This is the
53
+ // standard @salesforce/label contract and stays a plain string.
54
+ `const label = getLabel(${k}, ${fb});`,
55
+ `export default label;`,
56
+ // Opt-in reactive accessor: `subscribe(cb)` fires with the current value
57
+ // immediately and again when the runtime's GraphQL fetch resolves the real
58
+ // org value, so a component can reflect the resolved label in the DOM.
59
+ `export function subscribe(callback) { return __subscribe(${k}, ${fb}, callback); }`
51
60
  ].join("\n");
52
61
  }
53
62
  function camelFallback(key) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/providers/labels-graphql/constants.ts","../../../src/providers/labels-graphql/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\n\n/** The scoped-module prefix for Salesforce custom label imports. */\nexport const LABEL_PREFIX = \"@salesforce/label/\";\n\n/** Vite virtual-module prefix for resolved label modules. */\nexport const VIRTUAL_LABEL_PREFIX = \"\\0sf-label-graphql:\";\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { Plugin } from \"vite\";\nimport { LABEL_PREFIX, VIRTUAL_LABEL_PREFIX } from \"./constants\";\nimport type { LabelsGraphqlOptions, LabelKey } from \"./types\";\n\nexport type { LabelsGraphqlOptions } from \"./types\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst RUNTIME_MODULE_ID = \"\\0sf-labels-graphql-runtime\";\n\nconst STATIC_DEFAULTS: Record<string, string> = {\n\t\"LightningForm.edit\": \"Edit\",\n\t\"LightningForm.save\": \"Save\",\n\t\"LightningForm.cancel\": \"Cancel\",\n\t\"LightningForm.error\": \"Error\",\n\t\"RecordDetailUC.Expand\": \"Expand\",\n\t\"RecordDetailUC.Collapse\": \"Collapse\",\n\t\"Global_Entity.created_by\": \"Created By\",\n\t\"Global_Entity.last_modified_by\": \"Last Modified By\",\n\t\"DetailError.GenericSaveError\": \"An error occurred while saving.\",\n\t\"MobileWebError.NoPreEditAccess\": \"You don't have access to edit this record.\",\n\t\"DuplicateList.ToastMessageBlock\": \"Duplicate records were found.\",\n\t\"DuplicateList.NonBlockingHeaderText\": \"Duplicate records found\",\n\t\"DuplicateList.ToastMessageAlertEdit\": \"Duplicate records were found. You can continue editing.\",\n\t\"Errors.ErrorPopoverHeading\": \"Error\",\n};\n\n/**\n * Runtime GraphQL-backed label resolution.\n *\n * Each `@salesforce/label/c.foo` import becomes a module that calls into a\n * shared runtime. The runtime batches label keys and fetches their translated\n * values via UI API GraphQL at runtime, ensuring labels reflect the current\n * user's locale.\n */\nexport function labelsGraphql(options: LabelsGraphqlOptions = {}): Plugin {\n\tconst overrides = { ...STATIC_DEFAULTS, ...(options.staticOverrides ?? {}) };\n\n\treturn {\n\t\tname: \"vite-plugin-labels-graphql\",\n\t\tenforce: \"pre\",\n\n\t\tresolveId(id) {\n\t\t\tif (id === RUNTIME_MODULE_ID) return RUNTIME_MODULE_ID;\n\t\t\tif (!id.startsWith(LABEL_PREFIX)) return null;\n\t\t\treturn VIRTUAL_LABEL_PREFIX + id;\n\t\t},\n\n\t\tload(id) {\n\t\t\tif (id === RUNTIME_MODULE_ID) {\n\t\t\t\treturn readFileSync(join(__dirname, \"runtime.js\"), \"utf-8\");\n\t\t\t}\n\t\t\tif (!id.startsWith(VIRTUAL_LABEL_PREFIX)) return null;\n\t\t\tconst specifier = id.slice(VIRTUAL_LABEL_PREFIX.length);\n\t\t\tconst key = specifier.slice(LABEL_PREFIX.length);\n\t\t\tconst fallback = overrides[key] ?? camelFallback(key);\n\t\t\treturn generateLabelModule(key, fallback);\n\t\t},\n\t};\n}\n\nfunction generateLabelModule(key: string, fallback: string): string {\n\treturn [\n\t\t`import { getLabel } from \"${RUNTIME_MODULE_ID}\";`,\n\t\t`const label = getLabel(${JSON.stringify(key)}, ${JSON.stringify(fallback)});`,\n\t\t`export default label;`,\n\t].join(\"\\n\");\n}\n\nfunction camelFallback(key: string): string {\n\tconst tail = key.slice(1 + key.lastIndexOf(\".\"));\n\treturn tail\n\t\t.replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n\t\t.replace(/_/g, \" \")\n\t\t.trim();\n}\n\nexport const __test__ = { camelFallback, STATIC_DEFAULTS };\nexport type { LabelKey };\n"],"names":["__dirname"],"mappings":";;;AAOO,MAAM,eAAe;AAGrB,MAAM,uBAAuB;ACIpC,MAAMA,cAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AACxD,MAAM,oBAAoB;AAE1B,MAAM,kBAA0C;AAAA,EAC/C,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,yBAAyB;AAAA,EACzB,2BAA2B;AAAA,EAC3B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,gCAAgC;AAAA,EAChC,kCAAkC;AAAA,EAClC,mCAAmC;AAAA,EACnC,uCAAuC;AAAA,EACvC,uCAAuC;AAAA,EACvC,8BAA8B;AAC/B;AAUO,SAAS,cAAc,UAAgC,IAAY;AACzE,QAAM,YAAY,EAAE,GAAG,iBAAiB,GAAI,QAAQ,mBAAmB,GAAC;AAExE,SAAO;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IAET,UAAU,IAAI;AACb,UAAI,OAAO,kBAAmB,QAAO;AACrC,UAAI,CAAC,GAAG,WAAW,YAAY,EAAG,QAAO;AACzC,aAAO,uBAAuB;AAAA,IAC/B;AAAA,IAEA,KAAK,IAAI;AACR,UAAI,OAAO,mBAAmB;AAC7B,eAAO,aAAa,KAAKA,aAAW,YAAY,GAAG,OAAO;AAAA,MAC3D;AACA,UAAI,CAAC,GAAG,WAAW,oBAAoB,EAAG,QAAO;AACjD,YAAM,YAAY,GAAG,MAAM,qBAAqB,MAAM;AACtD,YAAM,MAAM,UAAU,MAAM,aAAa,MAAM;AAC/C,YAAM,WAAW,UAAU,GAAG,KAAK,cAAc,GAAG;AACpD,aAAO,oBAAoB,KAAK,QAAQ;AAAA,IACzC;AAAA,EAAA;AAEF;AAEA,SAAS,oBAAoB,KAAa,UAA0B;AACnE,SAAO;AAAA,IACN,6BAA6B,iBAAiB;AAAA,IAC9C,0BAA0B,KAAK,UAAU,GAAG,CAAC,KAAK,KAAK,UAAU,QAAQ,CAAC;AAAA,IAC1E;AAAA,EAAA,EACC,KAAK,IAAI;AACZ;AAEA,SAAS,cAAc,KAAqB;AAC3C,QAAM,OAAO,IAAI,MAAM,IAAI,IAAI,YAAY,GAAG,CAAC;AAC/C,SAAO,KACL,QAAQ,sBAAsB,OAAO,EACrC,QAAQ,MAAM,GAAG,EACjB,KAAA;AACH;AAEO,MAAM,WAAW,EAAE,eAAe,gBAAA;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/providers/labels-graphql/constants.ts","../../../src/providers/labels-graphql/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\n\n/** The scoped-module prefix for Salesforce custom label imports. */\nexport const LABEL_PREFIX = \"@salesforce/label/\";\n\n/** Vite virtual-module prefix for resolved label modules. */\nexport const VIRTUAL_LABEL_PREFIX = \"\\0sf-label-graphql:\";\n","/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\nimport { readFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { Plugin } from \"vite\";\nimport { LABEL_PREFIX, VIRTUAL_LABEL_PREFIX } from \"./constants\";\nimport type { LabelsGraphqlOptions, LabelKey } from \"./types\";\n\nexport type { LabelsGraphqlOptions } from \"./types\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\nconst RUNTIME_MODULE_ID = \"\\0sf-labels-graphql-runtime\";\n\nconst STATIC_DEFAULTS: Record<string, string> = {\n\t\"LightningForm.edit\": \"Edit\",\n\t\"LightningForm.save\": \"Save\",\n\t\"LightningForm.cancel\": \"Cancel\",\n\t\"LightningForm.error\": \"Error\",\n\t\"RecordDetailUC.Expand\": \"Expand\",\n\t\"RecordDetailUC.Collapse\": \"Collapse\",\n\t\"Global_Entity.created_by\": \"Created By\",\n\t\"Global_Entity.last_modified_by\": \"Last Modified By\",\n\t\"DetailError.GenericSaveError\": \"An error occurred while saving.\",\n\t\"MobileWebError.NoPreEditAccess\": \"You don't have access to edit this record.\",\n\t\"DuplicateList.ToastMessageBlock\": \"Duplicate records were found.\",\n\t\"DuplicateList.NonBlockingHeaderText\": \"Duplicate records found\",\n\t\"DuplicateList.ToastMessageAlertEdit\": \"Duplicate records were found. You can continue editing.\",\n\t\"Errors.ErrorPopoverHeading\": \"Error\",\n};\n\n/**\n * Runtime GraphQL-backed label resolution.\n *\n * Each `@salesforce/label/c.foo` import becomes a module that calls into a\n * shared runtime. The runtime batches label keys and fetches their translated\n * values via UI API GraphQL at runtime, ensuring labels reflect the current\n * user's locale.\n */\nexport function labelsGraphql(options: LabelsGraphqlOptions = {}): Plugin {\n\tconst overrides = { ...STATIC_DEFAULTS, ...(options.staticOverrides ?? {}) };\n\n\treturn {\n\t\tname: \"vite-plugin-labels-graphql\",\n\t\tenforce: \"pre\",\n\n\t\tresolveId(id) {\n\t\t\tif (id === RUNTIME_MODULE_ID) return RUNTIME_MODULE_ID;\n\t\t\tif (!id.startsWith(LABEL_PREFIX)) return null;\n\t\t\treturn VIRTUAL_LABEL_PREFIX + id;\n\t\t},\n\n\t\tload(id) {\n\t\t\tif (id === RUNTIME_MODULE_ID) {\n\t\t\t\treturn readFileSync(join(__dirname, \"runtime.js\"), \"utf-8\");\n\t\t\t}\n\t\t\tif (!id.startsWith(VIRTUAL_LABEL_PREFIX)) return null;\n\t\t\tconst specifier = id.slice(VIRTUAL_LABEL_PREFIX.length);\n\t\t\tconst key = specifier.slice(LABEL_PREFIX.length);\n\t\t\tconst fallback = overrides[key] ?? camelFallback(key);\n\t\t\treturn generateLabelModule(key, fallback);\n\t\t},\n\t};\n}\n\nfunction generateLabelModule(key: string, fallback: string): string {\n\tconst k = JSON.stringify(key);\n\tconst fb = JSON.stringify(fallback);\n\treturn [\n\t\t`import { getLabel, subscribe as __subscribe } from \"${RUNTIME_MODULE_ID}\";`,\n\t\t// Default export: the build-time string (resolves synchronously to the\n\t\t// fallback, then to the cached org value on subsequent reads). This is the\n\t\t// standard @salesforce/label contract and stays a plain string.\n\t\t`const label = getLabel(${k}, ${fb});`,\n\t\t`export default label;`,\n\t\t// Opt-in reactive accessor: `subscribe(cb)` fires with the current value\n\t\t// immediately and again when the runtime's GraphQL fetch resolves the real\n\t\t// org value, so a component can reflect the resolved label in the DOM.\n\t\t`export function subscribe(callback) { return __subscribe(${k}, ${fb}, callback); }`,\n\t].join(\"\\n\");\n}\n\nfunction camelFallback(key: string): string {\n\tconst tail = key.slice(1 + key.lastIndexOf(\".\"));\n\treturn tail\n\t\t.replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n\t\t.replace(/_/g, \" \")\n\t\t.trim();\n}\n\nexport const __test__ = { camelFallback, STATIC_DEFAULTS };\nexport type { LabelKey };\n"],"names":["__dirname"],"mappings":";;;AAOO,MAAM,eAAe;AAGrB,MAAM,uBAAuB;ACIpC,MAAMA,cAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AACxD,MAAM,oBAAoB;AAE1B,MAAM,kBAA0C;AAAA,EAC/C,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,EACtB,wBAAwB;AAAA,EACxB,uBAAuB;AAAA,EACvB,yBAAyB;AAAA,EACzB,2BAA2B;AAAA,EAC3B,4BAA4B;AAAA,EAC5B,kCAAkC;AAAA,EAClC,gCAAgC;AAAA,EAChC,kCAAkC;AAAA,EAClC,mCAAmC;AAAA,EACnC,uC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@
3
3
  * All rights reserved.
4
4
  * For full license text, see the LICENSE.txt file
5
5
  */
6
+ /**
7
+ * Subscribe to a label's resolved value. The callback fires immediately with the
8
+ * current value (fallback if not yet resolved) and again when the runtime's
9
+ * GraphQL fetch resolves the real org value. Returns an unsubscribe function.
10
+ *
11
+ * The default `@salesforce/label/*` export stays a plain build-time string for
12
+ * back-compat; this opt-in accessor is what lets a component reactively reflect
13
+ * the resolved value once it arrives.
14
+ */
15
+ export declare function subscribe(key: string, fallback: string, callback: (value: string) => void): () => void;
6
16
  export declare function getApiShape(): Promise<boolean>;
7
17
  export declare function getLabel(key: string, fallback: string): string;
8
18
  export declare function groupByNamespace(keys: string[]): Map<string, string[]>;
9
- interface GraphqlEndpoint {
10
- url: string;
11
- headers?: Record<string, string>;
12
- }
13
- declare global {
14
- interface Window {
15
- __SF_LABELS_GRAPHQL_FETCH__?: (query: string, variables: Record<string, unknown>) => Promise<unknown>;
16
- __SF_GRAPHQL_ENDPOINT__?: GraphqlEndpoint;
17
- openai?: {
18
- callTool?: (toolName: string, params: unknown) => Promise<unknown>;
19
- };
20
- }
21
- }
19
+ /**
20
+ * Fetch labels through the Platform Data SDK — the single, surface-aware GraphQL
21
+ * path. `createDataSDK()` resolves to a direct session-authenticated GraphQL
22
+ * request on a full-page WebApp / Micro-Frontend surface, or to the
23
+ * window.openai.callTool bridge on the OpenAI/MCP surface. There is no separate
24
+ * transport fallback: when no data surface is available the labels simply keep
25
+ * their build-time fallback values (handled by the caller).
26
+ *
27
+ * @returns The response normalized to `{ data, errors }`, or `{}` when no data
28
+ * surface is available.
29
+ */
22
30
  export declare function graphqlFetch(query: string, variables: Record<string, unknown>): Promise<unknown>;
23
31
  /** Reset internal state — exposed for tests only. */
24
32
  export declare function __resetForTest(): void;
25
- export {};
26
33
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/providers/labels-graphql/runtime.ts"],"names":[],"mappings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AYZ;AA4CD,wBAAgB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAK9C;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM9D;AA8CD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAWtE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CACjC,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,OAAO,CAAC,CA2BlB;AAED,qDAAqD;AACrD,wBAAgB,cAAc,IAAI,IAAI,CAMrC"}
@@ -2,7 +2,26 @@ const labelCache = /* @__PURE__ */ new Map();
2
2
  const pendingKeys = /* @__PURE__ */ new Set();
3
3
  let fetchScheduled = false;
4
4
  let probePromise = null;
5
- const QUERY_264 = `query Labels($namespace: String, $names: [String!]) {
5
+ const subscribers = /* @__PURE__ */ new Map();
6
+ function subscribe(key, fallback, callback) {
7
+ let set = subscribers.get(key);
8
+ if (!set) {
9
+ set = /* @__PURE__ */ new Set();
10
+ subscribers.set(key, set);
11
+ }
12
+ set.add(callback);
13
+ callback(getLabel(key, fallback));
14
+ return () => {
15
+ subscribers.get(key)?.delete(callback);
16
+ };
17
+ }
18
+ function setResolved(key, value) {
19
+ if (labelCache.get(key) === value) return;
20
+ labelCache.set(key, value);
21
+ const set = subscribers.get(key);
22
+ if (set) for (const cb of set) cb(value);
23
+ }
24
+ const QUERY_264 = `query Labels($namespace: String, $names: [String!]!) {
6
25
  uiapi {
7
26
  platform {
8
27
  labels(namespace: $namespace, names: $names) {
@@ -13,7 +32,7 @@ const QUERY_264 = `query Labels($namespace: String, $names: [String!]) {
13
32
  }
14
33
  }
15
34
  }`;
16
- const QUERY_262 = `query Labels($namespace: String, $names: [String!]) {
35
+ const QUERY_262 = `query Labels($namespace: String, $names: [String!]!) {
17
36
  uiapi {
18
37
  labels(namespace: $namespace, names: $names) {
19
38
  namespace
@@ -67,7 +86,7 @@ async function fetchLabelsFromOrg(keys) {
67
86
  const labels = isPlatform ? responseTyped?.data?.uiapi?.platform?.labels ?? [] : responseTyped?.data?.uiapi?.labels ?? [];
68
87
  for (const item of labels) {
69
88
  const ns = item.namespace ?? namespace;
70
- labelCache.set(ns + "." + item.name, item.value);
89
+ setResolved(ns + "." + item.name, item.value);
71
90
  }
72
91
  } catch (e) {
73
92
  console.warn("[labels-graphql] Runtime fetch failed:", e);
@@ -88,36 +107,29 @@ function groupByNamespace(keys) {
88
107
  return grouped;
89
108
  }
90
109
  async function graphqlFetch(query, variables) {
91
- if (typeof window !== "undefined" && window.__SF_LABELS_GRAPHQL_FETCH__) {
92
- return window.__SF_LABELS_GRAPHQL_FETCH__(query, variables);
93
- }
94
- if (typeof window !== "undefined" && window.openai) {
95
- const sdk = window.openai;
96
- if (typeof sdk.callTool === "function") {
97
- return sdk.callTool("graphqlQuery", { query, variables });
98
- }
99
- }
100
- const endpoint = typeof window !== "undefined" ? window.__SF_GRAPHQL_ENDPOINT__ : void 0;
101
- if (!endpoint) {
110
+ let createDataSDK;
111
+ try {
112
+ ({ createDataSDK } = await import("@salesforce/platform-sdk"));
113
+ } catch {
102
114
  console.warn(
103
- "[labels-graphql] No GraphQL endpoint configured. Labels will use fallback values."
115
+ "[labels-graphql] @salesforce/platform-sdk is not available. Labels will use fallback values."
104
116
  );
105
117
  return {};
106
118
  }
107
- const res = await fetch(endpoint.url, {
108
- method: "POST",
109
- headers: {
110
- "Content-Type": "application/json",
111
- ...endpoint.headers || {}
112
- },
113
- body: JSON.stringify({ query, variables })
114
- });
115
- if (!res.ok) throw new Error("GraphQL fetch failed: " + res.status);
116
- return res.json();
119
+ if (typeof createDataSDK !== "function") {
120
+ return {};
121
+ }
122
+ const sdk = await createDataSDK();
123
+ if (!sdk.graphql) {
124
+ return {};
125
+ }
126
+ const result = await sdk.graphql.query({ query, variables });
127
+ return { data: result.data, errors: result.errors };
117
128
  }
118
129
  function __resetForTest() {
119
130
  labelCache.clear();
120
131
  pendingKeys.clear();
132
+ subscribers.clear();
121
133
  fetchScheduled = false;
122
134
  probePromise = null;
123
135
  }
@@ -126,6 +138,7 @@ export {
126
138
  getApiShape,
127
139
  getLabel,
128
140
  graphqlFetch,
129
- groupByNamespace
141
+ groupByNamespace,
142
+ subscribe
130
143
  };
131
144
  //# sourceMappingURL=runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sources":["../../../src/providers/labels-graphql/runtime.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\n\nconst labelCache = new Map<string, string>();\nconst pendingKeys = new Set<string>();\nlet fetchScheduled = false;\nlet probePromise: Promise<boolean> | null = null;\n\nconst QUERY_264 = `query Labels($namespace: String, $names: [String!]) {\n uiapi {\n platform {\n labels(namespace: $namespace, names: $names) {\n namespace\n name\n value\n }\n }\n }\n}`;\n\nconst QUERY_262 = `query Labels($namespace: String, $names: [String!]) {\n uiapi {\n labels(namespace: $namespace, names: $names) {\n namespace\n name\n value\n }\n }\n}`;\n\nasync function detectPlatformPath(): Promise<boolean> {\n\ttry {\n\t\tconst response = (await graphqlFetch(`{ uiapi { platform { __typename } } }`, {})) as {\n\t\t\tdata?: { uiapi?: { platform?: unknown } };\n\t\t\terrors?: unknown[];\n\t\t};\n\t\treturn !!response?.data?.uiapi?.platform;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function getApiShape(): Promise<boolean> {\n\tif (!probePromise) {\n\t\tprobePromise = detectPlatformPath();\n\t}\n\treturn probePromise;\n}\n\nexport function getLabel(key: string, fallback: string): string {\n\tif (labelCache.has(key)) return labelCache.get(key)!;\n\tlabelCache.set(key, fallback);\n\tpendingKeys.add(key);\n\tscheduleFetch();\n\treturn fallback;\n}\n\nfunction scheduleFetch(): void {\n\tif (fetchScheduled) return;\n\tfetchScheduled = true;\n\tPromise.resolve().then(() => {\n\t\tfetchScheduled = false;\n\t\tif (pendingKeys.size === 0) return;\n\t\tconst keys = [...pendingKeys];\n\t\tpendingKeys.clear();\n\t\tfetchLabelsFromOrg(keys);\n\t});\n}\n\nasync function fetchLabelsFromOrg(keys: string[]): Promise<void> {\n\tconst isPlatform = await getApiShape();\n\tconst query = isPlatform ? QUERY_264 : QUERY_262;\n\tconst grouped = groupByNamespace(keys);\n\tfor (const [namespace, names] of grouped) {\n\t\tfor (let i = 0; i < names.length; i += 100) {\n\t\t\tconst batch = names.slice(i, i + 100);\n\t\t\ttry {\n\t\t\t\tconst response = await graphqlFetch(query, { namespace, names: batch });\n\t\t\t\tconst responseTyped = response as {\n\t\t\t\t\tdata?: { uiapi?: { platform?: { labels?: LabelRecord[] }; labels?: LabelRecord[] } };\n\t\t\t\t};\n\t\t\t\tconst labels = isPlatform\n\t\t\t\t\t? (responseTyped?.data?.uiapi?.platform?.labels ?? [])\n\t\t\t\t\t: (responseTyped?.data?.uiapi?.labels ?? []);\n\t\t\t\tfor (const item of labels) {\n\t\t\t\t\tconst ns = item.namespace ?? namespace;\n\t\t\t\t\tlabelCache.set(ns + \".\" + item.name, item.value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[labels-graphql] Runtime fetch failed:\", e);\n\t\t\t}\n\t\t}\n\t}\n}\n\ninterface LabelRecord {\n\tnamespace?: string;\n\tname: string;\n\tvalue: string;\n}\n\nexport function groupByNamespace(keys: string[]): Map<string, string[]> {\n\tconst grouped = new Map<string, string[]>();\n\tfor (const key of keys) {\n\t\tconst dot = key.indexOf(\".\");\n\t\tconst namespace = dot === -1 ? \"c\" : key.slice(0, dot);\n\t\tconst name = dot === -1 ? key : key.slice(dot + 1);\n\t\tif (name.includes(\".\")) continue;\n\t\tif (!grouped.has(namespace)) grouped.set(namespace, []);\n\t\tgrouped.get(namespace)!.push(name);\n\t}\n\treturn grouped;\n}\n\ninterface GraphqlEndpoint {\n\turl: string;\n\theaders?: Record<string, string>;\n}\n\ndeclare global {\n\tinterface Window {\n\t\t__SF_LABELS_GRAPHQL_FETCH__?: (\n\t\t\tquery: string,\n\t\t\tvariables: Record<string, unknown>,\n\t\t) => Promise<unknown>;\n\t\t__SF_GRAPHQL_ENDPOINT__?: GraphqlEndpoint;\n\t\topenai?: { callTool?: (toolName: string, params: unknown) => Promise<unknown> };\n\t}\n}\n\nexport async function graphqlFetch(\n\tquery: string,\n\tvariables: Record<string, unknown>,\n): Promise<unknown> {\n\tif (typeof window !== \"undefined\" && window.__SF_LABELS_GRAPHQL_FETCH__) {\n\t\treturn window.__SF_LABELS_GRAPHQL_FETCH__(query, variables);\n\t}\n\tif (typeof window !== \"undefined\" && window.openai) {\n\t\tconst sdk = window.openai;\n\t\tif (typeof sdk.callTool === \"function\") {\n\t\t\treturn sdk.callTool(\"graphqlQuery\", { query, variables });\n\t\t}\n\t}\n\tconst endpoint = typeof window !== \"undefined\" ? window.__SF_GRAPHQL_ENDPOINT__ : undefined;\n\tif (!endpoint) {\n\t\tconsole.warn(\n\t\t\t\"[labels-graphql] No GraphQL endpoint configured. Labels will use fallback values.\",\n\t\t);\n\t\treturn {};\n\t}\n\tconst res = await fetch(endpoint.url, {\n\t\tmethod: \"POST\",\n\t\theaders: {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t...(endpoint.headers || {}),\n\t\t},\n\t\tbody: JSON.stringify({ query, variables }),\n\t});\n\tif (!res.ok) throw new Error(\"GraphQL fetch failed: \" + res.status);\n\treturn res.json();\n}\n\n/** Reset internal state — exposed for tests only. */\nexport function __resetForTest(): void {\n\tlabelCache.clear();\n\tpendingKeys.clear();\n\tfetchScheduled = false;\n\tprobePromise = null;\n}\n"],"names":[],"mappings":"AAMA,MAAM,iCAAiB,IAAA;AACvB,MAAM,kCAAkB,IAAA;AACxB,IAAI,iBAAiB;AACrB,IAAI,eAAwC;AAE5C,MAAM,YAAY;A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CAAA;AAAA,IAAC;AAAA,IAE1B,MAAM,KAAK,UAAU,EAAE,OAAO,WAAW;AAAA,EAAA,CACzC;AACD,MAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,2BAA2B,IAAI,MAAM;AAClE,SAAO,IAAI,KAAA;AACZ;AAGO,SAAS,iBAAuB;AACtC,aAAW,MAAA;AACX,cAAY,MAAA;AACZ,mBAAiB;AACjB,iBAAe;AAChB;"}
1
+ {"version":3,"file":"runtime.js","sources":["../../../src/providers/labels-graphql/runtime.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, Salesforce, Inc.,\n * All rights reserved.\n * For full license text, see the LICENSE.txt file\n */\n\nconst labelCache = new Map<string, string>();\nconst pendingKeys = new Set<string>();\nlet fetchScheduled = false;\nlet probePromise: Promise<boolean> | null = null;\n\n/** Per-key subscriber callbacks, notified when a key's value changes (fallback → resolved). */\nconst subscribers = new Map<string, Set<(value: string) => void>>();\n\n/**\n * Subscribe to a label's resolved value. The callback fires immediately with the\n * current value (fallback if not yet resolved) and again when the runtime's\n * GraphQL fetch resolves the real org value. Returns an unsubscribe function.\n *\n * The default `@salesforce/label/*` export stays a plain build-time string for\n * back-compat; this opt-in accessor is what lets a component reactively reflect\n * the resolved value once it arrives.\n */\nexport function subscribe(\n\tkey: string,\n\tfallback: string,\n\tcallback: (value: string) => void,\n): () => void {\n\tlet set = subscribers.get(key);\n\tif (!set) {\n\t\tset = new Set();\n\t\tsubscribers.set(key, set);\n\t}\n\tset.add(callback);\n\t// Prime resolution (also seeds the cache + schedules the fetch) and emit current value.\n\tcallback(getLabel(key, fallback));\n\treturn () => {\n\t\tsubscribers.get(key)?.delete(callback);\n\t};\n}\n\n/** Update the cache and notify subscribers if the value actually changed. */\nfunction setResolved(key: string, value: string): void {\n\tif (labelCache.get(key) === value) return;\n\tlabelCache.set(key, value);\n\tconst set = subscribers.get(key);\n\tif (set) for (const cb of set) cb(value);\n}\n\nconst QUERY_264 = `query Labels($namespace: String, $names: [String!]!) {\n uiapi {\n platform {\n labels(namespace: $namespace, names: $names) {\n namespace\n name\n value\n }\n }\n }\n}`;\n\nconst QUERY_262 = `query Labels($namespace: String, $names: [String!]!) {\n uiapi {\n labels(namespace: $namespace, names: $names) {\n namespace\n name\n value\n }\n }\n}`;\n\nasync function detectPlatformPath(): Promise<boolean> {\n\ttry {\n\t\tconst response = (await graphqlFetch(`{ uiapi { platform { __typename } } }`, {})) as {\n\t\t\tdata?: { uiapi?: { platform?: unknown } };\n\t\t\terrors?: unknown[];\n\t\t};\n\t\treturn !!response?.data?.uiapi?.platform;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function getApiShape(): Promise<boolean> {\n\tif (!probePromise) {\n\t\tprobePromise = detectPlatformPath();\n\t}\n\treturn probePromise;\n}\n\nexport function getLabel(key: string, fallback: string): string {\n\tif (labelCache.has(key)) return labelCache.get(key)!;\n\tlabelCache.set(key, fallback);\n\tpendingKeys.add(key);\n\tscheduleFetch();\n\treturn fallback;\n}\n\nfunction scheduleFetch(): void {\n\tif (fetchScheduled) return;\n\tfetchScheduled = true;\n\tPromise.resolve().then(() => {\n\t\tfetchScheduled = false;\n\t\tif (pendingKeys.size === 0) return;\n\t\tconst keys = [...pendingKeys];\n\t\tpendingKeys.clear();\n\t\tfetchLabelsFromOrg(keys);\n\t});\n}\n\nasync function fetchLabelsFromOrg(keys: string[]): Promise<void> {\n\tconst isPlatform = await getApiShape();\n\tconst query = isPlatform ? QUERY_264 : QUERY_262;\n\tconst grouped = groupByNamespace(keys);\n\tfor (const [namespace, names] of grouped) {\n\t\tfor (let i = 0; i < names.length; i += 100) {\n\t\t\tconst batch = names.slice(i, i + 100);\n\t\t\ttry {\n\t\t\t\tconst response = await graphqlFetch(query, { namespace, names: batch });\n\t\t\t\tconst responseTyped = response as {\n\t\t\t\t\tdata?: { uiapi?: { platform?: { labels?: LabelRecord[] }; labels?: LabelRecord[] } };\n\t\t\t\t};\n\t\t\t\tconst labels = isPlatform\n\t\t\t\t\t? (responseTyped?.data?.uiapi?.platform?.labels ?? [])\n\t\t\t\t\t: (responseTyped?.data?.uiapi?.labels ?? []);\n\t\t\t\tfor (const item of labels) {\n\t\t\t\t\tconst ns = item.namespace ?? namespace;\n\t\t\t\t\tsetResolved(ns + \".\" + item.name, item.value);\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[labels-graphql] Runtime fetch failed:\", e);\n\t\t\t}\n\t\t}\n\t}\n}\n\ninterface LabelRecord {\n\tnamespace?: string;\n\tname: string;\n\tvalue: string;\n}\n\nexport function groupByNamespace(keys: string[]): Map<string, string[]> {\n\tconst grouped = new Map<string, string[]>();\n\tfor (const key of keys) {\n\t\tconst dot = key.indexOf(\".\");\n\t\tconst namespace = dot === -1 ? \"c\" : key.slice(0, dot);\n\t\tconst name = dot === -1 ? key : key.slice(dot + 1);\n\t\tif (name.includes(\".\")) continue;\n\t\tif (!grouped.has(namespace)) grouped.set(namespace, []);\n\t\tgrouped.get(namespace)!.push(name);\n\t}\n\treturn grouped;\n}\n\n/**\n * Fetch labels through the Platform Data SDK — the single, surface-aware GraphQL\n * path. `createDataSDK()` resolves to a direct session-authenticated GraphQL\n * request on a full-page WebApp / Micro-Frontend surface, or to the\n * window.openai.callTool bridge on the OpenAI/MCP surface. There is no separate\n * transport fallback: when no data surface is available the labels simply keep\n * their build-time fallback values (handled by the caller).\n *\n * @returns The response normalized to `{ data, errors }`, or `{}` when no data\n * surface is available.\n */\nexport async function graphqlFetch(\n\tquery: string,\n\tvariables: Record<string, unknown>,\n): Promise<unknown> {\n\tlet createDataSDK:\n\t\t| ((options?: unknown) => Promise<{\n\t\t\t\tgraphql?: { query: (opts: unknown) => Promise<{ data?: unknown; errors?: unknown }> };\n\t\t }>)\n\t\t| undefined;\n\ttry {\n\t\t({ createDataSDK } = (await import(\"@salesforce/platform-sdk\")) as unknown as {\n\t\t\tcreateDataSDK: typeof createDataSDK;\n\t\t});\n\t} catch {\n\t\tconsole.warn(\n\t\t\t\"[labels-graphql] @salesforce/platform-sdk is not available. Labels will use fallback values.\",\n\t\t);\n\t\treturn {};\n\t}\n\tif (typeof createDataSDK !== \"function\") {\n\t\treturn {};\n\t}\n\tconst sdk = await createDataSDK();\n\tif (!sdk.graphql) {\n\t\t// Surface has no data operations (e.g. MCPApps stub). Keep fallbacks.\n\t\treturn {};\n\t}\n\t// GraphQLRawDocument is a plain string; pass the query through directly.\n\tconst result = await sdk.graphql.query({ query, variables });\n\treturn { data: result.data, errors: result.errors };\n}\n\n/** Reset internal state — exposed for tests only. */\nexport function __resetForTest(): void {\n\tlabelCache.clear();\n\tpendingKeys.clear();\n\tsubscribers.clear();\n\tfetchScheduled = false;\n\tprobePromise = null;\n}\n"],"names":[],"mappings":"AAMA,MAAM,iCAAiB,IAAA;AACvB,MAAM,kCAAkB,IAAA;AACxB,IAAI,iBAAiB;AACrB,IAAI,eAAwC;AAG5C,MAAM,kCAAkB,IAAA;AAWjB,SAAS,UACf,KACA,UACA,UACa;AACb,MAAI,MAAM,YAAY,IAAI,GAAG;AAC7B,MAAI,CAAC,KAAK;AACT,8BAAU,IAAA;AACV,gBAAY,IAAI,KAAK,GAAG;AAAA,EACzB;AACA,MAAI,IAAI,QAAQ;AAEhB,WAAS,SAAS,KAAK,QAAQ,CAAC;AAChC,SAAO,MAAM;AACZ,gBAAY,IAAI,GAAG,GAAG,OAAO,QAAQ;AAAA,EACtC;AACD;AAGA,SAAS,YAAY,KAAa,OAAqB;AACtD,MAAI,WAAW,IAAI,GAAG,MAAM,MAAO;AACnC,aAAW,IAAI,KAAK,KAAK;AACzB,QAAM,MAAM,YAAY,IAAI,GAAG;AAC/B,MAAI,IAAK,YAAW,MAAM,QAAQ,KAAK;AACxC;AAEA,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAYlB,MAAM,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUlB,eAAe,qB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AA,QAC7C;AAAA,MACD,SAAS,GAAG;AACX,gBAAQ,KAAK,0CAA0C,CAAC;AAAA,MACzD;AAAA,IACD;AAAA,EACD;AACD;AAQO,SAAS,iBAAiB,MAAuC;AACvE,QAAM,8BAAc,IAAA;AACpB,aAAW,OAAO,MAAM;AACvB,UAAM,MAAM,IAAI,QAAQ,GAAG;AAC3B,UAAM,YAAY,QAAQ,KAAK,MAAM,IAAI,MAAM,GAAG,GAAG;AACrD,UAAM,OAAO,QAAQ,KAAK,MAAM,IAAI,MAAM,MAAM,CAAC;AACjD,QAAI,KAAK,SAAS,GAAG,EAAG;AACxB,QAAI,CAAC,QAAQ,IAAI,SAAS,EAAG,SAAQ,IAAI,WAAW,EAAE;AACtD,YAAQ,IAAI,SAAS,EAAG,KAAK,IAAI;AAAA,EAClC;AACA,SAAO;AACR;AAaA,eAAsB,aACrB,OACA,WACmB;AACnB,MAAI;AAKJ,MAAI;AACH,KAAC,EAAE,cAAA,IAAmB,MAAM,OAAO,0BAA0B;AAAA,EAG9D,QAAQ;AACP,YAAQ;AAAA,MACP;AAAA,IAAA;AAED,WAAO,CAAA;AAAA,EACR;AACA,MAAI,OAAO,kBAAkB,YAAY;AACxC,WAAO,CAAA;AAAA,EACR;AACA,QAAM,MAAM,MAAM,cAAA;AAClB,MAAI,CAAC,IAAI,SAAS;AAEjB,WAAO,CAAA;AAAA,EACR;AAEA,QAAM,SAAS,MAAM,IAAI,QAAQ,MAAM,EAAE,OAAO,WAAW;AAC3D,SAAO,EAAE,MAAM,OAAO,MAAM,QAAQ,OAAO,OAAA;AAC5C;AAGO,SAAS,iBAAuB;AACtC,aAAW,MAAA;AACX,cAAY,MAAA;AACZ,cAAY,MAAA;AACZ,mBAAiB;AACjB,iBAAe;AAChB;"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ /** Scoped-module prefixes resolved via `uiapi.platform.*` GraphQL off-core. */
7
+ export declare const USER_PERMISSION_PREFIX = "@salesforce/userPermission/";
8
+ export declare const CUSTOM_PERMISSION_PREFIX = "@salesforce/customPermission/";
9
+ export declare const ACCESS_CHECK_PREFIX = "@salesforce/accessCheck/";
10
+ export declare const I18N_PREFIX = "@salesforce/i18n/";
11
+ /** Vite virtual-module prefix for resolved platform-graphql modules. */
12
+ export declare const VIRTUAL_PLATFORM_PREFIX = "\0sf-platform-graphql:";
13
+ /** Shared runtime module id (read-as-string and injected at build). */
14
+ export declare const RUNTIME_MODULE_ID = "\0sf-platform-graphql-runtime";
15
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/providers/platform-graphql/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+EAA+E;AAC/E,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AACpE,eAAO,MAAM,wBAAwB,kCAAkC,CAAC;AACxE,eAAO,MAAM,mBAAmB,6BAA6B,CAAC;AAC9D,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAE/C,wEAAwE;AACxE,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAEhE,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,kCAAkC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ /**
7
+ * Static CLDR i18n data for `@salesforce/i18n/*` keys that have NO org GraphQL
8
+ * source. The locale-IDENTITY scalars (lang/dir/locale/currency/timeZone/
9
+ * firstDayOfWeek/defaultCalendar/defaultNumberingSystem) come from
10
+ * `uiapi.platform.i18n` at runtime; everything here (number/date FORMAT patterns
11
+ * and calendar data) is CLDR reference data, not org data, so it stays static.
12
+ *
13
+ * These tables are the SAME reference data the opt-out `i18n()` provider uses,
14
+ * so they are re-exported from a single source (`../i18n`) rather than
15
+ * duplicated — this is what keeps them from drifting (e.g. the calendar key
16
+ * `gregorian` vs `gregory`).
17
+ */
18
+ export { CLDR_FORMAT_DEFAULTS as I18N_STATIC_DEFAULTS, CLDR_OBJECT_DEFAULTS as I18N_OBJECT_DEFAULTS, } from '../i18n';
19
+ //# sourceMappingURL=i18n-static.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-static.d.ts","sourceRoot":"","sources":["../../../src/providers/platform-graphql/i18n-static.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;GAWG;AACH,OAAO,EACN,oBAAoB,IAAI,oBAAoB,EAC5C,oBAAoB,IAAI,oBAAoB,GAC5C,MAAM,SAAS,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { Plugin } from 'vite';
2
+ export interface PlatformGraphqlOptions {
3
+ /**
4
+ * Explicit first-paint values for NAMED user permissions, keyed by permission
5
+ * name, e.g. `{ ApiEnabled: false }`. **Required for every
6
+ * `@salesforce/userPermission/<Name>` a bundle imports.**
7
+ *
8
+ * A permission is per-user runtime state. A plain default import captures the
9
+ * generated module's value once at module-eval time and never updates unless
10
+ * the component opts into the module's `subscribe()` export — so a silently
11
+ * fabricated `false` would render a wrong, permanent answer about what the user
12
+ * can do. Rather than guess, the build fails if a name is imported without an
13
+ * entry here. Use `false` unless you have a specific reason to render `true`
14
+ * before the org responds, then reflect the resolved value reactively via
15
+ * `subscribe()`.
16
+ */
17
+ userPermissionDefaults?: Record<string, boolean>;
18
+ /**
19
+ * Explicit first-paint values for named custom permissions. Required per
20
+ * imported `@salesforce/customPermission/<Name>` — see {@link userPermissionDefaults}.
21
+ */
22
+ customPermissionDefaults?: Record<string, boolean>;
23
+ /**
24
+ * First-paint values for `@salesforce/accessCheck/<Name>` feature gates.
25
+ * Unlike a named permission, an unconfigured access check is NOT a build error:
26
+ * it defaults to `false`. Deny-by-default is the safe gate semantic, and base
27
+ * components import many of these implicitly. Override to open a gate before
28
+ * the fetch resolves.
29
+ */
30
+ accessCheckDefaults?: Record<string, boolean>;
31
+ /**
32
+ * String overrides for the GraphQL-backed i18n identity keys (locale, currency,
33
+ * timeZone, …). Optional: the built-in CLDR placeholders are identical for every
34
+ * user and self-correct once the fetch lands, so no per-key config is required.
35
+ */
36
+ i18nOverrides?: Record<string, string>;
37
+ /** Object overrides for static (non-GraphQL) i18n keys. Optional. */
38
+ i18nObjectOverrides?: Record<string, unknown>;
39
+ }
40
+ /**
41
+ * Resolves scoped modules that have a real `uiapi.platform.*` GraphQL source,
42
+ * fetched off-core through the Platform Data SDK:
43
+ *
44
+ * - `@salesforce/userPermission/<Name>` → `userPermissions` → boolean
45
+ * - `@salesforce/accessCheck/<Name>` → `userPermissions` → boolean (alias)
46
+ * - `@salesforce/customPermission/<Name>` → `customPermissions` → boolean
47
+ * - `@salesforce/i18n/<key>` → `i18n { ... }` for locale-identity keys;
48
+ * number/date FORMAT patterns + calendar data stay static (CLDR, no org source).
49
+ *
50
+ * Each generated module exports the build-time fallback as `default` (synchronous)
51
+ * and an opt-in `subscribe(cb)` that fires with the resolved org value.
52
+ *
53
+ * `@salesforce/gate/*` is intentionally NOT handled here — its GraphQL field
54
+ * (`uiapi.platform.gates`) is restricted to a UiTier context and is not reachable
55
+ * off-core (verified: FieldUndefined / "can only be executed in a UiTier context").
56
+ */
57
+ export declare function platformGraphql(options?: PlatformGraphqlOptions): Plugin;
58
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/providers/platform-graphql/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAgBnC,MAAM,WAAW,sBAAsB;IACtC;;;;;;;;;;;;;OAaG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjD;;;OAGG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnD;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9C;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,MAAM,CA+D5E"}