Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views6 pages

Chrome Pronpt

The document contains code snippets related to Chrome storage operations and handling user preferences in a web application. It includes functions for retrieving and updating user profile settings, managing alerts, and handling various silence configurations. The code also utilizes React hooks for state management and context usage.

Uploaded by

Rivail Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Chrome Pronpt

The document contains code snippets related to Chrome storage operations and handling user preferences in a web application. It includes functions for retrieving and updating user profile settings, managing alerts, and handling various silence configurations. The code also utilizes React hooks for state management and context usage.

Uploaded by

Rivail Silva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

)),

chrome.storage[t].get(e).then((function(t) {

c(t[e])

)).catch((function(e) {

console.error("Chrome storage local get error: ", e)

))

), [e, t]),

listenerData: o,

currentData: l

, or = function(e) {

return rr(e, "local")

, ir = function(e) {

return rr(e, "sync")

, ar = (0,

u.createContext)({})

, sr = function() {

return (0,

u.useContext)(ar)

}
, lr = function() {

return ir("profile")

};

function ur(e) {

var t;

return null === (t = ut.find((function(t) {

return t.value === e

))) || void 0 === t ? void 0 : t.text

var cr, dr = function(e) {

var t = e.paramName

, n = e.value;

return "silence_duration_minutes" === t ? {

title: "Sucesso",

message: "Ao fechar o pin flutuante ele n\xe3o aparecer\xe1 por


".concat(ur(n)),

severity: "success"

}:{

title: "Sucesso",

message: n ? "Informa\xe7\xe3o salva com sucesso!" : "Desabilitado com


sucesso!",

severity: "success"

};

function fr() {

var e = sr()

, t = e.cachedProfile

, n = e.setProfile
, r = W().token

, o = at().openAlert

, i = (0,

u.useCallback)((function(e) {

var i = e.paramName

, a = e.value;

null !== t && void 0 !== t && t.profile && ((cr = chrome.runtime.connect({

name: "PREFERENCES"

})).postMessage({

type: nr.updatePinConfig,

data: {

token: r,

paramName: i,

value: a

}),

cr.onMessage.addListener((function(e) {

var r;

if (e.status < 200 || e.status > 299)

return null === o || void 0 === o ? void 0 : o({

title: "Erro",

message: e.message,

severity: "error"

});

null === o || void 0 === o || o(dr({

paramName: i,

value: a

})),
null === n || void 0 === n || n(x(x({}, t), {}, {

profile: x(x({}, t.profile), {}, {

extension_pin_config: x(x({}, null === t || void 0 === t || null === (r =


t.profile) || void 0 === r ? void 0 : r.extension_pin_config), {}, (0,

y.Z)({}, i, a))

})

}))

)),

cr.onDisconnect.addListener((function() {

cr = null

)))

), [t, o, n, r]);

return {

handleUpdatePinConfig: i

var pr = ["silence_twenty_four", "silence_site", "silence_not_discount"]

, hr = {

silence_twenty_four: {

text: "Silenciar por 24 horas",

area: B.TWENTY_FOUR_HOURS

},

silence_site: {

text: "Silenciar este site",

area: B.SILENCE_SITE
},

silence_not_discount: {

text: "Silenciar sites sem descontos",

area: B.SILENCE_NOT_DISCOUNT

};

var mr = function(e) {

var t, n, r, o, i, s, l, c, d = e.triggerEvent, f = e.silencePin, p = e.setActive, m =


fr().handleUpdatePinConfig, g = sr().cachedProfile, y = xe().extractedSubdomainUrl, b =
(0,

u.useCallback)((function() {

f(ce),

p(!1)

), [p, f]), x = (0,

u.useCallback)((function() {

var e, t;

m({

paramName: "show_only_stores_with_offers",

value: !(null !== g && void 0 !== g && null !== (e = g.profile) && void 0 !== e
&& null !== (t = e.extension_pin_config) && void 0 !== t &&
t.show_only_stores_with_offers)

}),

p(!1)

), [null === g || void 0 === g || null === (t = g.profile) || void 0 === t || null ===
(n = t.extension_pin_config) || void 0 === n ? void 0 : n.show_only_stores_with_offers,
m, p]), _ = (0,

u.useCallback)((function() {
var e, t, n, r = null !== (e = null === g || void 0 === g || null === (t = g.profile)
|| void 0 === t || null === (n = t.extension_pin_config) || void 0 === n ? void 0 :
n.blocked_domain_list) && void 0 !== e ? e : [];

if (!r.includes(y)) {

var o = [].concat((0,

ot.Z)(r), [y]);

m({

paramName: "blocked_domain_list",

value: o

})

p(!1)

You might also like