diff --git a/dist/autofill-debug.js b/dist/autofill-debug.js index d16d2f277..6d11d7f40 100644 --- a/dist/autofill-debug.js +++ b/dist/autofill-debug.js @@ -9282,7 +9282,10 @@ class InterfacePrototype { password: this.passwordGenerator.password, username: this.emailProtection.lastGenerated }); - this.storeFormData(formData, 'formSubmission'); + + // If credentials has only username field, and no password field, then trigger is a partialSave + const trigger = formData.credentials?.username && !formData.credentials?.password ? 'partialSave' : 'formSubmission'; + this.storeFormData(formData, trigger); } } @@ -11890,7 +11893,7 @@ const shouldStoreCredentials = _ref3 => { let { credentials } = _ref3; - return Boolean(credentials.password); + return Boolean(credentials.password) || Boolean(credentials.username); }; /** @@ -17413,7 +17416,8 @@ const wasAutofilledByChrome = input => { */ exports.wasAutofilledByChrome = wasAutofilledByChrome; function shouldLog() { - return readDebugSetting('ddg-autofill-debug'); + return true; + // return readDebugSetting('ddg-autofill-debug'); } /** @@ -18196,7 +18200,7 @@ const getAutofillDataResponseSchema = exports.getAutofillDataResponseSchema = _z }); const storeFormDataSchema = exports.storeFormDataSchema = _zod.z.object({ credentials: outgoingCredentialsSchema.optional(), - trigger: _zod.z.union([_zod.z.literal("formSubmission"), _zod.z.literal("passwordGeneration"), _zod.z.literal("emailProtection")]).optional() + trigger: _zod.z.union([_zod.z.literal("partialSave"), _zod.z.literal("formSubmission"), _zod.z.literal("passwordGeneration"), _zod.z.literal("emailProtection")]).optional() }); const getAvailableInputTypesResultSchema = exports.getAvailableInputTypesResultSchema = _zod.z.object({ type: _zod.z.literal("getAvailableInputTypesResponse").optional(), diff --git a/dist/autofill.js b/dist/autofill.js index c7063a2ef..ecc9b8b76 100644 --- a/dist/autofill.js +++ b/dist/autofill.js @@ -5116,7 +5116,10 @@ class InterfacePrototype { password: this.passwordGenerator.password, username: this.emailProtection.lastGenerated }); - this.storeFormData(formData, 'formSubmission'); + + // If credentials has only username field, and no password field, then trigger is a partialSave + const trigger = formData.credentials?.username && !formData.credentials?.password ? 'partialSave' : 'formSubmission'; + this.storeFormData(formData, trigger); } } @@ -7724,7 +7727,7 @@ const shouldStoreCredentials = _ref3 => { let { credentials } = _ref3; - return Boolean(credentials.password); + return Boolean(credentials.password) || Boolean(credentials.username); }; /** @@ -13247,7 +13250,8 @@ const wasAutofilledByChrome = input => { */ exports.wasAutofilledByChrome = wasAutofilledByChrome; function shouldLog() { - return readDebugSetting('ddg-autofill-debug'); + return true; + // return readDebugSetting('ddg-autofill-debug'); } /** diff --git a/src/DeviceInterface/InterfacePrototype.js b/src/DeviceInterface/InterfacePrototype.js index afeb0531d..a37abb3ec 100644 --- a/src/DeviceInterface/InterfacePrototype.js +++ b/src/DeviceInterface/InterfacePrototype.js @@ -806,7 +806,10 @@ class InterfacePrototype { password: this.passwordGenerator.password, username: this.emailProtection.lastGenerated, }); - this.storeFormData(formData, 'formSubmission'); + + // If credentials has only username field, and no password field, then trigger is a partialSave + const trigger = formData.credentials?.username && !formData.credentials?.password ? 'partialSave' : 'formSubmission'; + this.storeFormData(formData, trigger); } } diff --git a/src/Form/formatters.js b/src/Form/formatters.js index a9ad6eb02..bf4563ec8 100644 --- a/src/Form/formatters.js +++ b/src/Form/formatters.js @@ -163,7 +163,7 @@ const getMMAndYYYYFromString = (expiration) => { * @param {InternalDataStorageObject} credentials * @return {boolean} */ -const shouldStoreCredentials = ({ credentials }) => Boolean(credentials.password); +const shouldStoreCredentials = ({ credentials }) => Boolean(credentials.password) || Boolean(credentials.username); /** * @param {InternalDataStorageObject} credentials diff --git a/src/autofill-utils.js b/src/autofill-utils.js index 5a4984052..09255eb0a 100644 --- a/src/autofill-utils.js +++ b/src/autofill-utils.js @@ -426,7 +426,8 @@ const wasAutofilledByChrome = (input) => { * @returns {boolean} */ function shouldLog() { - return readDebugSetting('ddg-autofill-debug'); + return true; + // return readDebugSetting('ddg-autofill-debug'); } /** diff --git a/src/device-interface.d.ts b/src/device-interface.d.ts index d16fd88a1..1d03ef557 100644 --- a/src/device-interface.d.ts +++ b/src/device-interface.d.ts @@ -71,7 +71,7 @@ interface DataStorageObject { credentials?: CredentialsObject; creditCards?: CreditCardObject; identities?: IdentityObject; - trigger?: 'partialFormSave' | 'formSubmission' | 'passwordGeneration' | 'emailProtection'; + trigger?: 'partialSave' | 'formSubmission' | 'passwordGeneration' | 'emailProtection'; } interface InternalDataStorageObject { diff --git a/src/deviceApiCalls/__generated__/validators-ts.ts b/src/deviceApiCalls/__generated__/validators-ts.ts index 178d7b2bf..c759e2481 100644 --- a/src/deviceApiCalls/__generated__/validators-ts.ts +++ b/src/deviceApiCalls/__generated__/validators-ts.ts @@ -395,7 +395,7 @@ export interface UserPreferences { */ export interface StoreFormData { credentials?: OutgoingCredentials; - trigger?: "formSubmission" | "passwordGeneration" | "emailProtection"; + trigger?: "partialSave" | "formSubmission" | "passwordGeneration" | "emailProtection"; } export interface OutgoingCredentials { /** diff --git a/src/deviceApiCalls/__generated__/validators.zod.js b/src/deviceApiCalls/__generated__/validators.zod.js index a2ffc7de2..0ca4538d5 100644 --- a/src/deviceApiCalls/__generated__/validators.zod.js +++ b/src/deviceApiCalls/__generated__/validators.zod.js @@ -233,7 +233,7 @@ export const getAutofillDataResponseSchema = z.object({ export const storeFormDataSchema = z.object({ credentials: outgoingCredentialsSchema.optional(), - trigger: z.union([z.literal("formSubmission"), z.literal("passwordGeneration"), z.literal("emailProtection")]).optional() + trigger: z.union([z.literal("partialSave"), z.literal("formSubmission"), z.literal("passwordGeneration"), z.literal("emailProtection")]).optional() }); export const getAvailableInputTypesResultSchema = z.object({ diff --git a/src/deviceApiCalls/schemas/storeFormData.params.json b/src/deviceApiCalls/schemas/storeFormData.params.json index 1c68e9ce1..8b86c5573 100644 --- a/src/deviceApiCalls/schemas/storeFormData.params.json +++ b/src/deviceApiCalls/schemas/storeFormData.params.json @@ -23,10 +23,11 @@ "trigger": { "type": "string", "enum": [ + "partialSave", "formSubmission", "passwordGeneration", "emailProtection" ] } } -} +} \ No newline at end of file diff --git a/swift-package/Resources/assets/autofill-debug.js b/swift-package/Resources/assets/autofill-debug.js index d16d2f277..6d11d7f40 100644 --- a/swift-package/Resources/assets/autofill-debug.js +++ b/swift-package/Resources/assets/autofill-debug.js @@ -9282,7 +9282,10 @@ class InterfacePrototype { password: this.passwordGenerator.password, username: this.emailProtection.lastGenerated }); - this.storeFormData(formData, 'formSubmission'); + + // If credentials has only username field, and no password field, then trigger is a partialSave + const trigger = formData.credentials?.username && !formData.credentials?.password ? 'partialSave' : 'formSubmission'; + this.storeFormData(formData, trigger); } } @@ -11890,7 +11893,7 @@ const shouldStoreCredentials = _ref3 => { let { credentials } = _ref3; - return Boolean(credentials.password); + return Boolean(credentials.password) || Boolean(credentials.username); }; /** @@ -17413,7 +17416,8 @@ const wasAutofilledByChrome = input => { */ exports.wasAutofilledByChrome = wasAutofilledByChrome; function shouldLog() { - return readDebugSetting('ddg-autofill-debug'); + return true; + // return readDebugSetting('ddg-autofill-debug'); } /** @@ -18196,7 +18200,7 @@ const getAutofillDataResponseSchema = exports.getAutofillDataResponseSchema = _z }); const storeFormDataSchema = exports.storeFormDataSchema = _zod.z.object({ credentials: outgoingCredentialsSchema.optional(), - trigger: _zod.z.union([_zod.z.literal("formSubmission"), _zod.z.literal("passwordGeneration"), _zod.z.literal("emailProtection")]).optional() + trigger: _zod.z.union([_zod.z.literal("partialSave"), _zod.z.literal("formSubmission"), _zod.z.literal("passwordGeneration"), _zod.z.literal("emailProtection")]).optional() }); const getAvailableInputTypesResultSchema = exports.getAvailableInputTypesResultSchema = _zod.z.object({ type: _zod.z.literal("getAvailableInputTypesResponse").optional(), diff --git a/swift-package/Resources/assets/autofill.js b/swift-package/Resources/assets/autofill.js index c7063a2ef..ecc9b8b76 100644 --- a/swift-package/Resources/assets/autofill.js +++ b/swift-package/Resources/assets/autofill.js @@ -5116,7 +5116,10 @@ class InterfacePrototype { password: this.passwordGenerator.password, username: this.emailProtection.lastGenerated }); - this.storeFormData(formData, 'formSubmission'); + + // If credentials has only username field, and no password field, then trigger is a partialSave + const trigger = formData.credentials?.username && !formData.credentials?.password ? 'partialSave' : 'formSubmission'; + this.storeFormData(formData, trigger); } } @@ -7724,7 +7727,7 @@ const shouldStoreCredentials = _ref3 => { let { credentials } = _ref3; - return Boolean(credentials.password); + return Boolean(credentials.password) || Boolean(credentials.username); }; /** @@ -13247,7 +13250,8 @@ const wasAutofilledByChrome = input => { */ exports.wasAutofilledByChrome = wasAutofilledByChrome; function shouldLog() { - return readDebugSetting('ddg-autofill-debug'); + return true; + // return readDebugSetting('ddg-autofill-debug'); } /**