@camstack/addon-import-alexa 0.2.151 → 0.2.153

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 (17) hide show
  1. package/dist/{MotionZonesSettings-Dxo0EAzN.mjs → MotionZonesSettings-BAg3ARov.mjs} +2 -2
  2. package/dist/{PrivacyMaskSettings-DwWxpZrj.mjs → PrivacyMaskSettings-C0cYJFNC.mjs} +4 -4
  3. package/dist/{SceneMonitorEditor-CC0dk5TR.mjs → SceneMonitorEditor-3Nx49OE2.mjs} +3 -3
  4. package/dist/_stub.js +9 -9
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_import_alexa_page-CcQjQJmj.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_import_alexa_page-Yxzd8sJD.mjs} +2 -2
  6. package/dist/{_virtual_mf___mfe_internal__addon_import_alexa_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Msberbw_.mjs → _virtual_mf___mfe_internal__addon_import_alexa_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BU5ExEvB.mjs} +1 -1
  7. package/dist/addon.js +234 -40
  8. package/dist/addon.mjs +234 -40
  9. package/dist/{hostInit-CRUwUtSm.mjs → hostInit-U2MikdrL.mjs} +1 -1
  10. package/dist/{player-overlays-DNpsEqAe.mjs → player-overlays-COWyo9kN.mjs} +1 -1
  11. package/dist/remoteEntry.js +1 -1
  12. package/dist/{responsive-B82v3AbM.mjs → responsive-CLpz8rKp.mjs} +1 -1
  13. package/dist/{scene-monitor-copy-CPnjwzw6.mjs → scene-monitor-copy-BLy8yxxd.mjs} +1 -1
  14. package/dist/{square-YTl_L1_3.mjs → square-YnF15tkM.mjs} +1 -1
  15. package/dist/{trash-2-DCHugLVt.mjs → trash-2-dnzK3zvI.mjs} +1 -1
  16. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_import_alexa_page__remoteEntry_js-DMdgQOgz.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_import_alexa_page__remoteEntry_js-OqMWqeF3.mjs} +1 -1
  17. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -1818,7 +1818,7 @@ var Doc = class {
1818
1818
  };
1819
1819
  //#endregion
1820
1820
  //#region ../../node_modules/zod/v4/core/versions.js
1821
- var version = {
1821
+ var version$1 = {
1822
1822
  major: 4,
1823
1823
  minor: 4,
1824
1824
  patch: 3
@@ -1830,7 +1830,7 @@ var $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1830
1830
  inst ?? (inst = {});
1831
1831
  inst._zod.def = def;
1832
1832
  inst._zod.bag = inst._zod.bag || {};
1833
- inst._zod.version = version;
1833
+ inst._zod.version = version$1;
1834
1834
  const checks = [...inst._zod.def.checks ?? []];
1835
1835
  if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1836
1836
  for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
@@ -17610,7 +17610,22 @@ var BrokerProviderInfoSchema = object({
17610
17610
  */
17611
17611
  interactiveConnectPath: string().min(1).optional(),
17612
17612
  /** Relative hub path to disconnect the linked account (same popup pattern). */
17613
- interactiveDisconnectPath: string().min(1).optional()
17613
+ interactiveDisconnectPath: string().min(1).optional(),
17614
+ /**
17615
+ * The kind signs in through a server-held interactive session instead of
17616
+ * (or before) typed credentials. `basePath` is a hub-relative route set
17617
+ * served by the owning addon (`/addon/<id>/...`) speaking the sign-in
17618
+ * contract: `POST {basePath}/start` (body: the form's settings) answers
17619
+ * `{ sessionId, loginUrl }`; `GET {basePath}/status?sessionId=` answers
17620
+ * `{ phase: 'starting' | 'awaiting-login' | 'captured' | 'error' |
17621
+ * 'cancelled', loginUrl, error }`; `POST {basePath}/commit`
17622
+ * (`{ sessionId, name, brokerId? }`) stores the credentials on a new or
17623
+ * existing broker and answers `{ brokerId }`; `POST {basePath}/cancel`
17624
+ * (`{ sessionId }`) drops the session. The dialog that edits a broker
17625
+ * offers it as the default path; the fields the session fills are
17626
+ * marked `filledBySignIn` in the kind's settings schema.
17627
+ */
17628
+ signIn: object({ basePath: string().min(1) }).optional()
17614
17629
  }))
17615
17630
  });
17616
17631
  var ListInputSchema = object({
@@ -58050,7 +58065,8 @@ var BATTERY_DEVICE_TYPES = [
58050
58065
  DeviceType.Switch,
58051
58066
  DeviceType.PetFeeder,
58052
58067
  DeviceType.Container,
58053
- DeviceType.Thermostat
58068
+ DeviceType.Thermostat,
58069
+ DeviceType.EventEmitter
58054
58070
  ];
58055
58071
  /** Generic Customize target for the percentage reading (D936). */
58056
58072
  var batteryCustomize = {
@@ -64901,9 +64917,9 @@ var PowerMeterStatusSchema = object({
64901
64917
  /** Cumulative energy in kilowatt-hours since the meter was reset. */
64902
64918
  kwhTotal: number().optional().meta(readingMeta("energy", { label: "Energy" })),
64903
64919
  /** Voltage in volts. */
64904
- volts: number().optional().meta(readingMeta("voltage")),
64920
+ volts: number().optional().meta(readingMeta("voltage", { label: "Voltage" })),
64905
64921
  /** Current in amperes. */
64906
- amps: number().optional().meta(readingMeta("current")),
64922
+ amps: number().optional().meta(readingMeta("current", { label: "Current" })),
64907
64923
  /** Apparent power in volt-amperes. */
64908
64924
  va: number().optional().meta(readingMeta("apparent-power")),
64909
64925
  /** Power factor (0..1) if reported. */
@@ -64911,17 +64927,74 @@ var PowerMeterStatusSchema = object({
64911
64927
  /** Ms epoch when the slice was last updated. */
64912
64928
  lastFetchedAt: number()
64913
64929
  });
64930
+ /**
64931
+ * Loads that draw metered mains power (D951). The reading is a feature of the
64932
+ * device itself — a plug, a lamp, a fan, an air conditioner, a boiler, a
64933
+ * vacuum dock — not a separate sensor beside it. A `Sensor` stays: a clamp
64934
+ * meter or a standalone energy monitor IS the device. Cover, lock, valve,
64935
+ * camera and the like are left out: their draw is not what anyone meters.
64936
+ */
64937
+ var POWER_METER_DEVICE_TYPES = [
64938
+ DeviceType.Sensor,
64939
+ DeviceType.Switch,
64940
+ DeviceType.Light,
64941
+ DeviceType.Fan,
64942
+ DeviceType.Climate,
64943
+ DeviceType.Thermostat,
64944
+ DeviceType.Humidifier,
64945
+ DeviceType.WaterHeater,
64946
+ DeviceType.MediaPlayer,
64947
+ DeviceType.Washer,
64948
+ DeviceType.Dryer,
64949
+ DeviceType.Dishwasher,
64950
+ DeviceType.Vacuum,
64951
+ DeviceType.LawnMower,
64952
+ DeviceType.PetFeeder
64953
+ ];
64954
+ /** Everything but a bare `Sensor`: a sensor that takes its reading from another sensor adds nothing. */
64955
+ var POWER_METER_CUSTOMIZE_DEVICE_TYPES = POWER_METER_DEVICE_TYPES.filter((type) => type !== DeviceType.Sensor);
64956
+ /** One scalar target per reading; each is sourced from a device of its own (D951). */
64957
+ function powerTarget(id, unit) {
64958
+ return {
64959
+ id,
64960
+ cardinality: "scalar",
64961
+ vocabulary: {
64962
+ cap: "power-meter",
64963
+ stateField: id
64964
+ },
64965
+ deviceTypes: POWER_METER_CUSTOMIZE_DEVICE_TYPES,
64966
+ apply: "add",
64967
+ path: id,
64968
+ sources: [{
64969
+ kind: "numeric",
64970
+ requiredUnit: unit,
64971
+ transforms: [{ kind: "identity" }]
64972
+ }],
64973
+ companions: [{
64974
+ kind: "clock",
64975
+ path: "lastFetchedAt",
64976
+ when: "always"
64977
+ }],
64978
+ sourceReport: { status: "assignment-status" },
64979
+ advancedExpression: true
64980
+ };
64981
+ }
64982
+ /** "Power and energy" extension: watts, energy, voltage and current from other devices (D951). */
64983
+ var powerMeterCustomize = {
64984
+ version: 1,
64985
+ targets: [
64986
+ powerTarget("watts", "W"),
64987
+ powerTarget("kwhTotal", "kWh"),
64988
+ powerTarget("volts", "V"),
64989
+ powerTarget("amps", "A")
64990
+ ]
64991
+ };
64914
64992
  var powerMeterCapability = {
64915
64993
  name: "power-meter",
64916
64994
  scope: "device",
64917
64995
  deviceNative: true,
64918
64996
  mode: "singleton",
64919
- deviceTypes: [
64920
- DeviceType.Sensor,
64921
- DeviceType.Washer,
64922
- DeviceType.Dryer,
64923
- DeviceType.Dishwasher
64924
- ],
64997
+ deviceTypes: POWER_METER_DEVICE_TYPES,
64925
64998
  methods: {},
64926
64999
  status: {
64927
65000
  schema: PowerMeterStatusSchema,
@@ -64978,7 +65051,8 @@ var powerMeterCapability = {
64978
65051
  } },
64979
65052
  /** Clock fields: written, but excluded from the compare that decides
64980
65053
  * whether persisting is worth a SQLite commit. */
64981
- volatileStateFields: ["lastFetchedAt"]
65054
+ volatileStateFields: ["lastFetchedAt"],
65055
+ customize: powerMeterCustomize
64982
65056
  };
64983
65057
  /**
64984
65058
  * Presence cap. Models HA `person.*` and `device_tracker.*` entities
@@ -70366,7 +70440,7 @@ method(object({}), array(TrainingBaseModelSchema).readonly(), { auth: "admin" })
70366
70440
  });
70367
70441
  DeviceFeature.FanSpeed, DeviceFeature.FanPreset, DeviceFeature.FanDirection, DeviceFeature.FanOscillating, DeviceFeature.CoverPositionable, DeviceFeature.CoverTilt, DeviceFeature.ValvePositionable, DeviceFeature.MediaPlayerVolume, DeviceFeature.ClimateFanMode;
70368
70442
  SOURCE_CAPS.filter((cap) => cap !== "switch" && cap !== "motion");
70369
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Camera, DeviceType.Camera, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
70443
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Camera, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
70370
70444
  String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
70371
70445
  DeviceRole.BinarySensor, DeviceRole.MotionSensor;
70372
70446
  new Set(CAP_NAMES);
@@ -90089,37 +90163,78 @@ function toRecord(value) {
90089
90163
  function settingsToAlexaConnection(settings) {
90090
90164
  return alexaConnectionSchema.parse(toRecord(settings));
90091
90165
  }
90166
+ /**
90167
+ * Allowlist of real Amazon regional domains that alexa-remote2 is known to
90168
+ * support. An enum (not a free-form string) keeps the value from ever naming an
90169
+ * arbitrary host: alexa-remote2 uses it as a raw domain suffix.
90170
+ */
90171
+ var AMAZON_DOMAINS = [
90172
+ "amazon.com",
90173
+ "amazon.it",
90174
+ "amazon.de",
90175
+ "amazon.co.uk",
90176
+ "amazon.fr",
90177
+ "amazon.es",
90178
+ "amazon.ca",
90179
+ "amazon.com.au",
90180
+ "amazon.co.jp",
90181
+ "amazon.in",
90182
+ "amazon.com.br",
90183
+ "amazon.com.mx"
90184
+ ];
90185
+ /** The country each domain serves; the first match for a country prefills the form. */
90186
+ var AMAZON_DOMAIN_BY_COUNTRY = {
90187
+ US: "amazon.com",
90188
+ IT: "amazon.it",
90189
+ DE: "amazon.de",
90190
+ AT: "amazon.de",
90191
+ GB: "amazon.co.uk",
90192
+ FR: "amazon.fr",
90193
+ ES: "amazon.es",
90194
+ CA: "amazon.ca",
90195
+ AU: "amazon.com.au",
90196
+ JP: "amazon.co.jp",
90197
+ IN: "amazon.in",
90198
+ BR: "amazon.com.br",
90199
+ MX: "amazon.com.mx"
90200
+ };
90092
90201
  /** Hand-written connection form for the broker/integration creation UI. */
90093
90202
  function buildConnectionFormSchema() {
90094
90203
  return { sections: [{
90095
90204
  id: "alexa-account",
90096
90205
  title: "Amazon Alexa account",
90097
90206
  titleKey: "import-alexa:connection.s_alexa-account.title",
90098
- description: "Link an Amazon account via the unofficial Alexa client. Supply a captured cookie OR a refresh token. NOTE: this is an unofficial integration — Amazon can change or break it without notice, and it may violate Amazon ToS. State is polled, not pushed.",
90207
+ description: "Sign in with your Amazon account to link it. This is an unofficial integration: Amazon can change or break it without notice, and it may violate Amazon ToS. State is polled, not pushed.",
90099
90208
  descriptionKey: "import-alexa:connection.s_alexa-account.description",
90100
90209
  columns: 1,
90101
90210
  fields: [
90102
90211
  {
90103
- type: "text",
90212
+ type: "select",
90104
90213
  key: "amazonDomain",
90105
90214
  label: "Amazon domain (region)",
90106
90215
  labelKey: "import-alexa:connection.s_alexa-account.amazonDomain.label",
90107
- placeholder: "amazon.com",
90108
- default: "amazon.com"
90216
+ options: AMAZON_DOMAINS.map((value) => ({
90217
+ value,
90218
+ label: value
90219
+ })),
90220
+ default: "amazon.com",
90221
+ defaultByCountry: AMAZON_DOMAIN_BY_COUNTRY
90109
90222
  },
90110
90223
  {
90111
90224
  type: "password",
90112
90225
  key: "cookie",
90113
- label: "Cookie blob (from proxy login)",
90226
+ label: "Cookie blob (filled by the sign-in)",
90114
90227
  labelKey: "import-alexa:connection.s_alexa-account.cookie.label",
90115
- showToggle: true
90228
+ showToggle: true,
90229
+ filledBySignIn: true
90116
90230
  },
90117
90231
  {
90118
90232
  type: "password",
90119
90233
  key: "refreshToken",
90120
- label: "Refresh token (alternative to cookie)",
90234
+ label: "Refresh token (alternative to the sign-in)",
90121
90235
  labelKey: "import-alexa:connection.s_alexa-account.refreshToken.label",
90122
- showToggle: true
90236
+ showToggle: true,
90237
+ filledBySignIn: true
90123
90238
  },
90124
90239
  {
90125
90240
  type: "number",
@@ -128718,7 +128833,7 @@ var require_alexa_cookie = /* @__PURE__ */ __commonJSMin(((exports, module) => {
128718
128833
  module.exports = AlexaCookie();
128719
128834
  }));
128720
128835
  //#endregion
128721
- //#region src/alexa-proxy-login.ts
128836
+ //#region ../../node_modules/alexa-remote2/package.json
128722
128837
  var import_alexa_remote = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
128723
128838
  var https = __require("https");
128724
128839
  var querystring = __require("querystring");
@@ -131336,6 +131451,76 @@ var import_alexa_remote = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin
131336
131451
  };
131337
131452
  module.exports = AlexaRemote;
131338
131453
  })))());
131454
+ //#endregion
131455
+ //#region src/alexa-api-user-agent.ts
131456
+ /**
131457
+ * The `apiUserAgentPostfix` handed to every `alexa-remote2` `init`.
131458
+ *
131459
+ * Left unset, the library computes it with
131460
+ * `require(path.join(__dirname, 'package.json'))`. Bundled into `dist/addon.js`
131461
+ * that resolves to the addon's own `dist/`, where no `package.json` exists, and
131462
+ * `init` throws "Cannot find module …/dist/package.json". Setting it here keeps
131463
+ * the library's own value (`AlexaRemote/<version>`), read at build time.
131464
+ */
131465
+ var ALEXA_API_USER_AGENT_POSTFIX = `AlexaRemote/${{
131466
+ name: "alexa-remote2",
131467
+ version: "8.0.4",
131468
+ description: "Remote Control for amazon echo devices",
131469
+ author: {
131470
+ "name": "Apollon77",
131471
+ "email": "iobroker@fischer-ka.de"
131472
+ },
131473
+ contributors: [
131474
+ {
131475
+ "name": "soef",
131476
+ "email": "soef@gmx.net"
131477
+ },
131478
+ {
131479
+ "name": "Apollon77",
131480
+ "email": "iobroker@fischer-ka.de"
131481
+ },
131482
+ {
131483
+ "name": "bbindreiter",
131484
+ "email": "bernd.bindreiter@gmail.com"
131485
+ }
131486
+ ],
131487
+ homepage: "https://github.com/Apollon77/alexa-remote",
131488
+ license: "MIT",
131489
+ keywords: [
131490
+ "alexa",
131491
+ "echo",
131492
+ "alexa remote",
131493
+ "layla.amazon.de"
131494
+ ],
131495
+ dependencies: {
131496
+ "alexa-cookie2": "^5.0.3",
131497
+ "https": "^1.0.0",
131498
+ "querystring": "^0.2.1",
131499
+ "ws": "^8.18.3",
131500
+ "extend": "^3.0.2",
131501
+ "uuid": "^11.1.0"
131502
+ },
131503
+ devDependencies: {
131504
+ "@alcalzone/release-script": "^5.0.0",
131505
+ "@alcalzone/release-script-plugin-license": "^4.0.0",
131506
+ "eslint": "^8.57.1"
131507
+ },
131508
+ scripts: {
131509
+ "test": "node node_modules/mocha/bin/mocha",
131510
+ "release": "release-script"
131511
+ },
131512
+ repository: {
131513
+ "type": "git",
131514
+ "url": "git+https://github.com/Apollon77/alexa-remote.git"
131515
+ },
131516
+ bugs: { "url": "https://github.com/Apollon77/alexa-remote/issues" },
131517
+ engines: { "node": ">=16.0.0" },
131518
+ types: "alexa-remote.d.ts",
131519
+ main: "alexa-remote.js",
131520
+ readmeFilename: "readme.md"
131521
+ }.version}`;
131522
+ //#endregion
131523
+ //#region src/alexa-proxy-login.ts
131339
131524
  /**
131340
131525
  * A single interactive proxy-login attempt. One instance = one Amazon login.
131341
131526
  * Construct → {@link start} → poll {@link getStatus} → on `captured` the
@@ -131392,6 +131577,7 @@ var AlexaProxyLoginSession = class {
131392
131577
  proxyPort: this.#opts.proxyPort,
131393
131578
  proxyLogLevel: "warn",
131394
131579
  amazonPage,
131580
+ apiUserAgentPostfix: ALEXA_API_USER_AGENT_POSTFIX,
131395
131581
  logger: (...args) => {
131396
131582
  const line = args.map(String).join(" ");
131397
131583
  if (SECRET_LINE_RE.test(line)) return;
@@ -131610,20 +131796,25 @@ function capturedToCookieString(captured) {
131610
131796
  }
131611
131797
  //#endregion
131612
131798
  //#region src/alexa-login-routes.ts
131613
- var StartBodySchema = object({ amazonDomain: _enum([
131614
- "amazon.com",
131615
- "amazon.it",
131616
- "amazon.de",
131617
- "amazon.co.uk",
131618
- "amazon.fr",
131619
- "amazon.es",
131620
- "amazon.ca",
131621
- "amazon.com.au",
131622
- "amazon.co.jp",
131623
- "amazon.in",
131624
- "amazon.com.br",
131625
- "amazon.com.mx"
131626
- ]).default("amazon.com") });
131799
+ /**
131800
+ * `addon-routes` control plane that drives the INTERACTIVE Amazon login from the
131801
+ * broker dialog (the kind's `signIn` contract). All routes are `admin` — they start a proxy server and
131802
+ * mutate broker credentials, so they require an admin session/scoped token (the
131803
+ * hub enforces this BEFORE the handler runs; see `main.ts` `/addon/:addonId/*`).
131804
+ *
131805
+ * Public URLs (hub reachable as `https://<hub>`):
131806
+ * POST /addon/import-alexa/login/start { amazonDomain } → { sessionId, loginUrl }
131807
+ * GET /addon/import-alexa/login/status?sessionId=… → AlexaProxyLoginStatus (no secrets)
131808
+ * POST /addon/import-alexa/login/commit { sessionId, name, brokerId? } → { brokerId }
131809
+ * POST /addon/import-alexa/login/cancel { sessionId } → { ok: true }
131810
+ *
131811
+ * The wizard flow: POST /login/start → render a "Login to Amazon" button linking
131812
+ * to `loginUrl` (opened in a new tab) → poll /login/status until
131813
+ * `phase === 'captured'` → POST /login/commit to persist the cookie onto a new
131814
+ * or existing broker → proceed to device discovery/adoption.
131815
+ */
131816
+ /** The broker dialog posts the whole form; only the region matters here (other keys are ignored). */
131817
+ var StartBodySchema = object({ amazonDomain: _enum(AMAZON_DOMAINS).default("amazon.com") });
131627
131818
  var StatusQuerySchema = object({ sessionId: string().min(1) });
131628
131819
  var CommitBodySchema = object({
131629
131820
  sessionId: string().min(1),
@@ -132106,12 +132297,14 @@ var AlexaRemoteClient = class {
132106
132297
  if (persisted !== null) return {
132107
132298
  cookie: persisted.cookieData,
132108
132299
  proxyOnly: false,
132109
- amazonPage
132300
+ amazonPage,
132301
+ apiUserAgentPostfix: ALEXA_API_USER_AGENT_POSTFIX
132110
132302
  };
132111
132303
  if (creds.cookie !== void 0 && creds.cookie.length > 0) return {
132112
132304
  cookie: parseCookieMaterial(creds.cookie),
132113
132305
  proxyOnly: false,
132114
- amazonPage
132306
+ amazonPage,
132307
+ apiUserAgentPostfix: ALEXA_API_USER_AGENT_POSTFIX
132115
132308
  };
132116
132309
  if (creds.refreshToken !== void 0 && creds.refreshToken.length > 0) throw new AlexaAuthError("a bare refresh token is not sufficient — supply the full cookie / cookieData blob captured by the alexa-remote2 proxy login (it embeds the refresh token)");
132117
132310
  throw new AlexaAuthError("no cookie or cookieData blob configured for this account");
@@ -132727,7 +132920,8 @@ function buildAlexaBrokerProvider(deps) {
132727
132920
  addonId: ownerAddonId,
132728
132921
  kinds: [{
132729
132922
  kind: ALEXA_KIND,
132730
- label: "Alexa Import"
132923
+ label: "Alexa Import",
132924
+ signIn: { basePath: "/addon/import-alexa/login" }
132731
132925
  }]
132732
132926
  }],
132733
132927
  add: async ({ kind, name, settings }) => {
@@ -36,7 +36,7 @@ async function r() {
36
36
  }
37
37
  },
38
38
  "@camstack/types": {
39
- version: "1.2.424",
39
+ version: "1.2.427",
40
40
  scope: "default",
41
41
  shareConfig: {
42
42
  singleton: !0,
@@ -1,6 +1,6 @@
1
1
  import { S as e, d as t, u as n, v as r } from "./_virtual_mf___mfe_internal__addon_import_alexa_page__loadShare__react__loadShare__.js-DwXXYAlk.mjs";
2
2
  import { n as i, r as a, t as o } from "./_virtual_mf___mfe_internal__addon_import_alexa_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-CUiVYNMY.mjs";
3
- import { h as s, m as c } from "./responsive-B82v3AbM.mjs";
3
+ import { h as s, m as c } from "./responsive-CLpz8rKp.mjs";
4
4
  var l = s("chevron-down", [["path", {
5
5
  d: "m6 9 6 6 6-6",
6
6
  key: "qrunsl"
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_import_alexa_page__remoteEntry_js-DMdgQOgz.mjs";
1
+ import { n as e, t } from "./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_import_alexa_page__remoteEntry_js-OqMWqeF3.mjs";
2
2
  export { t as get, e as init };
@@ -1,6 +1,6 @@
1
1
  import { S as e, d as t, g as n, i as r, l as i, n as a, r as o, u as s, v as c, y as l } from "./_virtual_mf___mfe_internal__addon_import_alexa_page__loadShare__react__loadShare__.js-DwXXYAlk.mjs";
2
2
  import "./_virtual_mf___mfe_internal__addon_import_alexa_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-CUiVYNMY.mjs";
3
- import { c as u } from "./_virtual_mf___mfe_internal__addon_import_alexa_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Msberbw_.mjs";
3
+ import { c as u } from "./_virtual_mf___mfe_internal__addon_import_alexa_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BU5ExEvB.mjs";
4
4
  //#region ../../node_modules/lucide-react/dist/esm/shared/src/utils/mergeClasses.js
5
5
  e();
6
6
  var d = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), f = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), p = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), m = (e) => {
@@ -1,6 +1,6 @@
1
1
  import { S as e, g as t, l as n, v as r } from "./_virtual_mf___mfe_internal__addon_import_alexa_page__loadShare__react__loadShare__.js-DwXXYAlk.mjs";
2
2
  import { n as i } from "./ui-text-B5YO4hoJ.mjs";
3
- import { h as a } from "./responsive-B82v3AbM.mjs";
3
+ import { h as a } from "./responsive-CLpz8rKp.mjs";
4
4
  var o = a("camera", [["path", {
5
5
  d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",
6
6
  key: "18u6gg"
@@ -1,4 +1,4 @@
1
- import { h as e } from "./responsive-B82v3AbM.mjs";
1
+ import { h as e } from "./responsive-CLpz8rKp.mjs";
2
2
  var t = e("eye-off", [
3
3
  ["path", {
4
4
  d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
@@ -1,4 +1,4 @@
1
- import { h as e } from "./responsive-B82v3AbM.mjs";
1
+ import { h as e } from "./responsive-CLpz8rKp.mjs";
2
2
  var t = e("trash-2", [
3
3
  ["path", {
4
4
  d: "M10 11v6",
@@ -2753,7 +2753,7 @@ async function rr(e) {
2753
2753
  }
2754
2754
  }
2755
2755
  async function ir() {
2756
- return tr ||= rr(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_import_alexa_page-CcQjQJmj.mjs")).catch((e) => {
2756
+ return tr ||= rr(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_import_alexa_page-Yxzd8sJD.mjs")).catch((e) => {
2757
2757
  throw tr = void 0, e;
2758
2758
  }), tr;
2759
2759
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-import-alexa",
3
- "version": "0.2.151",
3
+ "version": "0.2.153",
4
4
  "description": "Alexa device-import provider for CamStack — imports the smart-home devices in a user's Alexa account via the unofficial alexa-remote2 cookie/token client (the inverse of the Alexa exporter)",
5
5
  "keywords": [
6
6
  "camstack",