@ordergroove/offers 2.49.0 → 2.49.1-alpha-PR-1517-4.76
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.
package/dist/offers.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../node_modules/throttle-debounce/throttle.js", "../node_modules/throttle-debounce/debounce.js", "../node_modules/lodash.memoize/index.js", "../node_modules/murmurhash-js/murmurhash3_gc.js", "../node_modules/murmurhash-js/murmurhash2_gc.js", "../node_modules/murmurhash-js/index.js", "../node_modules/logical-expression-parser/token-type.js", "../node_modules/logical-expression-parser/tokenizer.js", "../node_modules/logical-expression-parser/polish.js", "../node_modules/logical-expression-parser/node.js", "../node_modules/logical-expression-parser/index.js", "../src/index.js", "../node_modules/symbol-observable/es/ponyfill.js", "../node_modules/symbol-observable/es/index.js", "../node_modules/redux/es/redux.js", "../../../node_modules/redux-thunk/es/index.js", "../src/core/localStorage.js", "../../auth/src/index.js", "../src/core/constants.js", "../src/core/api.js", "../src/platform.ts", "../node_modules/reselect/es/index.js", "../src/core/selectors.ts", "../src/shopify/utils.ts", "../src/core/utils.ts", "../src/core/actions.js", "../src/core/middleware.js", "../src/core/waitUntilOffersReady.js", "../src/core/offerRequest.js", "../src/core/experiments.js", "../src/core/store.js", "../../offers-live-editor/src/core/createIsMessageAllowed.js", "../../offers-live-editor/src/index.js", "../src/core/connect.js", "../src/core/adapters.js", "../node_modules/lit-html/src/lib/dom.ts", "../node_modules/lit-html/src/lib/template.ts", "../node_modules/lit-html/src/lib/modify-template.ts", "../node_modules/lit-html/src/lib/directive.ts", "../node_modules/lit-html/src/lib/part.ts", "../node_modules/lit-html/src/lib/template-instance.ts", "../node_modules/lit-html/src/lib/template-result.ts", "../node_modules/lit-html/src/lib/parts.ts", "../node_modules/lit-html/src/lib/template-factory.ts", "../node_modules/lit-html/src/lib/render.ts", "../node_modules/lit-html/src/lib/default-template-processor.ts", "../node_modules/lit-html/src/lit-html.ts", "../node_modules/lit-html/src/lib/shady-render.ts", "../node_modules/lit-element/src/lib/updating-element.ts", "../node_modules/lit-element/src/lib/decorators.ts", "../node_modules/lit-element/src/lib/css-tag.ts", "../node_modules/lit-element/src/lit-element.ts", "../src/components/When.js", "../src/core/resolveProperties.js", "../src/core/descriptors.js", "../src/core/props.js", "../src/core/base.js", "../src/components/OptinStatus.js", "../src/components/OptinButton.js", "../src/components/OptoutButton.js", "../src/components/FrequencyStatus.js", "../src/components/OptinSelect.js", "../src/components/UpsellButton.js", "../src/components/UpsellModal.js", "../src/components/OptinToggle.js", "../src/components/Text.js", "../src/components/IncentiveText.js", "../node_modules/lit-html/src/directives/unsafe-html.ts", "../src/components/BenefitMessages.js", "../src/components/SelectFrequency.js", "../src/core/dateUtils.js", "../src/components/NextUpcomingOrder.js", "../src/components/Offer.js", "../src/core/actions-preview.js", "../src/components/Modal.js", "../node_modules/lit-html/src/directives/if-defined.ts", "../src/components/Select.js", "../src/components/Tooltip.js", "../src/components/PrepaidStatus.js", "../src/components/PrepaidToggle.js", "../src/components/PrepaidData.js", "../src/components/PrepaidButton.js", "../src/components/PrepaidSelect.js", "../src/components/SubscriptionButton.js", "../src/components/TestWizard.js", "../src/run-tests.js", "../src/test-mode.js", "../src/components/Price.js", "../src/make-api.js", "../src/core/reducer.ts", "../src/shopify/reducers/productPlans.ts", "../src/shopify/reducers/config.ts", "../src/shopify/shopifyReducer.ts", "../src/shopify/shopifyMiddleware.ts", "../src/shopify/shopifyTrackingMiddleware.ts", "../src/shopify/shopifyBootstrap.ts"],
|
|
4
|
-
"sourcesContent": ["/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the\n * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time\n * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,\n * the internal counter is reset).\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the throttled-function is executed.\n * @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),\n * schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nexport default function(delay, noTrailing, callback, debounceMode) {\n\t/*\n\t * After wrapper has stopped being called, this timeout ensures that\n\t * `callback` is executed at the proper times in `throttle` and `end`\n\t * debounce modes.\n\t */\n\tlet timeoutID;\n\tlet cancelled = false;\n\n\t// Keep track of the last time `callback` was executed.\n\tlet lastExec = 0;\n\n\t// Function to clear existing timeout\n\tfunction clearExistingTimeout() {\n\t\tif (timeoutID) {\n\t\t\tclearTimeout(timeoutID);\n\t\t}\n\t}\n\n\t// Function to cancel next exec\n\tfunction cancel() {\n\t\tclearExistingTimeout();\n\t\tcancelled = true;\n\t}\n\n\t// `noTrailing` defaults to falsy.\n\tif (typeof noTrailing !== 'boolean') {\n\t\tdebounceMode = callback;\n\t\tcallback = noTrailing;\n\t\tnoTrailing = undefined;\n\t}\n\n\t/*\n\t * The `wrapper` function encapsulates all of the throttling / debouncing\n\t * functionality and when executed will limit the rate at which `callback`\n\t * is executed.\n\t */\n\tfunction wrapper(...arguments_) {\n\t\tlet self = this;\n\t\tlet elapsed = Date.now() - lastExec;\n\n\t\tif (cancelled) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Execute `callback` and update the `lastExec` timestamp.\n\t\tfunction exec() {\n\t\t\tlastExec = Date.now();\n\t\t\tcallback.apply(self, arguments_);\n\t\t}\n\n\t\t/*\n\t\t * If `debounceMode` is true (at begin) this is used to clear the flag\n\t\t * to allow future `callback` executions.\n\t\t */\n\t\tfunction clear() {\n\t\t\ttimeoutID = undefined;\n\t\t}\n\n\t\tif (debounceMode && !timeoutID) {\n\t\t\t/*\n\t\t\t * Since `wrapper` is being called for the first time and\n\t\t\t * `debounceMode` is true (at begin), execute `callback`.\n\t\t\t */\n\t\t\texec();\n\t\t}\n\n\t\tclearExistingTimeout();\n\n\t\tif (debounceMode === undefined && elapsed > delay) {\n\t\t\t/*\n\t\t\t * In throttle mode, if `delay` time has been exceeded, execute\n\t\t\t * `callback`.\n\t\t\t */\n\t\t\texec();\n\t\t} else if (noTrailing !== true) {\n\t\t\t/*\n\t\t\t * In trailing throttle mode, since `delay` time has not been\n\t\t\t * exceeded, schedule `callback` to execute `delay` ms after most\n\t\t\t * recent execution.\n\t\t\t *\n\t\t\t * If `debounceMode` is true (at begin), schedule `clear` to execute\n\t\t\t * after `delay` ms.\n\t\t\t *\n\t\t\t * If `debounceMode` is false (at end), schedule `callback` to\n\t\t\t * execute after `delay` ms.\n\t\t\t */\n\t\t\ttimeoutID = setTimeout(\n\t\t\t\tdebounceMode ? clear : exec,\n\t\t\t\tdebounceMode === undefined ? delay - elapsed : delay\n\t\t\t);\n\t\t}\n\t}\n\n\twrapper.cancel = cancel;\n\n\t// Return the wrapper function.\n\treturn wrapper;\n}\n", "/* eslint-disable no-undefined */\n\nimport throttle from './throttle';\n\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n *\n * @returns {Function} A new, debounced function.\n */\nexport default function(delay, atBegin, callback) {\n\treturn callback === undefined\n\t\t? throttle(delay, atBegin, false)\n\t\t: throttle(delay, callback, atBegin !== false);\n}\n", "/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Checks if `value` is a host object in IE < 9.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\n */\nfunction isHostObject(value) {\n // Many host objects are `Object` objects that can coerce to strings\n // despite having improperly defined `toString` methods.\n var result = false;\n if (value != null && typeof value.toString != 'function') {\n try {\n result = !!(value + '');\n } catch (e) {}\n }\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n return this.has(key) && delete this.__data__[key];\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n return getMapData(this, key)['delete'](key);\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n getMapData(this, key).set(key, value);\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to process.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result);\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Assign cache to `_.memoize`.\nmemoize.Cache = MapCache;\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = memoize;\n", "/**\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\n * \n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n * \n * @param {string} key ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash \n */\n\nfunction murmurhash3_32_gc(key, seed) {\n\tvar remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i;\n\t\n\tremainder = key.length & 3; // key.length % 4\n\tbytes = key.length - remainder;\n\th1 = seed;\n\tc1 = 0xcc9e2d51;\n\tc2 = 0x1b873593;\n\ti = 0;\n\t\n\twhile (i < bytes) {\n\t \tk1 = \n\t \t ((key.charCodeAt(i) & 0xff)) |\n\t \t ((key.charCodeAt(++i) & 0xff) << 8) |\n\t \t ((key.charCodeAt(++i) & 0xff) << 16) |\n\t \t ((key.charCodeAt(++i) & 0xff) << 24);\n\t\t++i;\n\t\t\n\t\tk1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\n\t\tk1 = (k1 << 15) | (k1 >>> 17);\n\t\tk1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\n\n\t\th1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n\t\th1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\n\t\th1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\n\t}\n\t\n\tk1 = 0;\n\t\n\tswitch (remainder) {\n\t\tcase 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;\n\t\tcase 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;\n\t\tcase 1: k1 ^= (key.charCodeAt(i) & 0xff);\n\t\t\n\t\tk1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\n\t\tk1 = (k1 << 15) | (k1 >>> 17);\n\t\tk1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\n\t\th1 ^= k1;\n\t}\n\t\n\th1 ^= key.length;\n\n\th1 ^= h1 >>> 16;\n\th1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\n\th1 ^= h1 >>> 13;\n\th1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\n\th1 ^= h1 >>> 16;\n\n\treturn h1 >>> 0;\n}\n\nif(typeof module !== \"undefined\") {\n module.exports = murmurhash3_32_gc\n}", "/**\n * JS Implementation of MurmurHash2\n * \n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n * \n * @param {string} str ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n\nfunction murmurhash2_32_gc(str, seed) {\n var\n l = str.length,\n h = seed ^ l,\n i = 0,\n k;\n \n while (l >= 4) {\n \tk = \n \t ((str.charCodeAt(i) & 0xff)) |\n \t ((str.charCodeAt(++i) & 0xff) << 8) |\n \t ((str.charCodeAt(++i) & 0xff) << 16) |\n \t ((str.charCodeAt(++i) & 0xff) << 24);\n \n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n k ^= k >>> 24;\n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n\n\th = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k;\n\n l -= 4;\n ++i;\n }\n \n switch (l) {\n case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n case 1: h ^= (str.charCodeAt(i) & 0xff);\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n }\n\n h ^= h >>> 13;\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n h ^= h >>> 15;\n\n return h >>> 0;\n}\n\nif(typeof module !== undefined) {\n module.exports = murmurhash2_32_gc\n}\n", "var murmur3 = require(\"./murmurhash3_gc.js\")\nvar murmur2 = require(\"./murmurhash2_gc.js\")\n\nmodule.exports = murmur3\nmodule.exports.murmur3 = murmur3\nmodule.exports.murmur2 = murmur2\n", "const TokenType = {\n PAR_OPEN: '('.charCodeAt(0),\n PAR_CLOSE: ')'.charCodeAt(0),\n OP_NOT: '!'.charCodeAt(0),\n BINARY_AND: '&'.charCodeAt(0),\n BINARY_OR: '|'.charCodeAt(0),\n LITERAL: 'LITERAL',\n END: 'END',\n LEAF: 'LEAF',\n ATOMIC: 'ATOMIC'\n};\n\nmodule.exports = TokenType;\n", "const TokenType = require('./token-type');\n\nconst Tokenizer = exp => {\n let literal = '';\n const tokens = [];\n for (const char of exp) {\n const code = char.charCodeAt(0);\n switch (code) {\n case TokenType.PAR_OPEN:\n case TokenType.PAR_CLOSE:\n case TokenType.OP_NOT:\n case TokenType.BINARY_AND:\n case TokenType.BINARY_OR:\n if (literal) {\n tokens.push({\n type: TokenType.LITERAL,\n value: literal\n });\n literal = '';\n }\n\n tokens.push({\n type: code,\n value: char\n });\n break;\n default:\n literal += char;\n }\n }\n\n if (literal)\n tokens.push({\n type: TokenType.LITERAL,\n value: literal\n });\n\n return tokens;\n};\n\nmodule.exports = Tokenizer;\n", "const TokenType = require('./token-type');\n\nconst PolishNotation = tokens => {\n const queue = [];\n const stack = [];\n tokens.forEach(token => {\n switch (token.type) {\n case TokenType.LITERAL:\n queue.unshift(token);\n break;\n case TokenType.BINARY_AND:\n case TokenType.BINARY_OR:\n case TokenType.OP_NOT:\n case TokenType.PAR_OPEN:\n stack.push(token);\n break;\n case TokenType.PAR_CLOSE:\n while (\n stack.length &&\n stack[stack.length - 1].type !== TokenType.PAR_OPEN\n ) {\n queue.unshift(stack.pop());\n }\n\n stack.pop();\n\n if (stack.length && stack[stack.length - 1].type === TokenType.OP_NOT) {\n queue.unshift(stack.pop());\n }\n break;\n default:\n break;\n }\n });\n\n const result = (stack.length && [...stack.reverse(), ...queue]) || queue;\n\n return result;\n};\n\n// \u6CE2\u5170\u5217\u8868\u751F\u6210\u5668\nconst PolishGenerator = function*(polish) {\n for (let index = 0; index < polish.length - 1; index++) {\n yield polish[index];\n }\n\n return polish[polish.length - 1];\n};\n\nmodule.exports = {\n PolishNotation,\n PolishGenerator\n};\n", "const TokenType = require('./token-type');\n\nclass ExpNode {\n constructor(op, left, right, literal) {\n this.op = op;\n this.left = left;\n this.right = right;\n this.literal = literal;\n }\n\n isLeaf() {\n return this.op === TokenType.LEAF;\n }\n\n isAtomic() {\n return (\n this.isLeaf() || (this.op === TokenType.OP_NOT && this.left.isLeaf())\n );\n }\n\n getLiteralValue() {\n return this.literal;\n }\n\n static CreateAnd(left, right) {\n return new ExpNode(TokenType.BINARY_AND, left, right);\n }\n\n static CreateNot(exp) {\n return new ExpNode(TokenType.OP_NOT, exp);\n }\n\n static CreateOr(left, right) {\n return new ExpNode(TokenType.BINARY_OR, left, right);\n }\n\n static CreateLiteral(lit) {\n return new ExpNode(TokenType.LEAF, null, null, lit);\n }\n}\n\n// \u62BD\u8C61\u8BED\u6CD5\u6811\u751F\u6210\nconst make = gen => {\n const data = gen.next().value;\n\n switch (data.type) {\n case TokenType.LITERAL:\n return ExpNode.CreateLiteral(data.value);\n case TokenType.OP_NOT:\n return ExpNode.CreateNot(make(gen));\n case TokenType.BINARY_AND: {\n const left = make(gen);\n const right = make(gen);\n return ExpNode.CreateAnd(left, right);\n }\n case TokenType.BINARY_OR: {\n const left = make(gen);\n const right = make(gen);\n return ExpNode.CreateOr(left, right);\n }\n }\n return null;\n};\n\n// \u8BED\u6CD5\u6811\u6C42\u503C\nconst nodeEvaluator = (tree, literalEvaluator) => {\n if (tree.isLeaf()) {\n return literalEvaluator(tree.getLiteralValue());\n }\n\n if (tree.op === TokenType.OP_NOT) {\n return !nodeEvaluator(tree.left, literalEvaluator);\n }\n\n if (tree.op === TokenType.BINARY_OR) {\n return (\n nodeEvaluator(tree.left, literalEvaluator) ||\n nodeEvaluator(tree.right, literalEvaluator)\n );\n }\n\n if (tree.op === TokenType.BINARY_AND) {\n return (\n nodeEvaluator(tree.left, literalEvaluator) &&\n nodeEvaluator(tree.right, literalEvaluator)\n );\n }\n};\n\nmodule.exports = {\n make,\n nodeEvaluator\n};\n", "const Tokenizer = require('./tokenizer');\nconst Polish = require('./polish');\nconst Node = require('./node');\n\nconst parse = (exp, literalChecker) => {\n const tokens = Tokenizer(exp);\n const polish = Polish.PolishNotation(tokens);\n const gen = Polish.PolishGenerator(polish);\n const tree = Node.make(gen);\n const result = Node.nodeEvaluator(tree, literalChecker);\n return result;\n};\n\nmodule.exports = { parse };\n", "import { makeStore } from './core/store';\nimport makeApi from './make-api';\nimport defaultReducer from './core/reducer';\nimport shopifyReducer from './shopify/shopifyReducer';\nimport shopifyMiddleware from './shopify/shopifyMiddleware';\nimport platform from './platform';\nimport { autoInitializeOffers, onReady } from './core/utils';\nimport { authorizeShopifyCustomer } from './shopify/shopifyBootstrap';\nimport shopifyTrackingMiddleware from './shopify/shopifyTrackingMiddleware';\n\nexport const store = makeStore(\n ...(platform?.shopify_selling_plans ? [shopifyReducer, shopifyMiddleware] : [defaultReducer]),\n platform.shopify && shopifyTrackingMiddleware\n);\n\nexport const offers = makeApi(store);\n\nexport const isReady = offers.isReady;\nexport const addOptinChangedCallback = offers.addOptinChangedCallback;\nexport const addTemplate = offers.addTemplate;\nexport const clear = offers.clear;\nexport const config = offers.config;\nexport const disableOptinChangedCallbacks = offers.disableOptinChangedCallbacks;\nexport const getOptins = offers.getOptins;\nexport const getProductsForPurchasePost = offers.getProductsForPurchasePost;\nexport const initialize = offers.initialize;\nexport const previewMode = offers.previewMode;\nexport const register = offers.register;\nexport const resolveSettings = offers.resolveSettings;\nexport const setAuthUrl = offers.setAuthUrl;\nexport const setBenefitMessages = offers.setBenefitMessages;\nexport const setEnvironment = offers.setEnvironment;\nexport const setLocale = offers.setLocale;\nexport const setMerchantId = offers.setMerchantId;\nexport const setPublicPath = offers.setPublicPath;\nexport const setTemplates = offers.setTemplates;\nexport const setupCart = offers.setupCart;\nexport const setupProduct = offers.setupProduct;\nexport const setupProducts = offers.setupProducts;\nexport const autoInit = () => autoInitializeOffers(offers);\n\nexport { platform };\nexport default offers.initialize;\n/*\n * Attempts to auto initialize the offer library reading the merchantId and env from\n * integration script i.e. <script src=\"http://static.ordergroove....\"/>.\n * Useful when local develop using http redirects\n */\nif (process.env.NODE_ENV === 'development') {\n console.info('%c Ordergroove Offers DEV MODE ', 'background: #222; color: #bada55');\n onReady(autoInit);\n}\n\nif (platform?.shopify_selling_plans) {\n onReady(() => authorizeShopifyCustomer(offers));\n}\n", "export default function symbolObservablePonyfill(root) {\n\tvar result;\n\tvar Symbol = root.Symbol;\n\n\tif (typeof Symbol === 'function') {\n\t\tif (Symbol.observable) {\n\t\t\tresult = Symbol.observable;\n\t\t} else {\n\t\t\tresult = Symbol('observable');\n\t\t\tSymbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n", "/* global window */\nimport ponyfill from './ponyfill.js';\n\nvar root;\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = ponyfill(root);\nexport default result;\n", "import $$observable from 'symbol-observable';\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nvar randomString = function randomString() {\n return Math.random().toString(36).substring(7).split('').join('.');\n};\n\nvar ActionTypes = {\n INIT: \"@@redux/INIT\" + randomString(),\n REPLACE: \"@@redux/REPLACE\" + randomString(),\n PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {\n return \"@@redux/PROBE_UNKNOWN_ACTION\" + randomString();\n }\n};\n\n/**\n * @param {any} obj The object to inspect.\n * @returns {boolean} True if the argument appears to be a plain object.\n */\nfunction isPlainObject(obj) {\n if (typeof obj !== 'object' || obj === null) return false;\n var proto = obj;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(obj) === proto;\n}\n\n/**\n * Creates a Redux store that holds the state tree.\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n\nfunction createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.');\n }\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error('Expected the enhancer to be a function.');\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error('Expected the reducer to be a function.');\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n /**\n * This makes a shallow copy of currentListeners so we can use\n * nextListeners as a temporary list while dispatching.\n *\n * This prevents any bugs around consumers calling\n * subscribe/unsubscribe in the middle of a dispatch.\n */\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n\n\n function getState() {\n if (isDispatching) {\n throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');\n }\n\n return currentState;\n }\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n\n\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error('Expected the listener to be a function.');\n }\n\n if (isDispatching) {\n throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.');\n }\n\n var isSubscribed = true;\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n if (isDispatching) {\n throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.');\n }\n\n isSubscribed = false;\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n currentListeners = null;\n };\n }\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing \u201Cwhat changed\u201D. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n\n\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error('Actions may not have an undefined \"type\" property. ' + 'Have you misspelled a constant?');\n }\n\n if (isDispatching) {\n throw new Error('Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n\n\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error('Expected the nextReducer to be a function.');\n }\n\n currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.\n // Any reducers that existed in both the new and old rootReducer\n // will receive the previous state. This effectively populates\n // the new state tree with any relevant data from the old one.\n\n dispatch({\n type: ActionTypes.REPLACE\n });\n }\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n\n\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n throw new TypeError('Expected the observer to be an object.');\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return {\n unsubscribe: unsubscribe\n };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n } // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n\n\n dispatch({\n type: ActionTypes.INIT\n });\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n\n/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nfunction warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n\n\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n } catch (e) {} // eslint-disable-line no-empty\n\n}\n\nfunction getUndefinedStateErrorMessage(key, action) {\n var actionType = action && action.type;\n var actionDescription = actionType && \"action \\\"\" + String(actionType) + \"\\\"\" || 'an action';\n return \"Given \" + actionDescription + \", reducer \\\"\" + key + \"\\\" returned undefined. \" + \"To ignore an action, you must explicitly return the previous state. \" + \"If you want this reducer to hold no value, you can return null instead of undefined.\";\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n return \"The \" + argumentName + \" has unexpected type of \\\"\" + {}.toString.call(inputState).match(/\\s([a-z|A-Z]+)/)[1] + \"\\\". Expected argument to be an object with the following \" + (\"keys: \\\"\" + reducerKeys.join('\", \"') + \"\\\"\");\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n if (action && action.type === ActionTypes.REPLACE) return;\n\n if (unexpectedKeys.length > 0) {\n return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, {\n type: ActionTypes.INIT\n });\n\n if (typeof initialState === 'undefined') {\n throw new Error(\"Reducer \\\"\" + key + \"\\\" returned undefined during initialization. \" + \"If the state passed to the reducer is undefined, you must \" + \"explicitly return the initial state. The initial state may \" + \"not be undefined. If you don't want to set a value for this reducer, \" + \"you can use null instead of undefined.\");\n }\n\n if (typeof reducer(undefined, {\n type: ActionTypes.PROBE_UNKNOWN_ACTION()\n }) === 'undefined') {\n throw new Error(\"Reducer \\\"\" + key + \"\\\" returned undefined when probed with a random type. \" + (\"Don't try to handle \" + ActionTypes.INIT + \" or other actions in \\\"redux/*\\\" \") + \"namespace. They are considered private. Instead, you must return the \" + \"current state for any unknown actions, unless it is undefined, \" + \"in which case you must return the initial state, regardless of the \" + \"action type. The initial state may not be undefined, but can be null.\");\n }\n });\n}\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\n\n\nfunction combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning(\"No reducer provided for key \\\"\" + key + \"\\\"\");\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n\n var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n // keys multiple times.\n\n var unexpectedKeyCache;\n\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError;\n\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination(state, action) {\n if (state === void 0) {\n state = {};\n }\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n\n if (typeof nextStateForKey === 'undefined') {\n var errorMessage = getUndefinedStateErrorMessage(_key, action);\n throw new Error(errorMessage);\n }\n\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n\n hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;\n return hasChanged ? nextState : state;\n };\n}\n\nfunction bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(this, arguments));\n };\n}\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass an action creator as the first argument,\n * and get a dispatch wrapped function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\n\n\nfunction bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error(\"bindActionCreators expected an object or a function, instead received \" + (actionCreators === null ? 'null' : typeof actionCreators) + \". \" + \"Did you write \\\"import ActionCreators from\\\" instead of \\\"import * as ActionCreators from\\\"?\");\n }\n\n var boundActionCreators = {};\n\n for (var key in actionCreators) {\n var actionCreator = actionCreators[key];\n\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n\n return boundActionCreators;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n keys.push.apply(keys, Object.getOwnPropertySymbols(object));\n }\n\n if (enumerableOnly) keys = keys.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(source, true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(source).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\n/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\nfunction compose() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(void 0, arguments));\n };\n });\n}\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\n\nfunction applyMiddleware() {\n for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function () {\n var store = createStore.apply(void 0, arguments);\n\n var _dispatch = function dispatch() {\n throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n };\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch() {\n return _dispatch.apply(void 0, arguments);\n }\n };\n var chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(void 0, chain)(store.dispatch);\n return _objectSpread2({}, store, {\n dispatch: _dispatch\n });\n };\n };\n}\n\n/*\n * This is a dummy function to check if the function name has been altered by minification.\n * If the function has been minified and NODE_ENV !== 'production', warn the user.\n */\n\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \"production\". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore };\n", "/** A function that accepts a potential \"extra argument\" value to be injected later,\r\n * and returns an instance of the thunk middleware that uses that value\r\n */\nfunction createThunkMiddleware(extraArgument) {\n // Standard Redux middleware definition pattern:\n // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware\n var middleware = function middleware(_ref) {\n var dispatch = _ref.dispatch,\n getState = _ref.getState;\n return function (next) {\n return function (action) {\n // The thunk middleware looks for any functions that were passed to `store.dispatch`.\n // If this \"action\" is really a function, call it and return the result.\n if (typeof action === 'function') {\n // Inject the store's `dispatch` and `getState` methods, as well as any \"extra arg\"\n return action(dispatch, getState, extraArgument);\n } // Otherwise, pass the action down the middleware chain as usual\n\n\n return next(action);\n };\n };\n };\n\n return middleware;\n}\n\nvar thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version\n// with whatever \"extra arg\" they want to inject into their thunks\n\nthunk.withExtraArgument = createThunkMiddleware;\nexport default thunk;", "import { throttle } from 'throttle-debounce';\nimport { requestSessionId } from './actions';\nimport { LOCAL_STORAGE_CHANGE, LOCAL_STORAGE_CLEAR } from './constants';\n\nexport const STORE_ROOT = 'OG_STATE';\n\nexport const safeParseState = serializedState => {\n try {\n if (serializedState === null) {\n return undefined;\n }\n return JSON.parse(serializedState);\n } catch (err) {\n return undefined;\n }\n};\nconst isPreviewMode = () => window.og && window.og.previewMode;\n\nexport const loadState = () => (isPreviewMode() ? {} : safeParseState(localStorage.getItem(STORE_ROOT)));\n\nexport const serializeState = state => {\n if (!state || !state.sessionId) {\n return false;\n }\n return JSON.stringify({\n sessionId: state.sessionId,\n optedin: state.optedin,\n optedout: state.optedout,\n productOffer: state.productOffer,\n firstOrderPlaceDate: state.firstOrderPlaceDate,\n productToSubscribe: state.productToSubscribe\n // uncomment this to see parameter saved to localStorage\n // inStock: state.inStock,\n // autoshipEligible: state.autoshipEligible,\n // productOffer: state.productOffer\n // frequency: { ...state.frequency }\n });\n};\n\nexport const saveState = state => {\n if (isPreviewMode()) return;\n if (state && state.sessionId) {\n document.cookie =\n 'og_session_id=' +\n encodeURIComponent(state.sessionId) +\n '; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Lax';\n }\n\n const serializedState = serializeState(state);\n if (serializedState && localStorage.getItem(STORE_ROOT) !== serializedState) {\n localStorage.setItem(STORE_ROOT, serializedState);\n }\n};\n\nexport const listenLocalStorageChanges = store =>\n throttle(500, ev => {\n if (isPreviewMode()) return;\n const { key, newValue } = ev;\n if (key === STORE_ROOT && newValue === null) {\n store.dispatch({ type: LOCAL_STORAGE_CLEAR });\n setTimeout(() => store.dispatch(requestSessionId()), 0);\n } else if (key === STORE_ROOT) {\n store.dispatch({\n type: LOCAL_STORAGE_CHANGE,\n newValue: safeParseState(newValue)\n });\n }\n });\n\nexport const clearState = () => localStorage.removeItem(STORE_ROOT);\n", "export const ogAuthRegExp = /^og_auth=/;\n\n/**\n * Retrieve og_auth cookie from current document\n */\nexport const readAuthCookie = (_ogAuthRegExp = ogAuthRegExp) =>\n (document.cookie.split(/;\\s*/).find(it => it.match(_ogAuthRegExp)) || '').replace(ogAuthRegExp, '');\n\n/**\n * Converts a string authCookie representation into a hmac auth object\n * @param {*} authCookie\n */\nexport const parseAuth = authCookie => {\n // Called to set auth parameters if the config setting for HMAC auth is used\n if (typeof authCookie === 'object') return authCookie;\n const parts = String(authCookie || '').split('|');\n\n return parts.length === 3\n ? {\n sig_field: parts[0],\n ts: parseInt(parts[1], 10),\n sig: parts[2]\n }\n : null;\n};\n\n/**\n * Loads the auth url into and iframe and useful to detect cookies set by javascript\n * @param {*} auth_url\n */\nexport const iframeLoad = auth_url => {\n return new Promise((resolve, reject) => {\n const iframe = document.createElement('iframe');\n iframe.style.setProperty('display', 'none', 'important');\n document.body.appendChild(iframe);\n\n iframe.onload = resolve;\n iframe.onerror = reject;\n iframe.src = auth_url;\n });\n};\n\n/**\n * Detects if a fetch response is json\n * @see https://stackoverflow.com/questions/37121301/how-to-check-if-the-response-of-a-fetch-is-a-json-object-in-javascript\n * @param {} response\n */\nexport const isJsonResponse = response =>\n (response.headers.get('content-type') || '').indexOf('application/json') !== -1;\n\n/**\n * Reads auth from window.og_auth\n * @returns {AuthObject|null} Returns null if auth fails or the object containing sig_field,\n * ts and sig used to authorize with ordergroove\n */\nfunction _readStaticAuth() {\n if (typeof window.og_auth !== 'undefined') {\n return parseAuth(window.og_auth);\n }\n return null;\n}\n/**\n * Waits 100ms to read window.og_auth value\n * @param {int} ms\n * @returns {Promise<AuthObject>} Returns a promise of AuthObject\n */\nasync function _delayedReadStaticAuth(ms = 100) {\n return new Promise(res => {\n setTimeout(() => res(_readStaticAuth()), ms);\n });\n}\n\n/**\n * Given a merchant auth endpoint this function tries to resolve the current auth.\n * If og_auth is in cookie it returns it, otherwise it call the merchant auth endpoint detecting\n * if response is json or cookie set by repsonse header and return it.\n *\n * @param {*} auth_url Merchant auth url endpoint\n * @param {*} _readAuthCookie method to read cookie (for test purpose)\n * @param {*} _iframeLoad method to load an iframe (for test purpose)\n */\nexport async function resolveAuth(auth_url, _readAuthCookie = readAuthCookie, _iframeLoad = iframeLoad) {\n let auth;\n\n auth = parseAuth(_readStaticAuth()) || parseAuth(_readAuthCookie());\n\n if (auth) {\n return auth;\n }\n\n if (auth_url && typeof auth_url === 'string') {\n const response = await fetch(auth_url);\n // https://github.com/github/fetch/issues/386#issuecomment-243145797\n // detect if cookie was written by latest request\n if (response.status >= 200 && response.status < 300) {\n auth =\n _readAuthCookie() ||\n (await (isJsonResponse(response)\n ? response.json()\n : Promise.resolve(_iframeLoad(auth_url)).then(_readAuthCookie)));\n }\n } else if (!auth) {\n // If there is no auth_url and no auth at this point\n // lets wait for 100 ms to see if window.og_auth is set via js on DOM\n auth = await _delayedReadStaticAuth();\n }\n\n auth = parseAuth(auth);\n if (auth) return auth;\n throw new Error('Unauthorized');\n}\n\nexport default resolveAuth;\n", "export const OPTIN_PRODUCT = 'OPTIN_PRODUCT';\nexport const OPTOUT_PRODUCT = 'OPTOUT_PRODUCT';\nexport const PRODUCT_CHANGE_FREQUENCY = 'PRODUCT_CHANGE_FREQUENCY';\nexport const PRODUCT_CHANGE_PREPAID_SHIPMENTS = 'PRODUCT_CHANGE_PREPAID_SHIPMENTS';\nexport const SET_MERCHANT_ID = 'SET_MERCHANT_ID';\nexport const REQUEST_OFFER = 'REQUEST_OFFER';\nexport const RECEIVE_OFFER = 'RECEIVE_OFFER';\nexport const PRODUCT_HAS_CHANGED = 'PRODUCT_HAS_CHANGED';\nexport const CREATED_SESSION_ID = 'CREATED_SESSION_ID';\nexport const SET_AUTH_URL = 'SET_AUTH_URL';\nexport const REQUEST_AUTH = 'REQUEST_AUTH';\nexport const AUTHORIZE = 'AUTHORIZE';\nexport const UNAUTHORIZED = 'UNAUTHORIZED';\nexport const REQUEST_ORDERS = 'REQUEST_ORDERS';\nexport const RECEIVE_ORDERS = 'RECEIVE_ORDERS';\nexport const CART_PRODUCT_KEY_HAS_CHANGED = 'CART_PRODUCT_KEY_HAS_CHANGED';\n\nexport const RECEIVE_ORDER_ITEMS = 'RECEIVE_ORDER_ITEMS';\nexport const FETCH_RESPONSE_ERROR = 'FETCH_RESPONSE_ERROR';\nexport const SET_ENVIRONMENT_LOCAL = 'SET_ENVIRONMENT_LOCAL';\nexport const SET_ENVIRONMENT_STAGING = 'SET_ENVIRONMENT_STAGING';\nexport const SET_ENVIRONMENT_DEV = 'SET_ENVIRONMENT_DEV';\nexport const SET_ENVIRONMENT_PROD = 'SET_ENVIRONMENT_PROD';\nexport const READY = 'READY';\nexport const CONCLUDE_UPSELL = 'CONCLUDE_UPSELL';\nexport const REQUEST_CREATE_IU_ORDER = 'REQUEST_CREATE_IU_ORDER';\nexport const CREATE_ONE_TIME = 'CREATE_ONE_TIME';\nexport const REQUEST_CONVERT_ONE_TIME = 'REQUEST_CONVERT_ONE_TIME';\nexport const CONVERT_ONE_TIME = 'CONVERT_ONE_TIME';\nexport const NO_UPCOMING_ORDER_ERROR = 'NO_UPCOMING_ORDER_ERROR';\nexport const CHECKOUT = 'CHECKOUT';\nexport const RECEIVE_FETCH = 'RECEIVE_FETCH';\nexport const SET_LOCALE = 'SET_LOCALE';\nexport const SET_CONFIG = 'SET_CONFIG';\nexport const SET_BENEFIT_MESSAGES = 'SET_BENEFIT_MESSAGES';\nexport const SET_PREVIEW_STANDARD_OFFER = 'SET_PREVIEW_STANDARD_OFFER';\nexport const SET_PREVIEW_UPSELL_OFFER = 'SET_PREVIEW_UPSELL_OFFER';\nexport const SET_PREVIEW_PREPAID_OFFER = 'SET_PREVIEW_PREPAID_OFFER';\nexport const ADD_TEMPLATE = 'ADD_TEMPLATE';\nexport const SET_TEMPLATES = 'SET_TEMPLATES';\nexport const LOCAL_STORAGE_CHANGE = 'LOCAL_STORAGE_CHANGE';\nexport const LOCAL_STORAGE_CLEAR = 'LOCAL_STORAGE_CLEAR';\nexport const SET_FIRST_ORDER_PLACE_DATE = 'SET_FIRST_ORDER_PLACE_DATE';\nexport const SET_PRODUCT_TO_SUBSCRIBE = 'SET_PRODUCT_TO_SUBSCRIBE';\nexport const RECEIVE_PRODUCT_PLANS = 'RECEIVE_PRODUCT_PLANS';\nexport const SETUP_PRODUCT = 'SETUP_PRODUCT';\nexport const SETUP_CART = 'SETUP_CART';\nexport const RECEIVE_MERCHANT_SETTINGS = 'RECEIVE_MERCHANT_SETTINGS';\nexport const SET_EXPERIMENT_VARIANT = 'SET_EXPERIMENT_VARIANT';\nexport const DEFAULT_OFFER_MODULE = 'pdp';\nexport const ENV_LOCAL = 'local';\nexport const ENV_DEV = 'dev';\nexport const ENV_STAGING = 'staging';\nexport const ENV_PROD = 'prod';\nexport const STATIC_HOST = 'static.ordergroove.com';\nexport const STAGING_STATIC_HOST = 'staging.static.ordergroove.com';\n\nexport const INCENTIVE_STANDARD_TYPES = {\n PSI: 'PSI',\n // note: this is a \"pseudo-standard\" that we set in our own code\n // the API actually returns no criteria for program wide incentives\n PROGRAM_WIDE: 'PROGRAM_WIDE'\n};\n\nexport const ELIGIBILITY_GROUPS = {\n PREPAID: 'prepaid'\n};\n\n/**\n * @event\n * Events that fires once optin/optout occurs on a cart offer\n * @example\n * Merchant can subscribe to this event to perform extra UI updated after offer and price had change\n *\n * ```js\n * // Hooks OG cart updated to VueMinicart\n * 'VueMinicart' in window && document.addEventListener('og-cart-updated', () => window.VueMinicart.$store.dispatch('refreshCart'));\n * ```\n */\nexport const CART_UPDATED_EVENT = 'og-cart-updated';\n", "import memoize from 'lodash.memoize';\n\nconst memoizeKey = (...args) => JSON.stringify(args);\n\nexport const withFetchJson =\n cb =>\n (...args) =>\n fetch(...cb(...args)).then(res => res.json());\n\nexport const withHost = cb => {\n return (host, ...extra) => {\n if (!host) throw Error('host required');\n const [path, options = {}] = cb(...extra);\n const url = `${host.replace(/\\/+$/, '')}${path}`;\n return [url, options];\n };\n};\n\nexport const withAuth = cb => {\n return (auth, ...extra) => {\n if (!auth) throw Error('auth required');\n const [path, options = {}] = cb(...extra);\n return [\n path,\n {\n ...options,\n headers: {\n Authorization: JSON.stringify(auth),\n ...options.headers\n }\n }\n ];\n };\n};\n\nexport const withJsonBody = cb => {\n return (...extra) => {\n const [path, options = {}] = cb(...extra);\n return [\n path,\n {\n method: 'POST',\n ...options,\n body: JSON.stringify(options.body),\n headers: {\n 'Content-type': 'application/json',\n ...options.headers\n }\n }\n ];\n };\n};\n\nexport const toQuery = (params = []) =>\n (Array.isArray(params) ? params : Object.entries(params))\n .map(([key, val]) => [key, encodeURIComponent(val)].join('='))\n .join('&');\n\nexport const toProductId = product =>\n JSON.stringify(\n []\n .concat(product)\n .map(it => (typeof it === 'object' ? it.id : it))\n .filter(it => it)\n );\n\nexport const fetchOffer = memoize(\n withFetchJson(\n withHost((merchantId, sessionId, product, module = 'pdp', searchParams = {}) => {\n if (!merchantId) throw Error('merchantId required');\n if (!sessionId) throw Error('sessionId required');\n if (!product) throw Error('product required');\n\n const query = [\n ['session_id', sessionId],\n ['page_type', 1],\n ['p', toProductId(product)],\n ['module_view', JSON.stringify(['regular'])],\n ...Object.entries(searchParams)\n ];\n\n return [`/offer/${merchantId}/${module}?${toQuery(query)}`];\n })\n ),\n memoizeKey\n);\n\nexport const fetchOrders = memoize(\n withFetchJson(\n withHost(\n withAuth((status = 1, ordering = 'place') => [\n `/orders/?${toQuery([\n ['status', status],\n ['ordering', ordering],\n ['exclude_prepaid_orders', 'true']\n ])}`\n ])\n )\n ),\n memoizeKey\n);\n\nexport const fetchItems = memoize(\n withFetchJson(\n withHost(\n withAuth(orderId => {\n if (!orderId) throw Error('orderId required');\n return [`/items/?order=${orderId}`];\n })\n )\n ),\n memoizeKey\n);\n\nexport const createOneTime = withFetchJson(\n withHost(\n withAuth(\n withJsonBody((product, order, quantity, offer) => {\n if (!product) throw Error('product required');\n if (!order) throw Error('order required');\n if (!quantity) throw Error('quantity required');\n if (quantity <= 0) throw Error('quantity must be greater or equal than one');\n if (!offer) throw Error('offer required');\n return ['/items/iu/', { body: { product, order, quantity, offer } }];\n })\n )\n )\n);\n\nexport const parseFrequency = raw => {\n if (typeof raw === 'object') {\n return { ...raw };\n }\n\n const [every, every_period] = (raw || '').split(/_/).map(n => parseInt(n, 10));\n return every && every_period && { every, every_period };\n};\n\nexport const isFrequencyValid = it => it.match(/^\\d+_\\d$/);\nexport const compareFrequencies = (a, b) =>\n String.prototype.localeCompare.call(a && a.split('_').reverse().join('_'), b && b.split('_').reverse().join('_'));\n\nexport const parseFrequenciesList = value =>\n [...new Set(value && value.split(/\\s+/))].filter(isFrequencyValid).sort(compareFrequencies);\n\nexport const stringifyFrequencies = value => (value == null ? value : value.join(' '));\n\nexport const stringifyFrequency = ref => {\n if (typeof ref === 'object') {\n const { every, period, every_period } = ref;\n return `${every}_${period || every_period}`;\n }\n if (typeof ref === 'string') return ref;\n return '';\n};\n\nexport const convertOneTimeToSubscription = withFetchJson(\n withHost(\n withAuth(\n withJsonBody((item, frequency, offer, sessionId) => {\n if (!item) throw Error('item required');\n if (!frequency) throw Error('frequency required');\n const parsedFrequency = parseFrequency(frequency);\n if (!parsedFrequency) throw Error('invalid frequency');\n\n return [\n '/subscriptions/create_from_item/',\n { body: { item: item.public_id, offer, session_id: sessionId, ...parsedFrequency } }\n ];\n })\n )\n )\n);\n\nexport const api = { fetchOffer, fetchOrders, fetchItems, createOneTime, convertOneTimeToSubscription };\n\nexport default api;\n", "import { getMainJs } from './core/utils';\n\nconst script = getMainJs();\n\nexport default {\n shopify: typeof window.Shopify !== 'undefined',\n // detect in the frontend if we should use shopify selling plans or not\n shopify_selling_plans: typeof script?.dataset.shopifySellingPlans !== 'undefined'\n};\n", "function defaultEqualityCheck(a, b) {\n return a === b;\n}\n\nfunction areArgumentsShallowlyEqual(equalityCheck, prev, next) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n var length = prev.length;\n for (var i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function defaultMemoize(func) {\n var equalityCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEqualityCheck;\n\n var lastArgs = null;\n var lastResult = null;\n // we reference arguments instead of spreading them for performance reasons\n return function () {\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\n // apply arguments instead of spreading for performance.\n lastResult = func.apply(null, arguments);\n }\n\n lastArgs = arguments;\n return lastResult;\n };\n}\n\nfunction getDependencies(funcs) {\n var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs;\n\n if (!dependencies.every(function (dep) {\n return typeof dep === 'function';\n })) {\n var dependencyTypes = dependencies.map(function (dep) {\n return typeof dep;\n }).join(', ');\n throw new Error('Selector creators expect all input-selectors to be functions, ' + ('instead received the following types: [' + dependencyTypes + ']'));\n }\n\n return dependencies;\n}\n\nexport function createSelectorCreator(memoize) {\n for (var _len = arguments.length, memoizeOptions = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n memoizeOptions[_key - 1] = arguments[_key];\n }\n\n return function () {\n for (var _len2 = arguments.length, funcs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n funcs[_key2] = arguments[_key2];\n }\n\n var recomputations = 0;\n var resultFunc = funcs.pop();\n var dependencies = getDependencies(funcs);\n\n var memoizedResultFunc = memoize.apply(undefined, [function () {\n recomputations++;\n // apply arguments instead of spreading for performance.\n return resultFunc.apply(null, arguments);\n }].concat(memoizeOptions));\n\n // If a selector is called with the exact same arguments we don't need to traverse our dependencies again.\n var selector = memoize(function () {\n var params = [];\n var length = dependencies.length;\n\n for (var i = 0; i < length; i++) {\n // apply arguments instead of spreading and mutate a local list of params for performance.\n params.push(dependencies[i].apply(null, arguments));\n }\n\n // apply arguments instead of spreading for performance.\n return memoizedResultFunc.apply(null, params);\n });\n\n selector.resultFunc = resultFunc;\n selector.dependencies = dependencies;\n selector.recomputations = function () {\n return recomputations;\n };\n selector.resetRecomputations = function () {\n return recomputations = 0;\n };\n return selector;\n };\n}\n\nexport var createSelector = createSelectorCreator(defaultMemoize);\n\nexport function createStructuredSelector(selectors) {\n var selectorCreator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createSelector;\n\n if (typeof selectors !== 'object') {\n throw new Error('createStructuredSelector expects first argument to be an object ' + ('where each property is a selector, instead received a ' + typeof selectors));\n }\n var objectKeys = Object.keys(selectors);\n return selectorCreator(objectKeys.map(function (key) {\n return selectors[key];\n }), function () {\n for (var _len3 = arguments.length, values = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n values[_key3] = arguments[_key3];\n }\n\n return values.reduce(function (composition, value, index) {\n composition[objectKeys[index]] = value;\n return composition;\n }, {});\n });\n}", "import { createSelector } from 'reselect';\nimport memoize from 'lodash.memoize';\nimport { stringifyFrequency } from './api';\nimport platform from '../platform';\nimport { mapFrequencyToSellingPlan, safeProductId } from './utils';\nimport { Incentive, OfferElement, ProductFrequencyConfig, State } from './types/reducer';\nimport { money, percentage } from '../shopify/utils';\nimport { INCENTIVE_STANDARD_TYPES } from './constants';\n\nmemoize.Cache = Map;\n\ntype BaseProduct = {\n id: string;\n components?: string[];\n};\n\nfunction arraysEqual<T>(a: T[], b: T[]) {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (a.length !== b.length) return false;\n\n // If you don't care about the order of the elements inside\n // the array, you should sort both arrays here.\n // Please note that calling sort on an array will modify that array.\n // you might want to clone your array first.\n\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\nfunction resolveFrequency(sellingPlans: string[], frequenciesEveryPeriod: string[], frequency) {\n const ogFrequency = stringifyFrequency(frequency);\n if (!platform.shopify_selling_plans) return ogFrequency;\n return mapFrequencyToSellingPlan(sellingPlans, frequenciesEveryPeriod, ogFrequency);\n}\n\nexport const isSameProduct = <T extends BaseProduct, S extends BaseProduct>(a: T, b: S) => {\n if ((a as BaseProduct) === b) return true;\n if (typeof a === 'object' && typeof b === 'object' && a && b) {\n if (a.id === b.id) {\n if (!(Array.isArray(a.components) && Array.isArray(b.components))) {\n return true;\n }\n if (arraysEqual((a.components || []).sort(), (b.components || []).sort())) {\n return true;\n }\n }\n }\n return false;\n};\n\n/**\n * Returns a list of opted in products id from the state\n * @param {object} state\n */\nexport const optedinSelector = (state: State) => state.optedin || [];\n\nconst optedoutSelector = (state: State) => state.optedout || [];\n\nexport const autoshipSelector = (state: State) => state.autoshipByDefault || {};\n\nconst defaultFrequenciesSelector = (state: State) => state.defaultFrequencies || {};\n\nconst prepaidSellingPlansSelector = (state: State) => state?.config?.prepaidSellingPlans || [];\nconst prepaidShipmentsSelectedSelector = (state: State) => state?.prepaidShipmentsSelected || {};\n\n/**\n * Creates a function with state arguments that return the true when\n * productId is in the optedin array or not in optedout or autoship by default\n */\nexport const makeOptedinSelector = memoize(\n (product: BaseProduct) =>\n createSelector(optedinSelector, optedoutSelector, autoshipSelector, (optedin, optedout, autoshipByDefault) => {\n const entry = optedin.find(b => isSameProduct(product, b));\n if (entry) {\n return entry;\n }\n if (optedout.find(b => isSameProduct(product, b))) {\n return false;\n }\n if (product && autoshipByDefault[product.id]) {\n return { id: product.id };\n }\n return false;\n }),\n product => JSON.stringify(product)\n);\n/**\n * Creates a function with state arguments that return the true when\n * productId is in the optedin array\n */\nexport const makeSubscribedSelector = memoize(\n (product: BaseProduct) =>\n createSelector(optedinSelector, optedin => {\n const entry = optedin.find(b => isSameProduct(product, b));\n if (entry) {\n return entry;\n }\n return false;\n }),\n product => JSON.stringify(product)\n);\n\nexport const makePrepaidSubscribedSelector = memoize(\n (product: BaseProduct) =>\n createSelector(optedinSelector, optedin => optedin.some(b => isSameProduct(product, b) && b.prepaidShipments)),\n product => JSON.stringify(product)\n);\n\nexport const makePrepaidShipmentsSelectedSelector = memoize(\n (product: BaseProduct) =>\n createSelector(\n prepaidShipmentsSelectedSelector,\n prepaidShipmentsSelected => prepaidShipmentsSelected[product.id] || null\n ),\n product => JSON.stringify(product)\n);\n\n/**\n * Creates a function with state arguments that return the true when\n * productId is in the optedout array\n */\nexport const makeOptedoutSelector = memoize((product: BaseProduct) =>\n createSelector(optedoutSelector, optedout => optedout.find(b => isSameProduct(product, b)))\n);\n\nexport const makeProductFrequencyOptedInSelector = memoize(\n (product: BaseProduct) =>\n createSelector(\n makeOptedinSelector(product),\n productOptin => (productOptin && 'frequency' in productOptin && productOptin.frequency) || null\n ),\n product => JSON.stringify(product)\n);\n\nexport const makeProductPrepaidShipmentsOptedInSelector = memoize(\n (product: BaseProduct) =>\n createSelector(\n makeOptedinSelector(product),\n productOptin => (productOptin && 'prepaidShipments' in productOptin && productOptin.prepaidShipments) || null\n ),\n product => JSON.stringify(product)\n);\n\nexport const makeProductPrepaidShipmentOptionsSelector = memoize((productId: string) =>\n createSelector(prepaidSellingPlansSelector, prepaidSellingPlans => {\n const shipmentsList =\n prepaidSellingPlans[safeProductId(productId)]?.map(({ numberShipments }) => numberShipments) || [];\n return shipmentsList.sort((a, b) => a - b);\n })\n);\n\n/**\n * If the product has a product-specific default frequency configured in OG, return that frequency\n */\nexport const makeProductSpecificDefaultFrequencySelector = memoize((productId: string) =>\n createSelector(\n defaultFrequenciesSelector,\n makeProductFrequenciesSelector(productId),\n (defaultFrequencies, { frequencies: sellingPlans = [], frequenciesEveryPeriod = [] }) =>\n (defaultFrequencies[safeProductId(productId)] &&\n resolveFrequency(sellingPlans, frequenciesEveryPeriod, defaultFrequencies[safeProductId(productId)])) ||\n null\n )\n);\n\nexport const makeProductFrequencyOptionsSelector = memoize((productId: string) =>\n createSelector(makeProductFrequenciesSelector(productId), productFrequencies => productFrequencies.frequencies)\n);\n\n/**\n * returns the default frequency for the product from the config state\n * all products have a defaultFrequency stored in state, even if a specific frequency is not configured in OG's database\n * this takes more into account, e.g. whether the customer had opted into a specific frequency previously - see the config reducer for how this is calculated\n */\nexport const makeProductDefaultFrequencySelector = memoize((productId: string) =>\n createSelector(makeProductFrequenciesSelector(productId), productFrequencies => productFrequencies.defaultFrequency)\n);\n\n/**\n * Get the configured frequencies for the given product IDs\n * Using this selector should be preferred over accessing config values directly\n */\nexport const makeProductFrequenciesSelector = memoize((productId: string) =>\n createSelector(\n (state: State) => state?.config?.productFrequencies,\n (state: State) => state?.config?.frequencies,\n (state: State) => state?.config?.frequenciesEveryPeriod,\n (state: State) => state?.config?.frequenciesText,\n (state: State) => state?.config?.defaultFrequency,\n (\n productFrequencies,\n oldFrequencies,\n oldFrequenciesEveryPeriod,\n oldFrequenciesText,\n oldDefaultFrequency\n ): ProductFrequencyConfig => {\n if (productFrequencies) {\n // for Shopify, always use productFrequencies\n // this is necessary to handle cases where different product variants have different selling plans associated with them\n return productFrequencies[safeProductId(productId)] || {};\n } else {\n // productFrequencies are only populated for Shopify\n // fall back to the old \"global\" frequency values if it is not set\n // these would only be present if the merchant explicitly called `offers.config({ frequencies: [...] })`, so they generally won't be defined\n return {\n frequencies: oldFrequencies,\n frequenciesEveryPeriod: oldFrequenciesEveryPeriod,\n frequenciesText: oldFrequenciesText,\n defaultFrequency: oldDefaultFrequency\n };\n }\n }\n )\n);\n\n// this selector is only called when an action is dispatched, so we don't need to memoize\n// other selectors are called whenever the Redux state is updated\nexport const makeFrequencyForPrepaidShipmentsSelector = (product: BaseProduct, prepaidShipments: number) =>\n createSelector(\n prepaidSellingPlansSelector,\n makeProductFrequenciesSelector(product.id),\n (prepaidSellingPlans, { frequencies }) => {\n if (prepaidShipments) {\n const productId = safeProductId(product.id);\n const plan = prepaidSellingPlans[productId]?.find(p => p.numberShipments === prepaidShipments);\n return plan ? plan.sellingPlan : null;\n }\n return frequencies[0];\n }\n );\n\nexport const makePrepaidSellingPlansSelector = (product: string) =>\n createSelector(prepaidSellingPlansSelector, prepaidSellingPlans => {\n const productId = safeProductId(product);\n return prepaidSellingPlans[productId] || [];\n });\n\n/** Determine the discounted price of the product, based on the incentives returned from the Offers endpoint. This assumes a pay-as-you-go subscription. */\nexport const makeDiscountedProductPriceSelector = memoize((productId: string) =>\n createSelector(\n (state: State) => state.price || {},\n (state: State) => state.incentives || {},\n (state: State) => state.config.storeCurrency,\n (prices, incentives, currency) => {\n const productPriceObj = prices[safeProductId(productId)];\n if (productPriceObj === undefined || productPriceObj === null || !currency) return {};\n\n const productPrice = productPriceObj.value;\n let regularPrice = productPrice;\n let subscriptionPrice = productPrice;\n\n const productIncentives = incentives[safeProductId(productId)];\n const incentive = productIncentives?.initial.find(findRelevantIncentive);\n\n let formatted_discount = '';\n\n if (incentive) {\n if (incentive.type === 'Discount Percent') {\n // note: productPrice is in cents ($10 => 1000), so we round to the nearest whole number after applying the discount\n subscriptionPrice = Math.round((productPrice * (100 - incentive.value)) / 100);\n formatted_discount = percentage(incentive.value);\n } else if (incentive.type === 'Discount Amount' && currency === 'USD') {\n // for now, we only support USD for \"dollar-off\" discounts\n // productPrice is in cents, while the incentive value is in dollars, so we multiply by 100\n subscriptionPrice = Math.max(0, productPrice - Math.round(incentive.value * 100));\n }\n }\n return {\n regularPrice: money(regularPrice, currency),\n subscriptionPrice: money(subscriptionPrice, currency),\n discountRate: formatted_discount || money(regularPrice - subscriptionPrice, currency)\n };\n }\n )\n);\n\nconst validIncentiveStandards = [INCENTIVE_STANDARD_TYPES.PROGRAM_WIDE, INCENTIVE_STANDARD_TYPES.PSI];\n\nfunction findRelevantIncentive(incentive: Incentive) {\n return (\n incentive.object === 'item' &&\n (incentive.type === 'Discount Percent' || incentive.type === 'Discount Amount') &&\n // only attempt to determine a discount if the incentive is standardized, i.e. we have a criteria object\n incentive.criteria &&\n // note: the API should return either a PSI or a program-wide, not both\n incentive.criteria.node_type === 'PREMISE' &&\n validIncentiveStandards.includes(incentive.criteria.standard)\n );\n}\n\n/**\n * Convert a string from camel case to kebab case.\n */\nexport const kebabCase = (string: string) => {\n return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();\n};\n\nexport const getFallbackValue = (element: HTMLElement & { offer: OfferElement }, key: string, defaultValue?) =>\n (element && element.hasAttribute && element.hasAttribute(kebabCase(key)) && element[key]) ||\n (element.offer && typeof (element.offer[key] !== 'undefined') && element.offer[key]) ||\n defaultValue;\n\n/**\n * Returns a list of opted in products id from the state\n */\nexport const templatesSelector = (state: State) => ({ templates: state.templates || [] });\n\n/**\n * Returns true if no selling plan has price adjustments (except for prepaid, which still use price adjustments). This means that we are calculating the subscription discount using a Shopify Discount Function instead of that information being stored in the selling plan.\n * Generally, the Shopify Discount Function is used when the merchant is using standard flex incentives, i.e. the offer profile is standardized\n */\nexport const isShopifyDiscountFunctionInUseSelector = (state: State) => {\n const plans = Object.values(state.productPlans).flat();\n\n return plans.length > 0 && plans.every(plan => plan.hasPriceAdjustments === false || plan.prepaidShipments);\n};\n\n/**\n * Pick benefit message to be rendered in PDP. Preferences are:\n * 1. Message matching the browser's locale exactly (eg \"es-MX\")\n * 2. Message matching any locale with the same language prefix (eg \"es-ES\" for \"es-MX\")\n * 3. US English message (\"en-US\")\n * Returns null when none are present \u2014 the incentive is then skipped.\n */\nconst resolveLocaleMessage = (localeMap: Record<string, string>): string | null => {\n if (!localeMap || typeof localeMap !== 'object') return null;\n\n const enUS = 'en-US';\n const browserLocale = navigator?.language || enUS;\n const langPrefix = browserLocale.split('-')[0];\n\n const partialMatch = Object.keys(localeMap).find(key => key !== browserLocale && key.split('-')[0] === langPrefix);\n\n const msg = localeMap[browserLocale] || localeMap[partialMatch] || localeMap[enUS];\n return typeof msg === 'string' && msg.length > 0 ? msg : null;\n};\n\n/**\n * Walks the product's applicable incentives (initial first, then ongoing) and\n * returns the deduped list of messages \u2014 one per unique incentive id that\n * (a) was present in the offer response's `incentives_display_enhanced` and\n * (b) has a configured benefit message in the active locale. Returns { messages: [] }\n * when no qualifying incentive has a matching message.\n */\nexport const makeBenefitMessagesSelector = memoize(\n (product: BaseProduct) =>\n createSelector(\n (state: State) => (state.incentives || {})[safeProductId(product?.id)],\n (state: State) => state.benefitMessages || {},\n (productIncentives, benefitMap) => {\n if (!productIncentives) return { messages: [] as string[] };\n\n const isPreview = window?.og?.previewMode;\n const seenIds = new Set<string>();\n const seenMessages = new Set<string>();\n\n [productIncentives.initial, productIncentives.ongoing].forEach(list => {\n (list || []).forEach(incentive => {\n if (!isPreview && !incentive?.enhanced) return;\n const id = incentive.id;\n if (!id || seenIds.has(id)) return;\n seenIds.add(id);\n const msg = resolveLocaleMessage(benefitMap[id]);\n if (!msg) return;\n seenMessages.add(msg);\n });\n });\n\n return { messages: [...seenMessages] };\n }\n ),\n product => JSON.stringify(product)\n);\n", "import { ShopifySellingPlanGroupsEntity, ShopifySellingPlansEntity } from './types/shopify';\n\nexport const money = (val: number, currency: string) =>\n val === null\n ? ''\n : new Intl.NumberFormat(navigator.language, {\n style: 'currency',\n currency\n }).format(val / 100);\n\nexport const percentage = val => `${val}%`;\n\nexport const DEFAULT_PAY_AS_YOU_GO_GROUP_NAME = 'Subscribe and Save';\nconst EXPERIMENT_SHOPIFY_APP_ID_PREFIX = 'ordergroove-subscribe-and-save-';\n\n// returns the non-prepaid OG selling plan to use for displaying frequencies\nexport const getPayAsYouGoSellingPlanGroup = (sellingPlanGroups: ShopifySellingPlanGroupsEntity[] = []) => {\n // retrieve an OG Default or PSFL Selling Plan Group, preferring to return PSFL groups if they exist\n const productSpecificFrequencySellingPlanGroup = sellingPlanGroups.find(isProductSpecificFrequencySellingPlanGroup);\n\n return (\n productSpecificFrequencySellingPlanGroup ||\n sellingPlanGroups.find(isDefaultSellingPlanGroup) ||\n sellingPlanGroups.find(isExperimentSellingPlanGroup)\n );\n};\n\n// returns OG selling plan groups that are not prepaid\nexport const getPayAsYouGoSellingPlanGroups = (sellingPlanGroups: ShopifySellingPlanGroupsEntity[] = []) => {\n return sellingPlanGroups.filter(\n group =>\n isDefaultSellingPlanGroup(group) ||\n isProductSpecificFrequencySellingPlanGroup(group) ||\n isExperimentSellingPlanGroup(group)\n );\n};\n\nconst isDefaultSellingPlanGroup = (group: ShopifySellingPlanGroupsEntity) =>\n // we need to check name or app_id - the app_id is newer and not all selling plans have it\n // the default group name is only applied to the default selling plan group\n // flex incentives selling plan groups have a different name but the same subscribe-and-save app ID\n group.name === DEFAULT_PAY_AS_YOU_GO_GROUP_NAME || group.app_id === 'ordergroove-subscribe-and-save';\n\nexport const isProductSpecificFrequencySellingPlanGroup = (group: ShopifySellingPlanGroupsEntity) =>\n group.name.startsWith('og_psfl') || group.app_id === 'ordergroove-product-specific-frequency-list';\n\nexport const isExperimentSellingPlanGroup = (group: ShopifySellingPlanGroupsEntity) =>\n // @ts-expect-error 18047\n group.app_id?.startsWith(EXPERIMENT_SHOPIFY_APP_ID_PREFIX);\n\nexport const getPayAsYouGoSellingPlan = (sellingPlans: ShopifySellingPlansEntity[]) => {\n const group = getPayAsYouGoSellingPlanGroup(sellingPlans.map(plan => plan.group));\n return sellingPlans.find(plan => plan.group === group);\n};\n\nexport function sellingPlansToFrequencies(sellingPlanGroup: ShopifySellingPlanGroupsEntity) {\n return sellingPlanGroup?.selling_plans?.map(({ id }) => `${id}`);\n}\n\nexport function sellingPlansToEveryPeriod(sellingPlanGroup: ShopifySellingPlanGroupsEntity) {\n return sellingPlanGroup?.selling_plans\n ?.map(({ options }) => options || [])\n .flat()\n .map(({ value }) => textToFreq(value));\n}\n\nexport function textToFreq(text) {\n const period = ['day', 'week', 'month'].findIndex(it => text.toLowerCase().includes(it)) + 1;\n const every = (text.match(/(\\d+)/) || ['', 1])[1];\n if (every && period) {\n return `${every}_${period}`;\n }\n return null;\n}\n\nexport function getPrepaidShipments(sellingPlan) {\n const shipments = sellingPlan?.options.find(({ name }) => name === 'Shipment amount')?.value.split(' ')[0];\n return shipments ? Number(shipments) : undefined;\n}\n\nexport function getDefaultPrepaidOption<T>(options: T[]): T {\n // prefer the second plan by default, which has more prepaid shipments\n return options[1] || options[0];\n}\n", "import platform from '../platform';\nimport { ENV_PROD, ENV_STAGING, STAGING_STATIC_HOST, STATIC_HOST } from './constants';\nimport { isSameProduct } from './selectors';\nimport { ConfigState } from './types/reducer';\n\nexport function onReady(fn) {\n if (document.readyState === 'loading') {\n window.addEventListener('DOMContentLoaded', fn);\n } else {\n fn();\n }\n}\n\nexport function getMainJs(): HTMLScriptElement {\n return document.querySelector(\n [\n `script[src^=\"https://${STATIC_HOST}\"]`,\n `script[src^=\"https://${STAGING_STATIC_HOST}\"]`,\n `script[src^=\"http://${STATIC_HOST}\"]`,\n `script[src^=\"http://${STAGING_STATIC_HOST}\"]`\n ].join(',')\n ) as HTMLScriptElement;\n}\n/**\n *\n * @returns array of two elements [merchantId, env];\n */\nexport function resolveEnvAndMerchant() {\n const script = getMainJs();\n if (!script) return [];\n const url = new URL(script.src);\n const env = url.host.startsWith(ENV_STAGING) ? ENV_STAGING : ENV_PROD;\n const merchantId = url.pathname.split('/')[1];\n\n if (!env && !merchantId) return [];\n\n return [merchantId, env, script];\n}\n\nexport const safeProductId = product => {\n if (!product) return '';\n let productId = `${product.id || product}`;\n if (platform?.shopify_selling_plans) {\n // we can't avoid make offer request since we need to know the upsell group and autoship by default\n // cart offer contains <product>:<cart_id>, we care about product only\n productId = productId.split(':')[0];\n }\n return productId;\n};\n\ntype Frequencies = ConfigState['frequencies'];\ntype FrequenciesEveryPeriod = ConfigState['frequenciesEveryPeriod'];\n\n/**\n * Returns the OG frequency if platform is running on selling plans\n */\nexport const safeOgFrequency = (\n initialFrequency: string | null,\n frequencies: Frequencies,\n frequenciesEveryPeriod: FrequenciesEveryPeriod\n) => {\n if (platform.shopify_selling_plans) {\n const ix = frequencies?.indexOf(initialFrequency);\n if (ix >= 0 && frequenciesEveryPeriod[ix]) {\n return frequenciesEveryPeriod[ix];\n }\n }\n return initialFrequency;\n};\n\nexport const frequencyToSellingPlan = (\n ogFrequency: string,\n frequencyConfig: {\n frequencies: Frequencies;\n frequenciesEveryPeriod: FrequenciesEveryPeriod;\n }\n) => {\n // og frequency contains underscore\n if (!`${ogFrequency}`.includes('_')) return ogFrequency;\n const { frequencies, frequenciesEveryPeriod } = frequencyConfig;\n const ix = frequenciesEveryPeriod?.indexOf(ogFrequency);\n if (ix >= 0 && frequenciesEveryPeriod[ix]) {\n return frequencies[ix];\n }\n\n // if we can't find the OG frequency, but we have selling plans, return the first selling plan\n if (frequencies?.length > 0 && frequenciesEveryPeriod?.length > 0) {\n console.warn(`Unable to find selling plan match for frequency ${ogFrequency}; falling back to first selling plan`);\n return frequencies[0];\n }\n\n return ogFrequency;\n};\n\n/**\n * Attempts to auto initialize the offer library reading the merchantId and env from\n * integration script i.e. <script src=\"http://static.ordergroove....\"/>.\n * Useful when local develop using http redirects\n */\nexport function autoInitializeOffers(offers) {\n if (offers.isReady()) return;\n\n console.info('OG offers are auto initializing');\n\n const [merchantId, env] = resolveEnvAndMerchant();\n if (!env && !merchantId) return;\n const script = document.createElement('script');\n script.onload = () => console.info('OG pull initialization chunk for merchant', merchantId, env);\n script.onerror = () => offers.initialize(merchantId, env);\n script.src = `${window.location.protocol}//${\n env === ENV_PROD ? STATIC_HOST : STAGING_STATIC_HOST\n }/${merchantId}/main.js?initOnly=true`;\n\n document.head.appendChild(script);\n}\n\nexport const clearCookie = cookieId => {\n // clear existing OG auth cookie\n document.cookie = `${cookieId}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\n};\n\nexport function getCookieValue(cookieId) {\n const cookie = document.cookie.match(`(^|;) ?${cookieId}=([^;]*)(;|$)`);\n return cookie ? cookie[2] : null;\n}\nexport const isOgFrequency = (frequency: string) => !!(frequency && frequency?.includes('_'));\n\nexport const getFirstSellingPlan = (frequencies: string[] = []) => frequencies?.[0] || null;\n\nexport const hasShopifySellingPlans = (sellingPlans = [], frequenciesEveryPeriod = []) =>\n !!(platform?.shopify_selling_plans && sellingPlans.length && frequenciesEveryPeriod.length);\n\nexport const mapFrequencyToSellingPlan = (\n sellingPlans: string[],\n frequenciesEveryPeriod: string[],\n frequency: string\n) => {\n if (sellingPlans.length !== frequenciesEveryPeriod.length) {\n return null;\n }\n\n const index = frequenciesEveryPeriod.findIndex(it => it === frequency);\n\n if (index >= 0) {\n return sellingPlans[index];\n }\n\n return null;\n};\n\nexport function getOrCreateHidden(parent, name, value) {\n let input = parent.querySelector(`[name=\"${name}\"]`);\n if (input && !value) {\n input.remove();\n return;\n }\n if (!input && value) {\n input = document.createElement('input');\n input.type = 'hidden';\n input.name = name;\n parent.appendChild(input);\n }\n if (input) {\n input.value = value;\n }\n}\n\n/**\n * Returns the first matching product if it exists, or an empty object if it doesn't.\n * @param state - the optedin/optedout state array to search\n * @param product - the product to search for\n * @returns {[any, any[]]} - a two item array where the first item is the matching product and the second is the remaining items from the original state.\n */\nexport function getMatchingProductIfExists(state, product) {\n const [[oldone], rest] = state.reduce(\n (acc, val) => acc[isSameProduct(product, val) ? 0 : 1].push(val) && acc,\n [[], []]\n );\n\n return [oldone || {}, rest || []];\n}\n", "import { resolveAuth } from '@ordergroove/auth';\nimport * as constants from './constants';\nimport { api } from './api';\nimport { safeOgFrequency } from './utils';\nimport {\n makeFrequencyForPrepaidShipmentsSelector,\n makePrepaidSellingPlansSelector,\n makeProductFrequenciesSelector\n} from './selectors';\n\nexport const optinProduct = (product, frequency, offer) => ({\n type: constants.OPTIN_PRODUCT,\n payload: { product, frequency, offer }\n});\n\nexport const optoutProduct = (product, offer) => ({\n type: constants.OPTOUT_PRODUCT,\n payload: { product, offer }\n});\n\nexport const productHasChangedComponents = (newProduct, product) => ({\n type: constants.PRODUCT_HAS_CHANGED,\n payload: { newProduct, product }\n});\n\nexport const productChangeFrequency = (product, frequency, offer) => ({\n type: constants.PRODUCT_CHANGE_FREQUENCY,\n payload: { product, frequency, offer }\n});\n\nexport const productChangePrepaidShipments = (product, prepaidShipments, offer) => (dispatch, getState) => {\n // this is a thunk so that we access the state for the selector\n const frequency = makeFrequencyForPrepaidShipmentsSelector(product, prepaidShipments)(getState());\n dispatch({\n type: constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS,\n payload: { product, prepaidShipments, offer, frequency }\n });\n};\n\nexport const cartProductKeyHasChanged = (oldCartProductKey, newCartProductKey) => ({\n type: constants.CART_PRODUCT_KEY_HAS_CHANGED,\n payload: { oldCartProductKey, newCartProductKey }\n});\n\nexport const concludeUpsell = product => ({\n type: constants.CONCLUDE_UPSELL,\n payload: { product }\n});\n\nexport const setMerchantId = merchantId => ({\n type: constants.SET_MERCHANT_ID,\n payload: merchantId\n});\n\nexport const createSessionId = merchantId => ({\n type: constants.CREATED_SESSION_ID,\n payload: `${merchantId}.${Math.floor(Math.random() * 999999)}.${Math.round(new Date().getTime() / 1000.0)}`\n});\n\nexport const requestAuth = payload => ({\n type: constants.REQUEST_AUTH,\n payload\n});\n\nexport const authorize = (merchantId, sigfield, ts, sig) => ({\n type: constants.AUTHORIZE,\n payload: { public_id: merchantId, sig_field: sigfield, ts, sig }\n});\n\nexport const unauthorized = reason => ({\n type: constants.UNAUTHORIZED,\n payload: reason\n});\n\nexport const setAuthUrl = url => ({\n type: constants.SET_AUTH_URL,\n payload: url\n});\n\nexport const fetchDone = initiator => ({\n type: constants.RECEIVE_FETCH,\n payload: initiator\n});\n\n/**\n *\n * @param {*} authResolver For mock purpose.\n */\nexport const fetchAuth = (authResolver = resolveAuth) =>\n function fetchAuthThunk(dispatch, getState) {\n if (window.og && window.og.previewMode)\n return dispatch(unauthorized({ message: 'Offers are running in preview mode' }));\n\n const { merchantId, authUrl } = getState();\n\n const requestAction = requestAuth(authUrl);\n dispatch(requestAction);\n\n return authResolver(authUrl)\n .then(\n ({ sig_field, ts, sig }) => dispatch(authorize(merchantId, sig_field, ts, sig)),\n err => dispatch(unauthorized(err))\n )\n .finally(() => dispatch(fetchDone(requestAction)));\n };\n\nexport const requestOrders = (status, ordering) => ({\n type: constants.REQUEST_ORDERS,\n payload: { status, ordering }\n});\n\nexport const receiveOrders = response => ({\n type: constants.RECEIVE_ORDERS,\n payload: response\n});\n\nexport const receiveItems = response => ({\n type: constants.RECEIVE_ORDER_ITEMS,\n payload: response\n});\n\n/**\n *\n * @param {*} authResolver For mock purpose.\n */\nexport const fetchOrders = (status = 1, ordering = 'place') =>\n function fetchOrdersThunk(dispatch, getState) {\n const {\n environment: { legoUrl },\n auth\n } = getState();\n\n if (!auth) return dispatch(unauthorized('No auth set.'));\n\n const requestAction = requestOrders(status, ordering);\n dispatch(requestAction);\n\n return api\n .fetchOrders(legoUrl, auth, status, ordering)\n .then(\n response => {\n if (response.results) {\n dispatch(receiveOrders(response));\n const nextOrderId = (response.results[0] || {}).public_id;\n if (nextOrderId) {\n return api.fetchItems(legoUrl, auth, nextOrderId).then(res => dispatch(receiveItems(res)));\n }\n }\n dispatch(unauthorized(response.detail));\n return null;\n },\n err => dispatch(unauthorized(err))\n )\n .finally(() => dispatch(fetchDone(requestAction)));\n };\n\nexport const setEnvironment = env => {\n switch (env) {\n case constants.ENV_LOCAL:\n return {\n type: constants.SET_ENVIRONMENT_LOCAL,\n payload: env\n };\n case constants.ENV_DEV:\n return {\n type: constants.SET_ENVIRONMENT_DEV,\n payload: env\n };\n case constants.ENV_STAGING:\n return {\n type: constants.SET_ENVIRONMENT_STAGING,\n payload: env\n };\n case constants.ENV_PROD:\n return {\n type: constants.SET_ENVIRONMENT_PROD,\n payload: env\n };\n default:\n throw new Error(`${env} is not a supported environment`);\n }\n};\n\n/**\n * dispatchs an createSessionId() if sessionId is not present\n */\nexport const requestSessionId = () => (dispatch, getState) => {\n const { merchantId, sessionId } = getState();\n if (!sessionId || (merchantId && !sessionId.startsWith(merchantId))) {\n dispatch(createSessionId(merchantId));\n }\n return sessionId;\n};\n\nexport const receiveOffer = (response, offer, productId) => (dispatch, getState) => {\n // this is a thunk so that we access the state for the selector\n const state = getState();\n const frequencyConfig = makeProductFrequenciesSelector(productId)(state);\n const prepaidSellingPlans = makePrepaidSellingPlansSelector(productId)(state);\n dispatch({\n type: constants.RECEIVE_OFFER,\n payload: { ...response, offer, frequencyConfig, prepaidSellingPlans }\n });\n};\n\nexport const fetchResponseError = err => ({\n type: constants.FETCH_RESPONSE_ERROR,\n payload: err\n});\n\nexport const requestOffer = (product, module = constants.DEFAULT_OFFER_MODULE, offer) => ({\n type: constants.REQUEST_OFFER,\n payload: { product, module, offer }\n});\n\nexport const fetchOffer = requestOffer;\n\nexport const checkout = () => ({\n type: constants.CHECKOUT\n});\n\nexport const requestCreateOneTime = (product, order, quantity, offerId) => ({\n type: constants.REQUEST_CREATE_IU_ORDER,\n payload: { product, order, quantity, offerId }\n});\n\nexport const receiveCreateOneTime = payload => ({\n type: constants.CREATE_ONE_TIME,\n payload\n});\n\nexport const requestConvertOneTimeToSubscription = (item, frequency) => ({\n type: constants.REQUEST_CONVERT_ONE_TIME,\n payload: { item, frequency }\n});\n\nexport const receiveConvertOneTime = (response, product) => ({\n type: constants.CONVERT_ONE_TIME,\n payload: { response, product }\n});\n\nexport const createIu = (product, order, quantity, subscribed = false, initialFrequency = null) =>\n function createIuThunk(dispatch, getState) {\n const state = getState();\n const {\n auth,\n environment: { legoUrl },\n previewUpsellOffer,\n offerId: offer,\n sessionId\n } = state;\n\n if (!auth) return dispatch(unauthorized('No auth set.'));\n\n const { frequencies, frequenciesEveryPeriod } = makeProductFrequenciesSelector(product.id)(state);\n const frequency = safeOgFrequency(initialFrequency, frequencies, frequenciesEveryPeriod);\n\n const requestAction = requestCreateOneTime(product, order, quantity, offer);\n\n dispatch(requestAction);\n\n return (\n previewUpsellOffer\n ? Promise.resolve({ legoUrl, product, order, quantity, offer })\n : api.createOneTime(legoUrl, auth, product.id, order, quantity, offer)\n )\n .then(\n item => {\n dispatch(receiveCreateOneTime(item));\n if (subscribed) {\n dispatch(requestConvertOneTimeToSubscription(item, frequency));\n return (\n previewUpsellOffer\n ? Promise.resolve({ item, frequency })\n : api.convertOneTimeToSubscription(legoUrl, auth, item, frequency, offer, sessionId)\n ).then(\n response => dispatch(receiveConvertOneTime(response, product)),\n err => dispatch(fetchResponseError(err))\n );\n }\n return item;\n },\n err => dispatch(fetchResponseError(err))\n )\n\n .finally(() => dispatch(fetchDone(requestAction)));\n };\n\nexport const setLocale = payload => ({\n type: constants.SET_LOCALE,\n payload\n});\n\nexport const setConfig = payload => ({\n type: constants.SET_CONFIG,\n payload\n});\n\nexport const setBenefitMessages = payload => ({\n type: constants.SET_BENEFIT_MESSAGES,\n payload\n});\n\nexport const addTemplate = (selector, markup, config) => ({\n type: constants.ADD_TEMPLATE,\n payload: { selector, markup, config }\n});\n\nexport const setTemplates = templates => ({\n type: constants.SET_TEMPLATES,\n payload: templates\n});\n\nexport const setFirstOrderPlaceDate = (product, firstOrderPlaceDate) => ({\n type: constants.SET_FIRST_ORDER_PLACE_DATE,\n payload: { product, firstOrderPlaceDate }\n});\n\nexport const setProductToSubscribe = (product, productToSubscribe) => ({\n type: constants.SET_PRODUCT_TO_SUBSCRIBE,\n payload: { product, productToSubscribe }\n});\n\n/**\n * @param {import('../core/types/api').MerchantSettings} settings\n */\nexport const receiveMerchantSettings = settings => ({\n type: constants.RECEIVE_MERCHANT_SETTINGS,\n payload: settings\n});\n", "import { throttle } from 'throttle-debounce';\nimport * as constants from './constants';\nimport { saveState } from './localStorage';\n\nexport const dispatchEvent = (name, detail, el = document) =>\n el.dispatchEvent(\n new CustomEvent(name, {\n detail\n })\n );\n\nexport const dispatchOptinChangedEvent =\n optedIn =>\n ({ payload: { product: { id: productId, components } = {} } = {} } = {}) =>\n setTimeout(\n () =>\n dispatchEvent('optin-changed', {\n productId,\n components,\n optedIn\n }),\n 0\n );\n\nexport const conditionals = [\n {\n expressions: [\n ({ type } = {}) => type === constants.OPTIN_PRODUCT,\n ({ type } = {}) => type === constants.PRODUCT_CHANGE_FREQUENCY\n ],\n fn: dispatchOptinChangedEvent(true)\n },\n {\n expressions: [({ type } = {}) => type === constants.OPTOUT_PRODUCT],\n fn: dispatchOptinChangedEvent(false)\n }\n];\n\nexport const dispatchMiddleware = store => next => action => {\n const state = store.getState();\n conditionals.forEach(conditional => {\n if (conditional.expressions.some(expression => expression(action, state))) conditional.fn(action);\n });\n\n next(action);\n};\n\n/**\n * Middleware that forwards sensitive actions to DOM events\n * events:\n * - og-receive-offer\n * - og-optout-product\n * - og-optin-product\n * - og-product-change-frequency\n * event.details contains the action payload\n * event.details corresponds to the offer DOM element if available or document\n *\n * If event.preventDefault() is called, the action being fired will not change the state.\n * @param {*} store\n * @returns\n */\nexport const offerEvents = _store => next => action => {\n let ev;\n /* eslint-disable no-fallthrough */\n switch (action.type) {\n // event: og-receive-offer\n case constants.RECEIVE_OFFER:\n // event: og-optout-product\n case constants.OPTOUT_PRODUCT:\n // event: og-optin-product\n case constants.OPTIN_PRODUCT:\n // event: og-product-change-frequency\n case constants.PRODUCT_CHANGE_FREQUENCY:\n ev = new CustomEvent(`og-${action.type.toLowerCase().replace(/_/g, '-')}`, {\n bubbles: true,\n cancelable: true,\n detail: action.payload\n });\n (action.payload?.offer || document).dispatchEvent(ev);\n break;\n default:\n }\n\n if (!ev?.defaultPrevented) next(action);\n};\n\nexport const localStorageMiddleware = store => next => action => {\n next(action);\n\n const callToSave = throttle(500, () => {\n saveState({\n ...store.getState()\n });\n });\n\n if (action.type !== constants.LOCAL_STORAGE_CHANGE) {\n callToSave();\n }\n};\n", "import { createSessionId, fetchAuth } from './actions';\nimport {\n CREATED_SESSION_ID,\n SET_ENVIRONMENT_LOCAL,\n SET_ENVIRONMENT_DEV,\n SET_ENVIRONMENT_PROD,\n SET_ENVIRONMENT_STAGING,\n SET_MERCHANT_ID,\n READY\n} from './constants';\nimport { listenLocalStorageChanges } from './localStorage';\n\nexport const waitFor = () => {\n let resolve, reject;\n return [\n new Promise((yes, no) => {\n resolve = yes;\n reject = no;\n }),\n resolve,\n reject\n ];\n};\n/**\n * Middleware that awaits offers being initialized and resumes the regular actions after.\n * @param {*} store\n * @returns\n */\nexport function waitUntilOffersReady(store) {\n const [waitForSetEnv, resolveEnv] = waitFor();\n const [waitForMerchantId, resolveMerchantId] = waitFor();\n const [waitForSessionId, resolveSessionId] = waitFor();\n\n waitForMerchantId.then(merchantId => {\n const { sessionId } = store.getState();\n if (!sessionId || (merchantId && !sessionId.startsWith(merchantId))) {\n store.dispatch(createSessionId(merchantId));\n } else {\n resolveSessionId(sessionId);\n }\n });\n\n const waitForReady = Promise.all([waitForMerchantId, waitForSetEnv, waitForSessionId]);\n\n waitForReady.then(() => {\n store.dispatch({ type: READY, payload: {} });\n window.addEventListener('storage', listenLocalStorageChanges(store));\n if (!store.getState().auth?.ts) {\n store.dispatch(fetchAuth());\n }\n });\n\n return next => async action => {\n if (\n SET_ENVIRONMENT_LOCAL === action.type ||\n SET_ENVIRONMENT_DEV === action.type ||\n SET_ENVIRONMENT_STAGING === action.type ||\n SET_ENVIRONMENT_PROD === action.type\n ) {\n resolveEnv(action.payload);\n } else if (SET_MERCHANT_ID === action.type) {\n resolveMerchantId(action.payload);\n } else if (CREATED_SESSION_ID === action.type) {\n resolveSessionId(action.payload);\n } else {\n await waitForReady;\n }\n next(action);\n };\n}\n", "import { fetchDone, fetchResponseError, receiveOffer } from './actions';\nimport api from './api';\nimport { DEFAULT_OFFER_MODULE, REQUEST_OFFER } from './constants';\nimport { safeProductId } from './utils';\n\nexport function offerRequestMiddleware(store) {\n return next => action => {\n if (action.type === REQUEST_OFFER) {\n const {\n merchantId,\n sessionId,\n environment: { apiUrl }\n } = store.getState();\n\n const productId = safeProductId(action.payload.product);\n if (productId)\n api\n .fetchOffer(\n apiUrl,\n merchantId,\n sessionId,\n productId,\n action.payload.module || DEFAULT_OFFER_MODULE,\n action.payload.searchParams\n )\n .then(\n response => store.dispatch(receiveOffer(response, action.payload.offer, productId)),\n err => store.dispatch(fetchResponseError(err))\n )\n .finally(() => store.dispatch(fetchDone(action)));\n }\n return next(action);\n };\n}\n", "import { READY, RECEIVE_MERCHANT_SETTINGS, REQUEST_OFFER, SET_EXPERIMENT_VARIANT, SETUP_PRODUCT } from './constants';\nimport murmur from 'murmurhash-js';\nimport { waitFor } from './waitUntilOffersReady';\nimport { isExperimentSellingPlanGroup } from '../shopify/utils';\n\n/**\n * Returns the index of a variant based on the provided key and variants.\n * The index is determined by the weighted distribution of the variants.\n *\n * @param {string} key - The key used to determine the variant index.\n * @param {object[]} variants - An array of objects containing the variant weights.\n * @return {number} The index of the selected variant.\n */\nfunction getVariantIx(key, variants) {\n const weights = variants.map(variant => variant.weight);\n if (weights.reduce((a, b) => a + b, 0) !== 100) {\n console.error('OG: Sum of weights for variants must be 100. Defaulting to last variant.');\n }\n const m = murmur.murmur3(key, 0);\n const n = m % 100;\n\n let lower_bound = 0;\n\n for (let i = 0; i < variants.length; i++) {\n const v = variants[i];\n const upper_bound = lower_bound + v.weight;\n\n // If a variant has a weight of 0, ignore it\n if (v.weight > 0 && n < upper_bound) {\n return i;\n }\n\n lower_bound = upper_bound;\n }\n return variants.length - 1;\n}\n\n/**\n * Reduces the state of experiments based on the provided action.\n *\n * @param {object} state - The current state of experiments.\n * @param {object} action - The action to be applied to the state.\n * @return {object} The updated state of experiments.\n */\nexport function experimentsReducer(state = {}, action) {\n switch (action.type) {\n case RECEIVE_MERCHANT_SETTINGS:\n return { ...state, ...action.payload.experiments };\n\n case SET_EXPERIMENT_VARIANT:\n return {\n ...state,\n currentVariant: action.payload.index,\n offerProfileId: action.payload.parameters?.offer_profile_public_id\n };\n default:\n return state;\n }\n}\n\n/**\n * Resolve the Shopify product setup when in an experiment.\n * @param {object} variant - The experiment variant assigned to the customer.\n * @param {object} product - The Shopify product object.\n * @param {object} experimentSettings - The experiment settings object containing the public ID and variants.\n * @return {object} The modified product object with OG selling plan groups filtered out.\n *\n * This function filters a Shopify product's selling plan groups to only include the group\n * associated with the assigned experiment variant, and updates the product's variants to\n * only include selling plan allocations from that group. It returns the modified product\n * object.\n */\nfunction resolveShopifySetupProductWhenExperiment(variant, product, experimentSettings) {\n // When an experiment is running, you may have multiple selling plan groups with the app_id \"ordergroove-subscribe-and-save-{experiment_variant_id}\"\n // We want offers to use only the selling plan group that matches the assigned experiment variant\n // Note: whether or not you have variant-specific selling plan groups depends on if the Shopify Discount Function is being used. If it is, then the selling plan groups do not contain price adjustments and there is only a single selling plan group (all variants use the same group).\n if (!variant) return;\n\n if (experimentSettings.variants.length === 0) return;\n\n const sellingPlanGroups = product.selling_plan_groups.filter(isExperimentSellingPlanGroup);\n\n if (sellingPlanGroups.length !== experimentSettings.variants.length) return;\n\n const sellingPlanGroup = sellingPlanGroups.find(({ app_id }) => app_id.endsWith(variant.public_id));\n\n if (!sellingPlanGroup) return;\n\n return {\n ...product,\n selling_plan_groups: [sellingPlanGroup],\n\n variants: product.variants.map(({ selling_plan_allocations, ...it }) => ({\n ...it,\n selling_plan_allocations: selling_plan_allocations.filter(\n ({ selling_plan_group_id }) => selling_plan_group_id === sellingPlanGroup.id\n )\n }))\n };\n}\n\n/**\n * Retrieves the assigned experiment variant based on the provided experiment settings and session ID.\n *\n * @param {object} experimentSettings - The experiment settings object containing the public ID and variants.\n * @param {string} sessionId - The unique session ID used to determine the variant assignment.\n * @return {object} An object containing the assigned variant and its index.\n */\nexport function getAssignedExperimentVariant(experimentSettings, sessionId) {\n const experimentPublicId = experimentSettings?.public_id;\n\n if (!experimentPublicId) {\n return null;\n }\n const variants = experimentSettings.variants;\n const index = getVariantIx(`${experimentPublicId}|${sessionId}`, variants);\n const variant = variants[index];\n\n return { ...variant, index };\n}\n\n/**\n * A middleware function that handles experiment-related actions.\n *\n *\n * @param {object} store - The Redux store object.\n * @return {function} A function that takes the next middleware function and an action as arguments.\n */\nexport function experimentsMiddleware(store) {\n const [waitForReady, resolveReady] = waitFor();\n\n let variant, experimentSettings;\n\n return next => async action => {\n if (action.type === READY) {\n resolveReady();\n } else if (action.type === RECEIVE_MERCHANT_SETTINGS) {\n await waitForReady;\n experimentSettings = action.payload.experiments;\n\n const { sessionId } = store.getState();\n\n variant = getAssignedExperimentVariant(experimentSettings, sessionId);\n\n if (variant) {\n store.dispatch({\n type: SET_EXPERIMENT_VARIANT,\n payload: variant\n });\n }\n } else if (action.type === REQUEST_OFFER) {\n await waitForReady;\n if (variant) {\n action.payload.searchParams = {\n ...action.payload.searchParams,\n variant: variant.public_id\n };\n }\n } else if (action.type === SETUP_PRODUCT) {\n await waitForReady;\n const newProduct = resolveShopifySetupProductWhenExperiment(variant, action.payload.product, experimentSettings);\n if (newProduct) {\n return next({\n type: SETUP_PRODUCT,\n payload: {\n ...action.payload,\n experiments: true,\n originalPayload: action.payload,\n product: newProduct\n }\n });\n }\n }\n\n return next(action);\n };\n}\n", "import { createStore, compose, applyMiddleware } from 'redux';\nimport thunk from 'redux-thunk';\n\nimport { loadState } from './localStorage';\nimport { dispatchMiddleware, localStorageMiddleware, offerEvents } from './middleware';\nimport { waitUntilOffersReady } from './waitUntilOffersReady';\nimport { offerRequestMiddleware } from './offerRequest';\nimport { experimentsMiddleware } from './experiments';\n\nexport function makeStore(reducer, ...extraMiddlewares) {\n if (window.og && window.og.store) return window.og.store;\n\n const isPreviewMode = window.og && window.og.previewMode;\n\n const composeEnhancers =\n typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__\n ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({\n name: 'Ordergroove Offers'\n })\n : compose;\n\n const middlewares = [\n waitUntilOffersReady,\n thunk,\n experimentsMiddleware,\n offerRequestMiddleware,\n dispatchMiddleware,\n offerEvents\n ];\n\n let initial = {};\n\n if (!isPreviewMode) {\n try {\n initial = loadState();\n middlewares.push(localStorageMiddleware);\n } catch (err) {\n // localStorage not available during preview in sandbox\n }\n }\n\n const enhancer = composeEnhancers(applyMiddleware(...middlewares, ...extraMiddlewares.filter(it => it)));\n const store = createStore(reducer, initial, enhancer);\n\n window.og = window.og || {};\n window.og.store = store;\n return store;\n}\n\nexport default makeStore;\n", "export const createIsMessageAllowed = allowedOrigin => ev => allowedOrigin.indexOf(ev.origin) >= 0;\nexport default createIsMessageAllowed;\n", "import { createIsMessageAllowed } from './core/createIsMessageAllowed';\n\nconst allowedOrigin = [\n 'https://rc3.ordergroove.com',\n 'https://rc3.stg.ordergroove.com',\n 'https://rc3-beta.stg.ordergroove.com',\n 'http://localhost:3000',\n 'http://localhost:3010',\n 'http://0.0.0.0:3010',\n window.location.origin\n];\n\nconst createBroadcastMessage = opener => (ogType, data) => {\n allowedOrigin.forEach(target => opener.postMessage({ ogType, ...data }, target));\n};\n\nexport function offersLiveEditor(opener = window.opener, og = window.og) {\n const handleReady = ev => {\n const isMessageAllowed = createIsMessageAllowed(allowedOrigin);\n const broadcastMessage = createBroadcastMessage(ev.source);\n const options = ev.data.options || {};\n\n if (isMessageAllowed(ev)) {\n if (ev.data.ogType === 'READY') {\n let publicPath = window.OG_CDN_PUBLIC_PATH || './';\n if (publicPath.startsWith('//')) publicPath = window.location.protocol + publicPath;\n if (!publicPath.endsWith('/')) publicPath += '/';\n\n import(`${publicPath}client.js`).then(({ initializeClient }) => {\n initializeClient({ isMessageAllowed, broadcastMessage, options, og });\n window.removeEventListener('message', handleReady);\n });\n }\n }\n };\n\n if (opener && opener !== window) {\n window.addEventListener('message', handleReady);\n createBroadcastMessage(opener)('READY');\n }\n}\n\nexport default offersLiveEditor;\n", "import { bindActionCreators } from 'redux';\n\nlet storeInstance = null;\n\nconst defaultMapDispatchToProps = dispatch => ({ dispatch });\n\nexport const resolveStore = _obj => {\n if (!storeInstance) throw new Error('Missing redux store.');\n return storeInstance;\n};\n\nexport const createRecalcProps = (mapStateToProps, mapDispatchToProps) => obj => {\n const { getState, dispatch } = resolveStore(obj);\n const stateProps = mapStateToProps ? mapStateToProps(getState(), obj) : {};\n const dispatchProps = mapDispatchToProps(dispatch, obj);\n\n Object.assign(obj, stateProps, dispatchProps);\n};\n\n/**\n * TODO this component can be coded as regular connect function. Instead of making the component\n * tied to stateChanged connect can accept mapStateToProps?, mapDispatchToProps?\n */\nexport const connect =\n (mapStateToProps, mapDispatchToProps = defaultMapDispatchToProps) =>\n baseElement => {\n const preparedDispatch =\n typeof mapDispatchToProps === 'function'\n ? mapDispatchToProps\n : dispatch => bindActionCreators(mapDispatchToProps, dispatch);\n\n const recalcProps = createRecalcProps(mapStateToProps, preparedDispatch);\n\n return class extends baseElement {\n get store() {\n return storeInstance;\n }\n\n connectedCallback() {\n if (super.connectedCallback) {\n super.connectedCallback();\n }\n\n this._storeUnsubscribe = resolveStore(this).subscribe(() => recalcProps(this));\n recalcProps(this);\n }\n\n attributeChangedCallback(name, old, value) {\n if (super.attributeChangedCallback) super.attributeChangedCallback(name, old, value);\n if (this._storeUnsubscribe && old !== value) recalcProps(this);\n }\n\n disconnectedCallback() {\n this._storeUnsubscribe();\n if (super.disconnectedCallback) {\n super.disconnectedCallback();\n }\n }\n };\n };\n/**\n * This api will change asap\n * @deprecated\n * @param {@} _store\n */\nexport const setStore = _store => {\n storeInstance = _store;\n};\n/**\n * Only for test purpose\n */\nexport const unsetStore = () => {\n storeInstance = undefined;\n};\n\nexport default connect;\n", "import { parseFrequency } from './api';\n\n/**\n * Convert the current redux state to purchase\n * post compatible json\n */\nexport const getProductsForPurchasePost = (state = {}, productIds = []) =>\n (state.optedin || [])\n .map(optin => {\n const purchasePostObject = {\n product: optin.id,\n subscription_info: {\n components: optin.components || []\n },\n tracking_override: {\n offer: ((state.productOffer || {})[optin.id] || [])[0],\n ...(state.sessionId && { session_id: state.sessionId }),\n ...parseFrequency(optin.frequency)\n }\n };\n if (state.firstOrderPlaceDate && state.firstOrderPlaceDate[optin.id]) {\n purchasePostObject.subscription_info.first_order_place_date = state.firstOrderPlaceDate[optin.id];\n }\n if (state.productToSubscribe && state.productToSubscribe[optin.id]) {\n purchasePostObject.tracking_override.product = state.productToSubscribe[optin.id];\n }\n return purchasePostObject;\n })\n .filter(optin => optin.tracking_override.offer)\n .filter(optin => (productIds.length ? productIds.includes(optin.product) : optin));\n\n/**\n * Convert the old redux state from productPlans that was array structured:\n * {\n * '1_2': ['$15.00', '10%', '$13.50'],\n * '2_2': ['$15.00', '10%', '$13.50']\n * }\n * to a object structured one that can hold more information with keys:\n * [\n * {\n * frequency: '1_2',\n * prepaidShipments: '3' or null,\n * regularPrice: '$15.00',\n * subscriptionPrice: '$13.50',\n * discountRate: '10%'\n * },\n * ]\n *\n * @returns {import('./types/reducer').ProductPlansState}\n */\nexport const getObjectStructuredProductPlans = (productPlans = {}) => {\n const adaptedProductPlans = {};\n\n Object.entries(productPlans).forEach(([productVariant, productPlanOnArrayStructure]) => {\n Object.entries(productPlanOnArrayStructure).forEach(([frequencyAsKey, arrayPrices]) => {\n let newProductPlanStructure = {};\n if (arrayPrices && !Array.isArray(arrayPrices)) {\n newProductPlanStructure = arrayPrices;\n } else {\n newProductPlanStructure = {\n frequency: frequencyAsKey,\n prepaidShipments: null,\n regularPrice: arrayPrices[0],\n subscriptionPrice: arrayPrices[2],\n discountRate: arrayPrices[1]\n };\n }\n\n if (adaptedProductPlans[productVariant]) {\n adaptedProductPlans[productVariant].push(newProductPlanStructure);\n } else {\n adaptedProductPlans[productVariant] = [newProductPlanStructure];\n }\n });\n });\n\n return adaptedProductPlans;\n};\n\nexport default { getProductsForPurchasePost, getObjectStructuredProductPlans };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\ninterface MaybePolyfilledCe extends CustomElementRegistry {\n readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.insertBefore(start!, before);\n start = n;\n }\n };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n (container: Node, start: Node|null, end: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.removeChild(start!);\n start = n;\n }\n };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\n\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = `<!--${marker}-->`;\n\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n readonly parts: TemplatePart[] = [];\n readonly element: HTMLTemplateElement;\n\n constructor(result: TemplateResult, element: HTMLTemplateElement) {\n this.element = element;\n\n const nodesToRemove: Node[] = [];\n const stack: Node[] = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n element.content,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const {strings, values: {length}} = result;\n while (partIndex < length) {\n const node = walker.nextNode() as Element | Comment | Text | null;\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n continue;\n }\n index++;\n\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if ((node as Element).hasAttributes()) {\n const attributes = (node as Element).attributes;\n const {length} = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)![2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName =\n name.toLowerCase() + boundAttributeSuffix;\n const attributeValue =\n (node as Element).getAttribute(attributeLookupName)!;\n (node as Element).removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({type: 'attribute', index, name, strings: statics});\n partIndex += statics.length - 1;\n }\n }\n if ((node as Element).tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n } else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = (node as Text).data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode!;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert: Node;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n } else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({type: 'node', index: ++index});\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n } else {\n (node as Text).data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n } else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if ((node as Comment).data === marker) {\n const parent = node.parentNode!;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({type: 'node', index});\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n (node as Comment).data = '';\n } else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({type: 'node', index: -1});\n partIndex++;\n }\n }\n }\n }\n\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode!.removeChild(n);\n }\n }\n}\n\nconst endsWith = (str: string, suffix: string): boolean => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\n\n/**\n * A placeholder for a dynamic expression in an HTML template.\n *\n * There are two built-in part types: AttributePart and NodePart. NodeParts\n * always represent a single dynamic expression, while AttributeParts may\n * represent as many expressions are contained in the attribute.\n *\n * A Template's parts are mutable, so parts can be replaced or modified\n * (possibly to implement different template semantics). The contract is that\n * parts can only be replaced, not removed, added or reordered, and parts must\n * always consume the correct number of values in their `update()` method.\n *\n * TODO(justinfagnani): That requirement is a little fragile. A\n * TemplateInstance could instead be more careful about which values it gives\n * to Part.update().\n */\nexport type TemplatePart = {\n readonly type: 'node'; index: number;\n}|{\n readonly type: 'attribute';\n index: number;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n};\n\nexport const isTemplatePartActive = (part: TemplatePart) => part.index !== -1;\n\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex =\n // eslint-disable-next-line no-control-regex\n /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n * div#1 (remove) <-- start removing (removing node is div#1)\n * div\n * div#2 (remove) <-- continue removing (removing node is still div#1)\n * div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(\n template: Template, nodesToRemove: Set<Node>) {\n const {element: {content}, parts} = template;\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let part = parts[partIndex];\n let nodeIndex = -1;\n let removeCount = 0;\n const nodesToRemoveInTemplate = [];\n let currentRemovingNode: Node|null = null;\n while (walker.nextNode()) {\n nodeIndex++;\n const node = walker.currentNode as Element;\n // End removal if stepped past the removing node\n if (node.previousSibling === currentRemovingNode) {\n currentRemovingNode = null;\n }\n // A node to remove was found in the template\n if (nodesToRemove.has(node)) {\n nodesToRemoveInTemplate.push(node);\n // Track node we're removing\n if (currentRemovingNode === null) {\n currentRemovingNode = node;\n }\n }\n // When removing, increment count by which to adjust subsequent part indices\n if (currentRemovingNode !== null) {\n removeCount++;\n }\n while (part !== undefined && part.index === nodeIndex) {\n // If part is in a removed node deactivate it by setting index to -1 or\n // adjust the index as needed.\n part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n // go to the next active part.\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n part = parts[partIndex];\n }\n }\n nodesToRemoveInTemplate.forEach((n) => n.parentNode!.removeChild(n));\n}\n\nconst countNodes = (node: Node) => {\n let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n while (walker.nextNode()) {\n count++;\n }\n return count;\n};\n\nconst nextActiveIndexInTemplateParts =\n (parts: TemplatePart[], startIndex = -1) => {\n for (let i = startIndex + 1; i < parts.length; i++) {\n const part = parts[i];\n if (isTemplatePartActive(part)) {\n return i;\n }\n }\n return -1;\n };\n\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(\n template: Template, node: Node, refNode: Node|null = null) {\n const {element: {content}, parts} = template;\n // If there's no refNode, then put node at end of template.\n // No part indices need to be shifted in this case.\n if (refNode === null || refNode === undefined) {\n content.appendChild(node);\n return;\n }\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let insertCount = 0;\n let walkerIndex = -1;\n while (walker.nextNode()) {\n walkerIndex++;\n const walkerNode = walker.currentNode as Element;\n if (walkerNode === refNode) {\n insertCount = countNodes(node);\n refNode.parentNode!.insertBefore(node, refNode);\n }\n while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n // If we've inserted the node, simply adjust all subsequent parts\n if (insertCount > 0) {\n while (partIndex !== -1) {\n parts[partIndex].index += insertCount;\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n return;\n }\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\n\nconst directives = new WeakMap<object, true>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = <F extends DirectiveFactory>(f: F): F =>\n ((...args: unknown[]) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n }) as F;\n\nexport const isDirective = (o: unknown): o is DirectiveFn => {\n return typeof o === 'function' && directives.has(o);\n};\n", "/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The Part interface represents a dynamic part of a template instance rendered\n * by lit-html.\n */\nexport interface Part {\n readonly value: unknown;\n\n /**\n * Sets the current part value, but does not write it to the DOM.\n * @param value The value that will be committed.\n */\n setValue(value: unknown): void;\n\n /**\n * Commits the current part value, causing it to actually be written to the\n * DOM.\n *\n * Directives are run at the start of `commit`, so that if they call\n * `part.setValue(...)` synchronously that value will be used in the current\n * commit, and there's no need to call `part.commit()` within the directive.\n * If directives set a part value asynchronously, then they must call\n * `part.commit()` manually.\n */\n commit(): void;\n}\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isCEPolyfill} from './dom.js';\nimport {Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n private readonly __parts: Array<Part|undefined> = [];\n readonly processor: TemplateProcessor;\n readonly options: RenderOptions;\n readonly template: Template;\n\n constructor(\n template: Template, processor: TemplateProcessor,\n options: RenderOptions) {\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n\n update(values: readonly unknown[]) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n\n _clone(): DocumentFragment {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) as DocumentFragment :\n document.importNode(this.template.element.content, true);\n\n const stack: Node[] = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n fragment,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part: TemplatePart;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node!.nodeName === 'TEMPLATE') {\n stack.push(node!);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n node = walker.nextNode();\n }\n }\n\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node!.previousSibling!);\n this.__parts.push(part);\n } else {\n this.__parts.push(...this.processor.handleAttributeExpressions(\n node as Element, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {reparentNodes} from './dom.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker} from './template.js';\n\ndeclare const trustedTypes: typeof window.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes!.createPolicy('lit-html', {createHTML: (s) => s});\n\nconst commentMarker = ` ${marker} `;\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n readonly strings: TemplateStringsArray;\n readonly values: readonly unknown[];\n readonly type: string;\n readonly processor: TemplateProcessor;\n\n constructor(\n strings: TemplateStringsArray, values: readonly unknown[], type: string,\n processor: TemplateProcessor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n\n /**\n * Returns a string of HTML used to create a `<template>` element.\n */\n getHTML(): string {\n const l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment position.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like <!--{{lit-guid}}-->.\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('<!--');\n // We're in comment position if we have a comment open with no following\n // comment close. Because <-- can appear in an attribute value there can\n // be false positives.\n isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n s.indexOf('-->', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceding sequence. For comments, this guards against unusual\n // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n } else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = document.createElement('template');\n let value = this.getHTML();\n if (policy !== undefined) {\n // this is secure because `this.strings` is a TemplateStringsArray.\n // TODO: validate this when\n // https://github.com/tc39/proposal-array-is-template-object is\n // implemented.\n value = policy.createHTML(value) as unknown as string;\n }\n template.innerHTML = value;\n return template;\n }\n}\n\n/**\n * A TemplateResult for SVG fragments.\n *\n * This class wraps HTML in an `<svg>` tag in order to parse its contents in the\n * SVG namespace, then modifies the template to remove the `<svg>` tag so that\n * clones only container the original fragment.\n */\nexport class SVGTemplateResult extends TemplateResult {\n getHTML(): string {\n return `<svg>${super.getHTML()}</svg>`;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = super.getTemplateElement();\n const content = template.content;\n const svgElement = content.firstChild!;\n content.removeChild(svgElement);\n reparentNodes(content, svgElement.firstChild);\n return template;\n }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isDirective} from './directive.js';\nimport {removeNodes} from './dom.js';\nimport {noChange, nothing, Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {createMarker} from './template.js';\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\nexport type Primitive = null|undefined|boolean|number|string|symbol|bigint;\nexport const isPrimitive = (value: unknown): value is Primitive => {\n return (\n value === null ||\n !(typeof value === 'object' || typeof value === 'function'));\n};\nexport const isIterable = (value: unknown): value is Iterable<unknown> => {\n return Array.isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!(value && (value as any)[Symbol.iterator]);\n};\n\n/**\n * Writes attribute values to the DOM for a group of AttributeParts bound to a\n * single attribute. The value is only set once even if there are multiple parts\n * for an attribute.\n */\nexport class AttributeCommitter {\n readonly element: Element;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n readonly parts: ReadonlyArray<AttributePart>;\n dirty = true;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n this.element = element;\n this.name = name;\n this.strings = strings;\n this.parts = [];\n for (let i = 0; i < strings.length - 1; i++) {\n (this.parts as AttributePart[])[i] = this._createPart();\n }\n }\n\n /**\n * Creates a single part. Override this to create a differnt type of part.\n */\n protected _createPart(): AttributePart {\n return new AttributePart(this);\n }\n\n protected _getValue(): unknown {\n const strings = this.strings;\n const l = strings.length - 1;\n const parts = this.parts;\n\n // If we're assigning an attribute via syntax like:\n // attr=\"${foo}\" or attr=${foo}\n // but not\n // attr=\"${foo} ${bar}\" or attr=\"${foo} baz\"\n // then we don't want to coerce the attribute value into one long\n // string. Instead we want to just return the value itself directly,\n // so that sanitizeDOMValue can get the actual value rather than\n // String(value)\n // The exception is if v is an array, in which case we do want to smash\n // it together into a string without calling String() on the array.\n //\n // This also allows trusted values (when using TrustedTypes) being\n // assigned to DOM sinks without being stringified in the process.\n if (l === 1 && strings[0] === '' && strings[1] === '') {\n const v = parts[0].value;\n if (typeof v === 'symbol') {\n return String(v);\n }\n if (typeof v === 'string' || !isIterable(v)) {\n return v;\n }\n }\n let text = '';\n\n for (let i = 0; i < l; i++) {\n text += strings[i];\n const part = parts[i];\n if (part !== undefined) {\n const v = part.value;\n if (isPrimitive(v) || !isIterable(v)) {\n text += typeof v === 'string' ? v : String(v);\n } else {\n for (const t of v) {\n text += typeof t === 'string' ? t : String(t);\n }\n }\n }\n }\n\n text += strings[l];\n return text;\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n this.element.setAttribute(this.name, this._getValue() as string);\n }\n }\n}\n\n/**\n * A Part that controls all or part of an attribute value.\n */\nexport class AttributePart implements Part {\n readonly committer: AttributeCommitter;\n value: unknown = undefined;\n\n constructor(committer: AttributeCommitter) {\n this.committer = committer;\n }\n\n setValue(value: unknown): void {\n if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {\n this.value = value;\n // If the value is a not a directive, dirty the committer so that it'll\n // call setAttribute. If the value is a directive, it'll dirty the\n // committer if it calls setValue().\n if (!isDirective(value)) {\n this.committer.dirty = true;\n }\n }\n }\n\n commit() {\n while (isDirective(this.value)) {\n const directive = this.value;\n this.value = noChange;\n directive(this);\n }\n if (this.value === noChange) {\n return;\n }\n this.committer.commit();\n }\n}\n\n/**\n * A Part that controls a location within a Node tree. Like a Range, NodePart\n * has start and end locations and can set and update the Nodes between those\n * locations.\n *\n * NodeParts support several value types: primitives, Nodes, TemplateResults,\n * as well as arrays and iterables of those types.\n */\nexport class NodePart implements Part {\n readonly options: RenderOptions;\n startNode!: Node;\n endNode!: Node;\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(options: RenderOptions) {\n this.options = options;\n }\n\n /**\n * Appends this part into a container.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendInto(container: Node) {\n this.startNode = container.appendChild(createMarker());\n this.endNode = container.appendChild(createMarker());\n }\n\n /**\n * Inserts this part after the `ref` node (between `ref` and `ref`'s next\n * sibling). Both `ref` and its next sibling must be static, unchanging nodes\n * such as those that appear in a literal section of a template.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterNode(ref: Node) {\n this.startNode = ref;\n this.endNode = ref.nextSibling!;\n }\n\n /**\n * Appends this part into a parent part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendIntoPart(part: NodePart) {\n part.__insert(this.startNode = createMarker());\n part.__insert(this.endNode = createMarker());\n }\n\n /**\n * Inserts this part after the `ref` part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterPart(ref: NodePart) {\n ref.__insert(this.startNode = createMarker());\n this.endNode = ref.endNode;\n ref.endNode = this.startNode;\n }\n\n setValue(value: unknown): void {\n this.__pendingValue = value;\n }\n\n commit() {\n if (this.startNode.parentNode === null) {\n return;\n }\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n const value = this.__pendingValue;\n if (value === noChange) {\n return;\n }\n if (isPrimitive(value)) {\n if (value !== this.value) {\n this.__commitText(value);\n }\n } else if (value instanceof TemplateResult) {\n this.__commitTemplateResult(value);\n } else if (value instanceof Node) {\n this.__commitNode(value);\n } else if (isIterable(value)) {\n this.__commitIterable(value);\n } else if (value === nothing) {\n this.value = nothing;\n this.clear();\n } else {\n // Fallback, will render the string representation\n this.__commitText(value);\n }\n }\n\n private __insert(node: Node) {\n this.endNode.parentNode!.insertBefore(node, this.endNode);\n }\n\n private __commitNode(value: Node): void {\n if (this.value === value) {\n return;\n }\n this.clear();\n this.__insert(value);\n this.value = value;\n }\n\n private __commitText(value: unknown): void {\n const node = this.startNode.nextSibling!;\n value = value == null ? '' : value;\n // If `value` isn't already a string, we explicitly convert it here in case\n // it can't be implicitly converted - i.e. it's a symbol.\n const valueAsString: string =\n typeof value === 'string' ? value : String(value);\n if (node === this.endNode.previousSibling &&\n node.nodeType === 3 /* Node.TEXT_NODE */) {\n // If we only have a single text node between the markers, we can just\n // set its value, rather than replacing it.\n // TODO(justinfagnani): Can we just check if this.value is primitive?\n (node as Text).data = valueAsString;\n } else {\n this.__commitNode(document.createTextNode(valueAsString));\n }\n this.value = value;\n }\n\n private __commitTemplateResult(value: TemplateResult): void {\n const template = this.options.templateFactory(value);\n if (this.value instanceof TemplateInstance &&\n this.value.template === template) {\n this.value.update(value.values);\n } else {\n // Make sure we propagate the template processor from the TemplateResult\n // so that we use its syntax extension, etc. The template factory comes\n // from the render function options so that it can control template\n // caching and preprocessing.\n const instance =\n new TemplateInstance(template, value.processor, this.options);\n const fragment = instance._clone();\n instance.update(value.values);\n this.__commitNode(fragment);\n this.value = instance;\n }\n }\n\n private __commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If _value is an array, then the previous render was of an\n // iterable and _value will contain the NodeParts from the previous\n // render. If _value is not an array, clear this part and make a new\n // array for NodeParts.\n if (!Array.isArray(this.value)) {\n this.value = [];\n this.clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this.value as NodePart[];\n let partIndex = 0;\n let itemPart: NodePart|undefined;\n\n for (const item of value) {\n // Try to reuse an existing part\n itemPart = itemParts[partIndex];\n\n // If no existing part, create a new one\n if (itemPart === undefined) {\n itemPart = new NodePart(this.options);\n itemParts.push(itemPart);\n if (partIndex === 0) {\n itemPart.appendIntoPart(this);\n } else {\n itemPart.insertAfterPart(itemParts[partIndex - 1]);\n }\n }\n itemPart.setValue(item);\n itemPart.commit();\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n this.clear(itemPart && itemPart.endNode);\n }\n }\n\n clear(startNode: Node = this.startNode) {\n removeNodes(\n this.startNode.parentNode!, startNode.nextSibling!, this.endNode);\n }\n}\n\n/**\n * Implements a boolean attribute, roughly as defined in the HTML\n * specification.\n *\n * If the value is truthy, then the attribute is present with a value of\n * ''. If the value is falsey, the attribute is removed.\n */\nexport class BooleanAttributePart implements Part {\n readonly element: Element;\n readonly name: string;\n readonly strings: readonly string[];\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(element: Element, name: string, strings: readonly string[]) {\n if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {\n throw new Error(\n 'Boolean attributes can only contain a single expression');\n }\n this.element = element;\n this.name = name;\n this.strings = strings;\n }\n\n setValue(value: unknown): void {\n this.__pendingValue = value;\n }\n\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n const value = !!this.__pendingValue;\n if (this.value !== value) {\n if (value) {\n this.element.setAttribute(this.name, '');\n } else {\n this.element.removeAttribute(this.name);\n }\n this.value = value;\n }\n this.__pendingValue = noChange;\n }\n}\n\n/**\n * Sets attribute values for PropertyParts, so that the value is only set once\n * even if there are multiple parts for a property.\n *\n * If an expression controls the whole property value, then the value is simply\n * assigned to the property under control. If there are string literals or\n * multiple expressions, then the strings are expressions are interpolated into\n * a string first.\n */\nexport class PropertyCommitter extends AttributeCommitter {\n readonly single: boolean;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n super(element, name, strings);\n this.single =\n (strings.length === 2 && strings[0] === '' && strings[1] === '');\n }\n\n protected _createPart(): PropertyPart {\n return new PropertyPart(this);\n }\n\n protected _getValue() {\n if (this.single) {\n return this.parts[0].value;\n }\n return super._getValue();\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = this._getValue();\n }\n }\n}\n\nexport class PropertyPart extends AttributePart {}\n\n// Detect event listener options support. If the `capture` property is read\n// from the options object, then options are supported. If not, then the third\n// argument to add/removeEventListener is interpreted as the boolean capture\n// value so we should only pass the `capture` property.\nlet eventOptionsSupported = false;\n\n// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch\n// blocks right into the body of a module\n(() => {\n try {\n const options = {\n get capture() {\n eventOptionsSupported = true;\n return false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.addEventListener('test', options as any, options);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.removeEventListener('test', options as any, options);\n } catch (_e) {\n // event options not supported\n }\n})();\n\ntype EventHandlerWithOptions =\n EventListenerOrEventListenerObject&Partial<AddEventListenerOptions>;\nexport class EventPart implements Part {\n readonly element: Element;\n readonly eventName: string;\n readonly eventContext?: EventTarget;\n value: undefined|EventHandlerWithOptions = undefined;\n private __options?: AddEventListenerOptions;\n private __pendingValue: undefined|EventHandlerWithOptions = undefined;\n private readonly __boundHandleEvent: (event: Event) => void;\n\n constructor(element: Element, eventName: string, eventContext?: EventTarget) {\n this.element = element;\n this.eventName = eventName;\n this.eventContext = eventContext;\n this.__boundHandleEvent = (e) => this.handleEvent(e);\n }\n\n setValue(value: undefined|EventHandlerWithOptions): void {\n this.__pendingValue = value;\n }\n\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange as EventHandlerWithOptions;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n\n const newListener = this.__pendingValue;\n const oldListener = this.value;\n const shouldRemoveListener = newListener == null ||\n oldListener != null &&\n (newListener.capture !== oldListener.capture ||\n newListener.once !== oldListener.once ||\n newListener.passive !== oldListener.passive);\n const shouldAddListener =\n newListener != null && (oldListener == null || shouldRemoveListener);\n\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.eventName, this.__boundHandleEvent, this.__options);\n }\n if (shouldAddListener) {\n this.__options = getOptions(newListener);\n this.element.addEventListener(\n this.eventName, this.__boundHandleEvent, this.__options);\n }\n this.value = newListener;\n this.__pendingValue = noChange as EventHandlerWithOptions;\n }\n\n handleEvent(event: Event) {\n if (typeof this.value === 'function') {\n this.value.call(this.eventContext || this.element, event);\n } else {\n (this.value as EventListenerObject).handleEvent(event);\n }\n }\n}\n\n// We copy options because of the inconsistent behavior of browsers when reading\n// the third argument of add/removeEventListener. IE11 doesn't support options\n// at all. Chrome 41 only reads `capture` if the argument is an object.\nconst getOptions = (o: AddEventListenerOptions|undefined) => o &&\n (eventOptionsSupported ?\n {capture: o.capture, passive: o.passive, once: o.once} :\n o.capture as AddEventListenerOptions);\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\n/**\n * A function type that creates a Template from a TemplateResult.\n *\n * This is a hook into the template-creation process for rendering that\n * requires some modification of templates before they're used, like ShadyCSS,\n * which must add classes to elements and remove styles.\n *\n * Templates should be cached as aggressively as possible, so that many\n * TemplateResults produced from the same expression only do the work of\n * creating the Template the first time.\n *\n * Templates are usually cached by TemplateResult.strings and\n * TemplateResult.type, but may be cached by other keys if this function\n * modifies the template.\n *\n * Note that currently TemplateFactories must not add, remove, or reorder\n * expressions, because there is no way to describe such a modification\n * to render() so that values are interpolated to the correct place in the\n * template instances.\n */\nexport type TemplateFactory = (result: TemplateResult) => Template;\n\n/**\n * The default TemplateFactory which caches Templates keyed on\n * result.type and result.strings.\n */\nexport function templateFactory(result: TemplateResult) {\n let templateCache = templateCaches.get(result.type);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(result.type, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n // If the TemplateStringsArray is new, generate a key from the strings\n // This key is shared between all templates with identical content\n const key = result.strings.join(marker);\n\n // Check if we already have a Template for this key\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n // If we have not seen this key before, create a new Template\n template = new Template(result, result.getTemplateElement());\n // Cache the Template for this key\n templateCache.keyString.set(key, template);\n }\n\n // Cache all future queries for this TemplateStringsArray\n templateCache.stringsArray.set(result.strings, template);\n return template;\n}\n\n/**\n * The first argument to JS template tags retain identity across multiple\n * calls to a tag for the same literal, so we can cache work done per literal\n * in a Map.\n *\n * Safari currently has a bug which occasionally breaks this behavior, so we\n * need to cache the Template at two levels. We first cache the\n * TemplateStringsArray, and if that fails, we cache a key constructed by\n * joining the strings array.\n */\nexport interface TemplateCache {\n readonly stringsArray: WeakMap<TemplateStringsArray, Template>;\n readonly keyString: Map<string, Template>;\n}\n\nexport const templateCaches = new Map<string, TemplateCache>();\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {removeNodes} from './dom.js';\nimport {NodePart} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {templateFactory} from './template-factory.js';\n\nexport const parts = new WeakMap<Node, NodePart>();\n\n/**\n * Renders a template result or other value to a container.\n *\n * To update a container with new values, reevaluate the template literal and\n * call `render` with the new result.\n *\n * @param result Any value renderable by NodePart - typically a TemplateResult\n * created by evaluating a template tag like `html` or `svg`.\n * @param container A DOM parent to render to. The entire contents are either\n * replaced, or efficiently updated if the same result type was previous\n * rendered there.\n * @param options RenderOptions for the entire render tree rendered to this\n * container. Render options must *not* change between renders to the same\n * container, as those changes will not effect previously rendered DOM.\n */\nexport const render =\n (result: unknown,\n container: Element|DocumentFragment,\n options?: Partial<RenderOptions>) => {\n let part = parts.get(container);\n if (part === undefined) {\n removeNodes(container, container.firstChild);\n parts.set(container, part = new NodePart({\n templateFactory,\n ...options,\n }));\n part.appendInto(container);\n }\n part.setValue(result);\n part.commit();\n };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\nimport {AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\n\n/**\n * Creates Parts when a template is instantiated.\n */\nexport class DefaultTemplateProcessor implements TemplateProcessor {\n /**\n * Create parts for an attribute-position binding, given the event, attribute\n * name, and string literals.\n *\n * @param element The element containing the binding\n * @param name The attribute name\n * @param strings The string literals. There are always at least two strings,\n * event for fully-controlled bindings with a single expression.\n */\n handleAttributeExpressions(\n element: Element, name: string, strings: string[],\n options: RenderOptions): ReadonlyArray<Part> {\n const prefix = name[0];\n if (prefix === '.') {\n const committer = new PropertyCommitter(element, name.slice(1), strings);\n return committer.parts;\n }\n if (prefix === '@') {\n return [new EventPart(element, name.slice(1), options.eventContext)];\n }\n if (prefix === '?') {\n return [new BooleanAttributePart(element, name.slice(1), strings)];\n }\n const committer = new AttributeCommitter(element, name, strings);\n return committer.parts;\n }\n /**\n * Create parts for a text-position binding.\n * @param templateFactory\n */\n handleTextExpression(options: RenderOptions) {\n return new NodePart(options);\n }\n}\n\nexport const defaultTemplateProcessor = new DefaultTemplateProcessor();\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n *\n * Main lit-html module.\n *\n * Main exports:\n *\n * - [[html]]\n * - [[svg]]\n * - [[render]]\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {defaultTemplateProcessor} from './lib/default-template-processor.js';\nimport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\n\nexport {DefaultTemplateProcessor, defaultTemplateProcessor} from './lib/default-template-processor.js';\nexport {directive, DirectiveFn, isDirective} from './lib/directive.js';\n// TODO(justinfagnani): remove line when we get NodePart moving methods\nexport {removeNodes, reparentNodes} from './lib/dom.js';\nexport {noChange, nothing, Part} from './lib/part.js';\nexport {AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart} from './lib/parts.js';\nexport {RenderOptions} from './lib/render-options.js';\nexport {parts, render} from './lib/render.js';\nexport {templateCaches, templateFactory} from './lib/template-factory.js';\nexport {TemplateInstance} from './lib/template-instance.js';\nexport {TemplateProcessor} from './lib/template-processor.js';\nexport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\nexport {createMarker, isTemplatePartActive, Template} from './lib/template.js';\n\ndeclare global {\n interface Window {\n litHtmlVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n// TODO(justinfagnani): inject version number at build time\nif (typeof window !== 'undefined') {\n (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.3.0');\n}\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n */\nexport const html = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new TemplateResult(strings, values, 'html', defaultTemplateProcessor);\n\n/**\n * Interprets a template literal as an SVG template that can efficiently\n * render to and update a container.\n */\nexport const svg = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor);\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Module to add shady DOM/shady CSS polyfill support to lit-html template\n * rendering. See the [[render]] method for details.\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {removeNodes} from './dom.js';\nimport {insertNodeIntoTemplate, removeNodesFromTemplate} from './modify-template.js';\nimport {RenderOptions} from './render-options.js';\nimport {parts, render as litRender} from './render.js';\nimport {templateCaches} from './template-factory.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\nexport {html, svg, TemplateResult} from '../lit-html.js';\n\n// Get a key to lookup in `templateCaches`.\nconst getTemplateCacheKey = (type: string, scopeName: string) =>\n `${type}--${scopeName}`;\n\nlet compatibleShadyCSSVersion = true;\n\nif (typeof window.ShadyCSS === 'undefined') {\n compatibleShadyCSSVersion = false;\n} else if (typeof window.ShadyCSS.prepareTemplateDom === 'undefined') {\n console.warn(\n `Incompatible ShadyCSS version detected. ` +\n `Please update to at least @webcomponents/webcomponentsjs@2.0.2 and ` +\n `@webcomponents/shadycss@1.3.1.`);\n compatibleShadyCSSVersion = false;\n}\n\n/**\n * Template factory which scopes template DOM using ShadyCSS.\n * @param scopeName {string}\n */\nexport const shadyTemplateFactory = (scopeName: string) =>\n (result: TemplateResult) => {\n const cacheKey = getTemplateCacheKey(result.type, scopeName);\n let templateCache = templateCaches.get(cacheKey);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(cacheKey, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n const key = result.strings.join(marker);\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n const element = result.getTemplateElement();\n if (compatibleShadyCSSVersion) {\n window.ShadyCSS!.prepareTemplateDom(element, scopeName);\n }\n template = new Template(result, element);\n templateCache.keyString.set(key, template);\n }\n templateCache.stringsArray.set(result.strings, template);\n return template;\n };\n\nconst TEMPLATE_TYPES = ['html', 'svg'];\n\n/**\n * Removes all style elements from Templates for the given scopeName.\n */\nconst removeStylesFromLitTemplates = (scopeName: string) => {\n TEMPLATE_TYPES.forEach((type) => {\n const templates = templateCaches.get(getTemplateCacheKey(type, scopeName));\n if (templates !== undefined) {\n templates.keyString.forEach((template) => {\n const {element: {content}} = template;\n // IE 11 doesn't support the iterable param Set constructor\n const styles = new Set<Element>();\n Array.from(content.querySelectorAll('style')).forEach((s: Element) => {\n styles.add(s);\n });\n removeNodesFromTemplate(template, styles);\n });\n }\n });\n};\n\nconst shadyRenderSet = new Set<string>();\n\n/**\n * For the given scope name, ensures that ShadyCSS style scoping is performed.\n * This is done just once per scope name so the fragment and template cannot\n * be modified.\n * (1) extracts styles from the rendered fragment and hands them to ShadyCSS\n * to be scoped and appended to the document\n * (2) removes style elements from all lit-html Templates for this scope name.\n *\n * Note, <style> elements can only be placed into templates for the\n * initial rendering of the scope. If <style> elements are included in templates\n * dynamically rendered to the scope (after the first scope render), they will\n * not be scoped and the <style> will be left in the template and rendered\n * output.\n */\nconst prepareTemplateStyles =\n (scopeName: string, renderedDOM: DocumentFragment, template?: Template) => {\n shadyRenderSet.add(scopeName);\n // If `renderedDOM` is stamped from a Template, then we need to edit that\n // Template's underlying template element. Otherwise, we create one here\n // to give to ShadyCSS, which still requires one while scoping.\n const templateElement =\n !!template ? template.element : document.createElement('template');\n // Move styles out of rendered DOM and store.\n const styles = renderedDOM.querySelectorAll('style');\n const {length} = styles;\n // If there are no styles, skip unnecessary work\n if (length === 0) {\n // Ensure prepareTemplateStyles is called to support adding\n // styles via `prepareAdoptedCssText` since that requires that\n // `prepareTemplateStyles` is called.\n //\n // ShadyCSS will only update styles containing @apply in the template\n // given to `prepareTemplateStyles`. If no lit Template was given,\n // ShadyCSS will not be able to update uses of @apply in any relevant\n // template. However, this is not a problem because we only create the\n // template for the purpose of supporting `prepareAdoptedCssText`,\n // which doesn't support @apply at all.\n window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n return;\n }\n const condensedStyle = document.createElement('style');\n // Collect styles into a single style. This helps us make sure ShadyCSS\n // manipulations will not prevent us from being able to fix up template\n // part indices.\n // NOTE: collecting styles is inefficient for browsers but ShadyCSS\n // currently does this anyway. When it does not, this should be changed.\n for (let i = 0; i < length; i++) {\n const style = styles[i];\n style.parentNode!.removeChild(style);\n condensedStyle.textContent! += style.textContent;\n }\n // Remove styles from nested templates in this scope.\n removeStylesFromLitTemplates(scopeName);\n // And then put the condensed style into the \"root\" template passed in as\n // `template`.\n const content = templateElement.content;\n if (!!template) {\n insertNodeIntoTemplate(template, condensedStyle, content.firstChild);\n } else {\n content.insertBefore(condensedStyle, content.firstChild);\n }\n // Note, it's important that ShadyCSS gets the template that `lit-html`\n // will actually render so that it can update the style inside when\n // needed (e.g. @apply native Shadow DOM case).\n window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n const style = content.querySelector('style');\n if (window.ShadyCSS!.nativeShadow && style !== null) {\n // When in native Shadow DOM, ensure the style created by ShadyCSS is\n // included in initially rendered output (`renderedDOM`).\n renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild);\n } else if (!!template) {\n // When no style is left in the template, parts will be broken as a\n // result. To fix this, we put back the style node ShadyCSS removed\n // and then tell lit to remove that node from the template.\n // There can be no style in the template in 2 cases (1) when Shady DOM\n // is in use, ShadyCSS removes all styles, (2) when native Shadow DOM\n // is in use ShadyCSS removes the style if it contains no content.\n // NOTE, ShadyCSS creates its own style so we can safely add/remove\n // `condensedStyle` here.\n content.insertBefore(condensedStyle, content.firstChild);\n const removes = new Set<Node>();\n removes.add(condensedStyle);\n removeNodesFromTemplate(template, removes);\n }\n };\n\nexport interface ShadyRenderOptions extends Partial<RenderOptions> {\n scopeName: string;\n}\n\n/**\n * Extension to the standard `render` method which supports rendering\n * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom)\n * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used\n * or when the webcomponentsjs\n * (https://github.com/webcomponents/webcomponentsjs) polyfill is used.\n *\n * Adds a `scopeName` option which is used to scope element DOM and stylesheets\n * when native ShadowDOM is unavailable. The `scopeName` will be added to\n * the class attribute of all rendered DOM. In addition, any style elements will\n * be automatically re-written with this `scopeName` selector and moved out\n * of the rendered DOM and into the document `<head>`.\n *\n * It is common to use this render method in conjunction with a custom element\n * which renders a shadowRoot. When this is done, typically the element's\n * `localName` should be used as the `scopeName`.\n *\n * In addition to DOM scoping, ShadyCSS also supports a basic shim for css\n * custom properties (needed only on older browsers like IE11) and a shim for\n * a deprecated feature called `@apply` that supports applying a set of css\n * custom properties to a given location.\n *\n * Usage considerations:\n *\n * * Part values in `<style>` elements are only applied the first time a given\n * `scopeName` renders. Subsequent changes to parts in style elements will have\n * no effect. Because of this, parts in style elements should only be used for\n * values that will never change, for example parts that set scope-wide theme\n * values or parts which render shared style elements.\n *\n * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a\n * custom element's `constructor` is not supported. Instead rendering should\n * either done asynchronously, for example at microtask timing (for example\n * `Promise.resolve()`), or be deferred until the first time the element's\n * `connectedCallback` runs.\n *\n * Usage considerations when using shimmed custom properties or `@apply`:\n *\n * * Whenever any dynamic changes are made which affect\n * css custom properties, `ShadyCSS.styleElement(element)` must be called\n * to update the element. There are two cases when this is needed:\n * (1) the element is connected to a new parent, (2) a class is added to the\n * element that causes it to match different custom properties.\n * To address the first case when rendering a custom element, `styleElement`\n * should be called in the element's `connectedCallback`.\n *\n * * Shimmed custom properties may only be defined either for an entire\n * shadowRoot (for example, in a `:host` rule) or via a rule that directly\n * matches an element with a shadowRoot. In other words, instead of flowing from\n * parent to child as do native css custom properties, shimmed custom properties\n * flow only from shadowRoots to nested shadowRoots.\n *\n * * When using `@apply` mixing css shorthand property names with\n * non-shorthand names (for example `border` and `border-width`) is not\n * supported.\n */\nexport const render =\n (result: unknown,\n container: Element|DocumentFragment|ShadowRoot,\n options: ShadyRenderOptions) => {\n if (!options || typeof options !== 'object' || !options.scopeName) {\n throw new Error('The `scopeName` option is required.');\n }\n const scopeName = options.scopeName;\n const hasRendered = parts.has(container);\n const needsScoping = compatibleShadyCSSVersion &&\n container.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */ &&\n !!(container as ShadowRoot).host;\n // Handle first render to a scope specially...\n const firstScopeRender = needsScoping && !shadyRenderSet.has(scopeName);\n // On first scope render, render into a fragment; this cannot be a single\n // fragment that is reused since nested renders can occur synchronously.\n const renderContainer =\n firstScopeRender ? document.createDocumentFragment() : container;\n litRender(\n result,\n renderContainer,\n {templateFactory: shadyTemplateFactory(scopeName), ...options} as\n RenderOptions);\n // When performing first scope render,\n // (1) We've rendered into a fragment so that there's a chance to\n // `prepareTemplateStyles` before sub-elements hit the DOM\n // (which might cause them to render based on a common pattern of\n // rendering in a custom element's `connectedCallback`);\n // (2) Scope the template with ShadyCSS one time only for this scope.\n // (3) Render the fragment into the container and make sure the\n // container knows its `part` is the one we just rendered. This ensures\n // DOM will be re-used on subsequent renders.\n if (firstScopeRender) {\n const part = parts.get(renderContainer)!;\n parts.delete(renderContainer);\n // ShadyCSS might have style sheets (e.g. from `prepareAdoptedCssText`)\n // that should apply to `renderContainer` even if the rendered value is\n // not a TemplateInstance. However, it will only insert scoped styles\n // into the document if `prepareTemplateStyles` has already been called\n // for the given scope name.\n const template = part.value instanceof TemplateInstance ?\n part.value.template :\n undefined;\n prepareTemplateStyles(\n scopeName, renderContainer as DocumentFragment, template);\n removeNodes(container, container.firstChild);\n container.appendChild(renderContainer);\n parts.set(container, part);\n }\n // After elements have hit the DOM, update styling if this is the\n // initial render to this container.\n // This is needed whenever dynamic changes are made so it would be\n // safest to do every render; however, this would regress performance\n // so we leave it up to the user to call `ShadyCSS.styleElement`\n // for dynamic changes.\n if (!hasRendered && needsScoping) {\n window.ShadyCSS!.styleElement((container as ShadowRoot).host);\n }\n };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * [[UpdatingElement]].\n * @packageDocumentation\n */\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n var JSCompiler_renameProperty: <P extends PropertyKey>(\n prop: P, _obj: unknown) => P;\n\n interface Window {\n JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Function called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n /**\n * Function called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n ComplexAttributeConverter<Type>|\n ((value: string|null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean|string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * Map of changed properties with old values. Takes an optional generic\n * interface corresponding to the declared element properties.\n */\n// tslint:disable-next-line:no-any\nexport type PropertyValues<T = any> =\n keyof T extends PropertyKey ? Map<keyof T, unknown>: never;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n return value ? '' : null;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n return value == null ? value : JSON.stringify(value);\n }\n return value;\n },\n\n fromAttribute(value: string|null, type?: unknown) {\n switch (type) {\n case Boolean:\n return value !== null;\n case Number:\n return value === null ? null : Number(value);\n case Object:\n case Array:\n return JSON.parse(value!);\n }\n return value;\n }\n\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n // This ensures (old==NaN, value==NaN) always returns false\n return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual\n};\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n typeof STATE_IS_REFLECTING_TO_PROPERTY;\n\n/**\n * The Closure JS Compiler doesn't currently have good support for static\n * property semantics where \"this\" is dynamic (e.g.\n * https://github.com/google/closure-compiler/issues/3177 and others) so we use\n * this hack to bypass any rewriting by the compiler.\n */\nconst finalized = 'finalized';\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class UpdatingElement extends HTMLElement {\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n */\n private static _attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having finished creating properties.\n */\n protected static[finalized] = true;\n\n /**\n * Memoized list of all class properties, including any superclass properties.\n * Created lazily on user subclasses when finalizing the class.\n */\n private static _classProperties?: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring the property.\n */\n static properties: PropertyDeclarations;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this._classProperties!.forEach((v, p) => {\n const attr = this._attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this._attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Ensures the private `_classProperties` property metadata is created.\n * In addition to `finalize` this is also called in `createProperty` to\n * ensure the `@property` decorator can add property metadata.\n */\n /** @nocollapse */\n private static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(\n JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties: PropertyDeclarationMap =\n Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach(\n (v: PropertyDeclaration, k: PropertyKey) =>\n this._classProperties!.set(k, v));\n }\n }\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a PropertyDeclaration for the property with the given options.\n * The property setter calls the property's `hasChanged` property option\n * or uses a strict identity check to determine whether or not to request\n * an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n *\n * @nocollapse\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure storage exists for property\n // metadata.\n this._ensureClassProperties();\n this._classProperties!.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n return;\n }\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n Object.defineProperty(this.prototype, name, descriptor);\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n *\n * @nocollapse\n */\n protected static getPropertyDescriptor(\n name: PropertyKey, key: string|symbol, options: PropertyDeclaration) {\n return {\n // tslint:disable-next-line:no-any no symbol in index\n get(): any {\n return (this as {[key: string]: unknown})[key as string];\n },\n set(this: UpdatingElement, value: unknown) {\n const oldValue =\n (this as {} as {[key: string]: unknown})[name as string];\n (this as {} as {[key: string]: unknown})[key as string] = value;\n (this as unknown as UpdatingElement)\n .requestUpdateInternal(name, oldValue, options);\n },\n configurable: true,\n enumerable: true\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a PropertyDeclaration via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override `createProperty`.\n *\n * @nocollapse\n * @final\n */\n protected static getPropertyOptions(name: PropertyKey) {\n return this._classProperties && this._classProperties.get(name) ||\n defaultPropertyDeclaration;\n }\n\n /**\n * Creates property accessors for registered properties and ensures\n * any superclasses are also finalized.\n * @nocollapse\n */\n protected static finalize() {\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this);\n if (!superCtor.hasOwnProperty(finalized)) {\n superCtor.finalize();\n }\n this[finalized] = true;\n this._ensureClassProperties();\n // initialize Map populated in observedAttributes\n this._attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...(typeof Object.getOwnPropertySymbols === 'function') ?\n Object.getOwnPropertySymbols(props) :\n []\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeSript lack of support for symbol in\n // index types\n // tslint:disable-next-line:no-any no symbol in index\n this.createProperty(p, (props as any)[p]);\n }\n }\n }\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static _attributeNameForProperty(\n name: PropertyKey, options: PropertyDeclaration) {\n const attribute = options.attribute;\n return attribute === false ?\n undefined :\n (typeof attribute === 'string' ?\n attribute :\n (typeof name === 'string' ? name.toLowerCase() : undefined));\n }\n\n /**\n * Returns true if a property should request an update.\n * Called when a property value is set and uses the `hasChanged`\n * option for the property if present or a strict identity check.\n * @nocollapse\n */\n private static _valueHasChanged(\n value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n return hasChanged(value, old);\n }\n\n /**\n * Returns the property value for the given attribute value.\n * Called via the `attributeChangedCallback` and uses the property's\n * `converter` or `converter.fromAttribute` property option.\n * @nocollapse\n */\n private static _propertyValueFromAttribute(\n value: string|null, options: PropertyDeclaration) {\n const type = options.type;\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n (typeof converter === 'function' ? converter : converter.fromAttribute);\n return fromAttribute ? fromAttribute(value, type) : value;\n }\n\n /**\n * Returns the attribute value for the given property value. If this\n * returns undefined, the property will *not* be reflected to an attribute.\n * If this returns null, the attribute will be removed, otherwise the\n * attribute will be set to the value.\n * This uses the property's `reflect` and `type.toAttribute` property options.\n * @nocollapse\n */\n private static _propertyValueToAttribute(\n value: unknown, options: PropertyDeclaration) {\n if (options.reflect === undefined) {\n return;\n }\n const type = options.type;\n const converter = options.converter;\n const toAttribute =\n converter && (converter as ComplexAttributeConverter).toAttribute ||\n defaultConverter.toAttribute;\n return toAttribute!(value, type);\n }\n\n private _updateState!: UpdateState;\n private _instanceProperties?: PropertyValues;\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private _updatePromise!: Promise<unknown>;\n private _enableUpdatingResolver: (() => void)|undefined;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n */\n private _changedProperties!: PropertyValues;\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private _reflectingProperties?: Map<PropertyKey, PropertyDeclaration>;\n\n constructor() {\n super();\n this.initialize();\n }\n\n /**\n * Performs element initialization. By default captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n this._updateState = 0;\n this._updatePromise =\n new Promise((res) => this._enableUpdatingResolver = res);\n this._changedProperties = new Map();\n this._saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdateInternal();\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private _saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof UpdatingElement)\n ._classProperties!.forEach((_v, p) => {\n if (this.hasOwnProperty(p)) {\n const value = this[p as keyof this];\n delete this[p as keyof this];\n if (!this._instanceProperties) {\n this._instanceProperties = new Map();\n }\n this._instanceProperties.set(p, value);\n }\n });\n }\n\n /**\n * Applies previously saved instance properties.\n */\n private _applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n this._instanceProperties = undefined;\n }\n\n connectedCallback() {\n // Ensure first connection completes an update. Updates cannot complete\n // before connection.\n this.enableUpdating();\n }\n\n protected enableUpdating() {\n if (this._enableUpdatingResolver !== undefined) {\n this._enableUpdatingResolver();\n this._enableUpdatingResolver = undefined;\n }\n }\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n */\n disconnectedCallback() {\n }\n\n /**\n * Synchronizes property values when attributes change.\n */\n attributeChangedCallback(name: string, old: string|null, value: string|null) {\n if (old !== value) {\n this._attributeToProperty(name, value);\n }\n }\n\n private _propertyToAttribute(\n name: PropertyKey, value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n const ctor = (this.constructor as typeof UpdatingElement);\n const attr = ctor._attributeNameForProperty(name, options);\n if (attr !== undefined) {\n const attrValue = ctor._propertyValueToAttribute(value, options);\n // an undefined value does not change the attribute.\n if (attrValue === undefined) {\n return;\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n }\n }\n\n private _attributeToProperty(name: string, value: string|null) {\n // Use tracking info to avoid deserializing attribute value if it was\n // just set from a property setter.\n if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n return;\n }\n const ctor = (this.constructor as typeof UpdatingElement);\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n // tslint:disable-next-line:no-unnecessary-type-assertion\n const propName = (ctor._attributeToPropertyMap as AttributeMap).get(name);\n if (propName !== undefined) {\n const options = ctor.getPropertyOptions(propName);\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n this[propName as keyof this] =\n // tslint:disable-next-line:no-any\n ctor._propertyValueFromAttribute(value, options) as any;\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n }\n }\n\n /**\n * This protected version of `requestUpdate` does not access or return the\n * `updateComplete` promise. This promise can be overridden and is therefore\n * not free to access.\n */\n protected requestUpdateInternal(\n name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration) {\n let shouldRequestUpdate = true;\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n const ctor = this.constructor as typeof UpdatingElement;\n options = options || ctor.getPropertyOptions(name);\n if (ctor._valueHasChanged(\n this[name as keyof this], oldValue, options.hasChanged)) {\n if (!this._changedProperties.has(name)) {\n this._changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `_reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true &&\n !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n if (this._reflectingProperties === undefined) {\n this._reflectingProperties = new Map();\n }\n this._reflectingProperties.set(name, options);\n }\n } else {\n // Abort the request if the property should not be considered changed.\n shouldRequestUpdate = false;\n }\n }\n if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n this._updatePromise = this._enqueueUpdate();\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should\n * be called when an element should update based on some state not triggered\n * by setting a property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored. Returns the `updateComplete` Promise which is resolved\n * when the update completes.\n *\n * @param name {PropertyKey} (optional) name of requesting property\n * @param oldValue {any} (optional) old value of requesting property\n * @returns {Promise} A Promise that is resolved when the update completes.\n */\n requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n this.requestUpdateInternal(name, oldValue);\n return this.updateComplete;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async _enqueueUpdate() {\n this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this._updatePromise;\n } catch (e) {\n // Ignore any previous errors. We only care that the previous cycle is\n // done. Any error should have been handled in the previous update.\n }\n const result = this.performUpdate();\n // If `performUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this._hasRequestedUpdate;\n }\n\n private get _hasRequestedUpdate() {\n return (this._updateState & STATE_UPDATE_REQUESTED);\n }\n\n protected get hasUpdated() {\n return (this._updateState & STATE_HAS_UPDATED);\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * You can override this method to change the timing of updates. If this\n * method is overridden, `super.performUpdate()` must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```\n * protected async performUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.performUpdate();\n * }\n * ```\n */\n protected performUpdate(): void|Promise<unknown> {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this._hasRequestedUpdate) {\n return;\n }\n // Mixin instance properties once, if they exist.\n if (this._instanceProperties) {\n this._applyInstanceProperties();\n }\n let shouldUpdate = false;\n const changedProperties = this._changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.update(changedProperties);\n } else {\n this._markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this._markUpdated();\n throw e;\n }\n if (shouldUpdate) {\n if (!(this._updateState & STATE_HAS_UPDATED)) {\n this._updateState = this._updateState | STATE_HAS_UPDATED;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n }\n }\n\n private _markUpdated() {\n this._changedProperties = new Map();\n this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `_getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super._getUpdateComplete()`, then any subsequent state.\n *\n * @returns {Promise} The Promise returns a boolean that indicates if the\n * update resolved without triggering another update.\n */\n get updateComplete() {\n return this._getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * class MyElement extends LitElement {\n * async _getUpdateComplete() {\n * await super._getUpdateComplete();\n * await this._myChild.updateComplete;\n * }\n * }\n */\n protected _getUpdateComplete() {\n return this._updatePromise;\n }\n\n /**\n * Controls whether or not `update` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected update(_changedProperties: PropertyValues) {\n if (this._reflectingProperties !== undefined &&\n this._reflectingProperties.size > 0) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this._reflectingProperties.forEach(\n (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n this._reflectingProperties = undefined;\n }\n this._markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected updated(_changedProperties: PropertyValues) {\n }\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected firstUpdated(_changedProperties: PropertyValues) {\n }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {LitElement} from '../lit-element.js';\n\nimport {PropertyDeclaration, UpdatingElement} from './updating-element.js';\n\nexport type Constructor<T> = {\n // tslint:disable-next-line:no-any\n new (...args: any[]): T\n};\n\n// From the TC39 Decorators proposal\ninterface ClassDescriptor {\n kind: 'class';\n elements: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\ninterface ClassElement {\n kind: 'field'|'method';\n key: PropertyKey;\n placement: 'static'|'prototype'|'own';\n initializer?: Function;\n extras?: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n descriptor?: PropertyDescriptor;\n}\n\nconst legacyCustomElement =\n (tagName: string, clazz: Constructor<HTMLElement>) => {\n window.customElements.define(tagName, clazz);\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // tslint:disable-next-line:no-any\n return clazz as any;\n };\n\nconst standardCustomElement =\n (tagName: string, descriptor: ClassDescriptor) => {\n const {kind, elements} = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n window.customElements.define(tagName, clazz);\n }\n };\n };\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```\n * @customElement('my-element')\n * class MyElement {\n * render() {\n * return html``;\n * }\n * }\n * ```\n * @category Decorator\n * @param tagName The name of the custom element to define.\n */\nexport const customElement = (tagName: string) =>\n (classOrDescriptor: Constructor<HTMLElement>|ClassDescriptor) =>\n (typeof classOrDescriptor === 'function') ?\n legacyCustomElement(tagName, classOrDescriptor) :\n standardCustomElement(tagName, classOrDescriptor);\n\nconst standardProperty =\n (options: PropertyDeclaration, element: ClassElement) => {\n // When decorating an accessor, pass it through and add property metadata.\n // Note, the `hasOwnProperty` check in `createProperty` ensures we don't\n // stomp over the user's accessor.\n if (element.kind === 'method' && element.descriptor &&\n !('value' in element.descriptor)) {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n } else {\n // createProperty() takes care of defining the property, but we still\n // must return some kind of descriptor, so return a descriptor for an\n // unused prototype field. The finisher calls createProperty().\n return {\n kind: 'field',\n key: Symbol(),\n placement: 'own',\n descriptor: {},\n // When @babel/plugin-proposal-decorators implements initializers,\n // do this instead of the initializer below. See:\n // https://github.com/babel/babel/issues/9260 extras: [\n // {\n // kind: 'initializer',\n // placement: 'own',\n // initializer: descriptor.initializer,\n // }\n // ],\n initializer(this: {[key: string]: unknown}) {\n if (typeof element.initializer === 'function') {\n this[element.key as string] = element.initializer.call(this);\n }\n },\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n }\n };\n\nconst legacyProperty =\n (options: PropertyDeclaration, proto: Object, name: PropertyKey) => {\n (proto.constructor as typeof UpdatingElement)\n .createProperty(name, options);\n };\n\n/**\n * A property decorator which creates a LitElement property which reflects a\n * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be\n * supplied to configure property features.\n *\n * This decorator should only be used for public fields. Private or protected\n * fields should use the [[`internalProperty`]] decorator.\n *\n * @example\n * ```ts\n * class MyElement {\n * @property({ type: Boolean })\n * clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration) {\n // tslint:disable-next-line:no-any decorator\n return (protoOrDescriptor: Object|ClassElement, name?: PropertyKey): any =>\n (name !== undefined) ?\n legacyProperty(options!, protoOrDescriptor as Object, name) :\n standardProperty(options!, protoOrDescriptor as ClassElement);\n}\n\nexport interface InternalPropertyDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like closure compiler.\n * @category Decorator\n */\nexport function internalProperty(options?: InternalPropertyDeclaration) {\n return property({attribute: false, hasChanged: options?.hasChanged});\n}\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n *\n * ```ts\n * class MyElement {\n * @query('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function query(selector: string, cache?: boolean) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n if (cache) {\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n descriptor.get = function(this: LitElement) {\n if ((this as unknown as\n {[key: string]: Element | null})[key as string] === undefined) {\n ((this as unknown as {[key: string]: Element | null})[key as string] =\n this.renderRoot.querySelector(selector));\n }\n return (\n this as unknown as {[key: string]: Element | null})[key as string];\n };\n }\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element's renderRoot done after the element's `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n * ```ts\n * class MyElement {\n * @queryAsync('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n * (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nexport function queryAsync(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n async get(this: LitElement) {\n await this.updateComplete;\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n *\n * @example\n * ```ts\n * class MyElement {\n * @queryAll('div')\n * divs;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAll(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelectorAll(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\nconst legacyQuery =\n (descriptor: PropertyDescriptor, proto: Object, name: PropertyKey) => {\n Object.defineProperty(proto, name, descriptor);\n };\n\nconst standardQuery = (descriptor: PropertyDescriptor, element: ClassElement) =>\n ({\n kind: 'method',\n placement: 'prototype',\n key: element.key,\n descriptor,\n });\n\nconst standardEventOptions =\n (options: AddEventListenerOptions, element: ClassElement) => {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n Object.assign(\n clazz.prototype[element.key as keyof UpdatingElement], options);\n }\n };\n };\n\nconst legacyEventOptions =\n // tslint:disable-next-line:no-any legacy decorator\n (options: AddEventListenerOptions, proto: any, name: PropertyKey) => {\n Object.assign(proto[name], options);\n };\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * @example\n * ```ts\n * class MyElement {\n * clicked = false;\n *\n * render() {\n * return html`\n * <div @click=${this._onClick}`>\n * <button></button>\n * </div>\n * `;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function eventOptions(options: AddEventListenerOptions) {\n // Return value typed as any to prevent TypeScript from complaining that\n // standard decorator function signature does not match TypeScript decorator\n // signature\n // TODO(kschaaf): unclear why it was only failing on this decorator and not\n // the others\n return ((protoOrDescriptor: Object|ClassElement, name?: string) =>\n (name !== undefined) ?\n legacyEventOptions(options, protoOrDescriptor as Object, name) :\n standardEventOptions(\n options, protoOrDescriptor as ClassElement)) as\n // tslint:disable-next-line:no-any decorator\n any;\n}\n\n// x-browser support for matches\n// tslint:disable-next-line:no-any\nconst ElementProto = Element.prototype as any;\nconst legacyMatches =\n ElementProto.msMatchesSelector || ElementProto.webkitMatchesSelector;\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedNodes` of the given named `slot`. Note, the type of\n * this property should be annotated as `NodeListOf<HTMLElement>`.\n *\n * @param slotName A string name of the slot.\n * @param flatten A boolean which when true flattens the assigned nodes,\n * meaning any assigned nodes that are slot elements are replaced with their\n * assigned nodes.\n * @param selector A string which filters the results to elements that match\n * the given css selector.\n *\n * * @example\n * ```ts\n * class MyElement {\n * @queryAssignedNodes('list', true, '.item')\n * listItems;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAssignedNodes(\n slotName = '', flatten = false, selector = '') {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n const slotSelector =\n `slot${slotName ? `[name=${slotName}]` : ':not([name])'}`;\n const slot = this.renderRoot.querySelector(slotSelector);\n let nodes = slot && (slot as HTMLSlotElement).assignedNodes({flatten});\n if (nodes && selector) {\n nodes = nodes.filter(\n (node) => node.nodeType === Node.ELEMENT_NODE &&\n (node as Element).matches ?\n (node as Element).matches(selector) :\n legacyMatches.call(node as Element, selector));\n }\n return nodes;\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n", "/**\n@license\nCopyright (c) 2019 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets = (window.ShadowRoot) &&\n (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) &&\n ('adoptedStyleSheets' in Document.prototype) &&\n ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n _styleSheet?: CSSStyleSheet|null;\n\n readonly cssText: string;\n\n constructor(cssText: string, safeToken: symbol) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n }\n\n this.cssText = cssText;\n }\n\n // Note, this is a getter so that it's lazy. In practice, this means\n // stylesheets are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet|null {\n if (this._styleSheet === undefined) {\n // Note, if `supportsAdoptingStyleSheets` is true then we assume\n // CSSStyleSheet is constructable.\n if (supportsAdoptingStyleSheets) {\n this._styleSheet = new CSSStyleSheet();\n this._styleSheet.replaceSync(this.cssText);\n } else {\n this._styleSheet = null;\n }\n }\n return this._styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\n/**\n * Wrap a value for interpolation in a [[`css`]] tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult|number) => {\n if (value instanceof CSSResult) {\n return value.cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ${\n value}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`);\n }\n};\n\n/**\n * Template tag which which can be used with LitElement's [[LitElement.styles |\n * `styles`]] property to set element styles. For security reasons, only literal\n * string values may be used. To incorporate non-literal values [[`unsafeCSS`]]\n * may be used inside a template string part.\n */\nexport const css =\n (strings: TemplateStringsArray, ...values: (CSSResult|number)[]) => {\n const cssText = values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]);\n return new CSSResult(cssText, constructionToken);\n };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The main LitElement module, which defines the [[`LitElement`]] base class and\n * related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import [[`LitElement`]] and [[`html`]] from this module to create a\n * component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`<p>your ${adjective} template here</p>`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating.\n * The `UpdatingElement` class is provided for users that want to build\n * their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {render, ShadyRenderOptions} from 'lit-html/lib/shady-render.js';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js';\nimport {supportsAdoptingStyleSheets, CSSResult, unsafeCSS} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n interface Window {\n litElementVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n .push('2.4.0');\n\nexport type CSSResultOrNative = CSSResult|CSSStyleSheet;\n\nexport interface CSSResultArray extends\n Array<CSSResultOrNative|CSSResultArray> {}\n\n/**\n * Sentinal value used to avoid calling lit-html's render function when\n * subclasses do not implement `render`\n */\nconst renderNotImplemented = {};\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the [[`properties`]] property or the [[`property`]] decorator.\n */\nexport class LitElement extends UpdatingElement {\n /**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See updating-element.ts for more information.\n */\n protected static['finalized'] = true;\n\n /**\n * Reference to the underlying library method used to render the element's\n * DOM. By default, points to the `render` method from lit-html's shady-render\n * module.\n *\n * **Most users will never need to touch this property.**\n *\n * This property should not be confused with the `render` instance method,\n * which should be overridden to define a template for the element.\n *\n * Advanced users creating a new base class based on LitElement can override\n * this property to point to a custom render method with a signature that\n * matches [shady-render's `render`\n * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render).\n *\n * @nocollapse\n */\n static render:\n (result: unknown, container: Element|DocumentFragment,\n options: ShadyRenderOptions) => void = render;\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the [[`css`]] tag function or via constructible stylesheets.\n */\n static styles?: CSSResultOrNative|CSSResultArray;\n\n private static _styles: Array<CSSResultOrNative|CSSResult>|undefined;\n\n /**\n * Return the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * @nocollapse\n */\n static getStyles(): CSSResultOrNative|CSSResultArray|undefined {\n return this.styles;\n }\n\n /** @nocollapse */\n private static _getUniqueStyles() {\n // Only gather styles once per class\n if (this.hasOwnProperty(JSCompiler_renameProperty('_styles', this))) {\n return;\n }\n // Take care not to call `this.getStyles()` multiple times since this\n // generates new CSSResults each time.\n // TODO(sorvell): Since we do not cache CSSResults by input, any\n // shared styles will generate new stylesheet objects, which is wasteful.\n // This should be addressed when a browser ships constructable\n // stylesheets.\n const userStyles = this.getStyles();\n\n if (Array.isArray(userStyles)) {\n // De-duplicate styles preserving the _last_ instance in the set.\n // This is a performance optimization to avoid duplicated styles that can\n // occur especially when composing via subclassing.\n // The last item is kept to try to preserve the cascade order with the\n // assumption that it's most important that last added styles override\n // previous styles.\n const addStyles = (styles: CSSResultArray, set: Set<CSSResultOrNative>):\n Set<CSSResultOrNative> => styles.reduceRight(\n (set: Set<CSSResultOrNative>, s) =>\n // Note: On IE set.add() does not return the set\n Array.isArray(s) ? addStyles(s, set) : (set.add(s), set),\n set);\n // Array.from does not work on Set in IE, otherwise return\n // Array.from(addStyles(userStyles, new Set<CSSResult>())).reverse()\n const set = addStyles(userStyles, new Set<CSSResultOrNative>());\n const styles: CSSResultOrNative[] = [];\n set.forEach((v) => styles.unshift(v));\n this._styles = styles;\n } else {\n this._styles = userStyles === undefined ? [] : [userStyles];\n }\n\n // Ensure that there are no invalid CSSStyleSheet instances here. They are\n // invalid in two conditions.\n // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but\n // this is impossible to check except via .replaceSync or use\n // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is\n // false)\n this._styles = this._styles.map((s) => {\n if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) {\n // Flatten the cssText from the passed constructible stylesheet (or\n // undetectable non-constructible stylesheet). The user might have\n // expected to update their stylesheets over time, but the alternative\n // is a crash.\n const cssText = Array.prototype.slice.call(s.cssRules)\n .reduce((css, rule) => css + rule.cssText, '');\n return unsafeCSS(cssText);\n }\n return s;\n });\n }\n\n private _needsShimAdoptedStyleSheets?: boolean;\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n */\n readonly renderRoot!: Element|DocumentFragment;\n\n /**\n * Performs element initialization. By default this calls\n * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and\n * captures any pre-set values for registered properties.\n */\n protected initialize() {\n super.initialize();\n (this.constructor as typeof LitElement)._getUniqueStyles();\n (this as {\n renderRoot: Element|DocumentFragment;\n }).renderRoot = this.createRenderRoot();\n // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n // element's getRootNode(). While this could be done, we're choosing not to\n // support this now since it would require different logic around de-duping.\n if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n this.adoptStyles();\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n * @returns {Element|DocumentFragment} Returns a node into which to render.\n */\n protected createRenderRoot(): Element|ShadowRoot {\n return this.attachShadow({mode: 'open'});\n }\n\n /**\n * Applies styling to the element shadowRoot using the [[`styles`]]\n * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n * available and will fallback otherwise. When Shadow DOM is polyfilled,\n * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n * is available but `adoptedStyleSheets` is not, styles are appended to the\n * end of the `shadowRoot` to [mimic spec\n * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n */\n protected adoptStyles() {\n const styles = (this.constructor as typeof LitElement)._styles!;\n if (styles.length === 0) {\n return;\n }\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n // rendering\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.ScopingShim!.prepareAdoptedCssText(\n styles.map((s) => s.cssText), this.localName);\n } else if (supportsAdoptingStyleSheets) {\n (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet!);\n } else {\n // This must be done after rendering so the actual style insertion is done\n // in `update`.\n this._needsShimAdoptedStyleSheets = true;\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n if (this.hasUpdated && window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param _changedProperties Map of changed properties with old values\n */\n protected update(changedProperties: PropertyValues) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const templateResult = this.render();\n super.update(changedProperties);\n // If render is not implemented by the component, don't call lit-html render\n if (templateResult !== renderNotImplemented) {\n (this.constructor as typeof LitElement)\n .render(\n templateResult,\n this.renderRoot,\n {scopeName: this.localName, eventContext: this});\n }\n // When native Shadow DOM is used but adoptedStyles are not supported,\n // insert styling after rendering to ensure adoptedStyles have highest\n // priority.\n if (this._needsShimAdoptedStyleSheets) {\n this._needsShimAdoptedStyleSheets = false;\n (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = s.cssText;\n this.renderRoot.appendChild(style);\n });\n }\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `NodePart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n */\n protected render(): unknown {\n return renderNotImplemented;\n }\n}\n", "import { LitElement, html } from 'lit-element';\nimport expression from 'logical-expression-parser';\nimport { connect } from '../core/connect';\nimport { withProduct } from '../core/resolveProperties';\nimport * as descriptors from '../core/descriptors';\n\nexport const removeWhitespace = str => str.replace(/(\\r\\n|\\n|\\r|\\s)+/gm, '');\n\nexport class When extends withProduct(LitElement) {\n static get properties() {\n return {\n ...super.properties,\n state: { type: Object, attribute: false },\n test: { type: String }\n };\n }\n\n render() {\n if (!this.test) {\n return html``;\n }\n\n let test = removeWhitespace(this.test);\n // the parser returns incorrect result if you use an expression with &!, e.g. test1&!test2\n // it succeeds if you wrap !test2 in parentheses, e.g. test1&(!test2)\n // so we'll wrap all \"not\" expressions in parentheses\n test = test.replace(/(![a-zA-Z]+)/g, '($1)');\n const result = expression.parse(test, key => descriptors[key] && descriptors[key](this.state, this));\n\n if (result) {\n return html`\n <slot></slot>\n `;\n }\n return html``;\n }\n\n shouldUpdate(changedProperties) {\n return (\n changedProperties.size &&\n ((this.product && this.product.id in this.state.autoshipEligible && this.product.id in this.state.inStock) ||\n !this.product.id)\n );\n }\n}\n\nexport const mapStateToProps = state => ({\n state\n});\n\nexport const ConnectedWhen = connect(mapStateToProps)(When);\n\nexport default ConnectedWhen;\n", "import { LitElement } from 'lit-element';\n\nexport const sanitizeFrequencyString = value => {\n const matchDwm = String(value || '')\n .trim()\n .match(/(\\d+)\\s*([dwm])/);\n\n if (matchDwm) {\n return `${matchDwm[1]}_${{ d: 1, w: 2, m: 3 }[matchDwm[2]]}`;\n }\n return value;\n};\n\nexport const buildProduct = element =>\n element.hasAttribute('product') && {\n id: element.getAttribute('product'),\n ...(element.hasAttribute('product-components') && {\n components: JSON.parse(element.getAttribute('product-components'))\n })\n };\n\nexport const resolveFromParentElement = (element, key) => {\n let offer;\n let ref = element;\n while (ref) {\n if (ref instanceof LitElement && ref.tagName.startsWith('OG-') && ref.hasAttribute(key)) {\n return ref;\n }\n ref = ref.nodeType === 11 ? ref.host : ref.parentNode;\n }\n if (!offer) {\n console.warn(`No OG parent element found that has attribute [${key}]`, element);\n }\n return offer;\n};\n\nexport const resolveProduct = element => {\n let product = buildProduct(element);\n if (!product) {\n const offer = element.offer;\n if (offer) {\n product = buildProduct(offer);\n }\n }\n return product;\n};\n\nexport const resolveOffer = element => {\n let ref = element;\n while (ref) {\n if (ref.tagName === 'OG-OFFER') {\n return ref;\n }\n ref = ref.nodeType === 11 ? ref.host : ref.parentNode;\n }\n return undefined;\n};\n\nexport const withOfferTemplate = Base =>\n class extends Base {\n get offer() {\n return resolveOffer(this);\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.offersChangeTemplate = this.offersChangeTemplate.bind(this);\n if (this.offer) {\n this.offer.addEventListener('template-changed', this.offersChangeTemplate);\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n if (this.offer) {\n this.offer.removeEventListener('template-changed', this.offersChangeTemplate);\n }\n }\n\n offersChangeTemplate() {\n this._enqueueUpdate();\n }\n };\n\nexport const withProduct = Base =>\n class extends withOfferTemplate(Base) {\n get product() {\n return resolveProduct(this);\n }\n };\n\nexport const withChildOptions = Base =>\n class extends Base {\n get childOptions() {\n const options = [];\n let isSelected = null;\n\n this.querySelectorAll('option').forEach(it => {\n const value = sanitizeFrequencyString(it.value);\n const text = it.innerText.trim();\n options.push({ value, text });\n if (!isSelected && it.selected) {\n isSelected = value;\n }\n });\n return { options, isSelected };\n }\n };\n", "import { ELIGIBILITY_GROUPS } from './constants';\nimport {\n makeSubscribedSelector,\n makeOptedoutSelector,\n makePrepaidSubscribedSelector,\n makeProductPrepaidShipmentOptionsSelector\n} from './selectors';\nimport { safeProductId } from './utils';\n\nexport const inStock = (state, ownProps) => (state.inStock || {})[(ownProps.product || {}).id];\nexport const eligible = (state, ownProps) => (state.autoshipEligible || {})[(ownProps.product || {}).id] || false;\nexport const autoshipByDefault = (state, ownProps) =>\n (state.autoshipByDefault || {})[(ownProps.product || {}).id] || false;\n\nexport const subscriptionEligible = (state, ownProps) =>\n ((state.offerId && state.offerId !== '0') || false) && eligible(state, ownProps) && inStock(state, ownProps);\nexport const eligibilityGroups = (state, ownProps) => {\n const productId = safeProductId((ownProps.product || {}).id);\n return (state.eligibilityGroups || {})[productId] || null;\n};\n\nexport const hasUpsellGroup = (state, ownProps) => {\n const groups = eligibilityGroups(state, ownProps);\n return groups === null || !!groups.find(it => it === 'upsell' || it === 'impulse_upsell');\n};\n\nexport const prepaidEligible = (state, ownProps) => {\n const groups = eligibilityGroups(state, ownProps);\n return groups?.some(it => it === ELIGIBILITY_GROUPS.PREPAID) || false;\n};\n\nexport const subscribed = (state, ownProps) => makeSubscribedSelector(ownProps.product)(state);\nexport const optedout = (state, ownProps) => makeOptedoutSelector(ownProps.product)(state);\nexport const prepaidSubscribed = (state, ownProps) => makePrepaidSubscribedSelector(ownProps.product)(state);\nexport const hasPrepaidOptions = (state, ownProps) =>\n makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state).length > 0;\n\nexport const hasUpcomingOrder = state => !!(state.nextUpcomingOrder && state.nextUpcomingOrder.public_id);\n\nexport const upcomingOrderContainsProduct = (state, ownProps) =>\n ((state.nextUpcomingOrder && state.nextUpcomingOrder.products) || []).includes((ownProps.product || {}).id);\n\n/**\n * This conditions return true when an offer and product are eligible for impulse upsell\n *\n * @param {*} state\n * @param {*} ownProps\n */\nexport const upsellEligible = (state, ownProps) =>\n // don't show IU in cart offers\n !ownProps.offer?.isCart &&\n state.offerId &&\n state.offerId !== '0' &&\n state.auth &&\n inStock(state, ownProps) &&\n hasUpcomingOrder(state) &&\n hasUpsellGroup(state, ownProps);\n/**\n * Determinates when an offer is eligible for regular, when product in stock and eligible but not upsell\n *\n * Upgrade from 2.13, this replaces slot=\"standard-tempalate\" in og-offer\n * @param {*} state\n * @param {*} ownProps\n */\nexport const regularEligible = (state, ownProps) =>\n subscriptionEligible(state, ownProps) && !upsellEligible(state, ownProps);\n", "import { isFrequencyValid } from './api';\n/**\n * {\"id\": \"<id>\", \"components\": [\"<#1>\",\"<#2>\",...,\"<#n>\"] }\n * {\"id\": \"<id>\"}\n */\nexport const product = {\n type: Object,\n converter: {\n toAttribute(value) {\n return value == null ? value : JSON.stringify(value);\n },\n fromAttribute(value) {\n return value && value.match(/[{[]/) ? JSON.parse(value) : { id: value };\n }\n }\n};\nexport const defaultFrequency = {\n type: String,\n attribute: 'default-frequency',\n converter: {\n fromAttribute(value) {\n return value && isFrequencyValid(value) ? value : null;\n }\n }\n};\nexport const subscribed = { type: Boolean, attribute: true, reflect: true };\nexport const auth = { type: Object, attribute: false };\nexport default { product, defaultFrequency };\n", "import { LitElement } from 'lit-element';\n\nexport const withTemplate = Base =>\n class extends Base {\n applyTemplate(template) {\n this.template = template;\n // update innerHTML if change (performance)\n const markup = typeof template.markup === 'undefined' ? this.constructor.initialTemplate : template.markup;\n if (markup && this._templateMarkup !== markup) {\n this._templateMarkup = markup;\n this.innerHTML = markup;\n }\n }\n\n refreshTemplate() {\n if (this._templates && this._templates.length) {\n // if offer is using templates.\n const tmpl = this._templates.find(({ selector }) => {\n try {\n return this.matches(selector);\n } catch (e) {\n return false;\n }\n });\n this.applyTemplate(tmpl || {});\n }\n }\n\n set templates(val) {\n this._templates = val;\n this.refreshTemplate();\n }\n\n connectedCallback() {\n if (super.connectedCallback) {\n super.connectedCallback();\n }\n if (this.constructor.initialTemplate && !this.innerHTML.trim()) {\n this.innerHTML = this.constructor.initialTemplate;\n }\n }\n };\n\nexport const TemplateElement = withTemplate(LitElement);\n\nexport default { TemplateElement };\n", "import { html, css } from 'lit-element';\nimport {\n makeOptedinSelector,\n makeProductSpecificDefaultFrequencySelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makeProductFrequencyOptedInSelector,\n getFallbackValue,\n templatesSelector,\n makeProductFrequenciesSelector,\n makeProductDefaultFrequencySelector,\n makeProductFrequencyOptionsSelector\n} from '../core/selectors';\nimport { connect } from '../core/connect';\nimport { subscribed } from '../core/props';\nimport { withProduct } from '../core/resolveProperties';\nimport { TemplateElement } from '../core/base';\n\nexport class OptinStatus extends withProduct(TemplateElement) {\n static get properties() {\n return {\n subscribed,\n frequencyMatch: { type: Boolean, reflect: true, attribute: 'frequency-match' },\n productDefaultFrequency: { type: String },\n defaultFrequency: { type: String },\n frequencies: { type: Array }\n };\n }\n\n static get styles() {\n return css`\n :host {\n cursor: default;\n display: inline-block;\n }\n\n :host[hidden] {\n display: none;\n }\n\n .btn {\n position: relative;\n width: var(--og-radio-width, 1.4em);\n height: var(--og-radio-height, 1.4em);\n margin: var(--og-radio-margin, 0);\n padding: 0;\n border: 1px solid var(--og-primary-color, var(--og-border-color, black));\n background: #fff;\n border-radius: 100%;\n vertical-align: middle;\n color: var(--og-primary-color, var(--og-btn-color, black));\n }\n\n .radio {\n text-indent: -9999px;\n flex-shrink: 0;\n }\n\n .checkbox {\n border-radius: 3px;\n }\n\n .radio,\n .checkbox {\n border-color: var(--og-checkbox-border-color, black);\n }\n\n .checkbox.active::after,\n .radio.active::after {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n background: var(--og-checkbox-border-color, black);\n }\n\n .radio.active::after {\n content: ' ';\n border-radius: 100%;\n border: 2px solid #fff;\n }\n\n .checkbox.active::after {\n border: none;\n border-radius: 0;\n background: #fff;\n content: '\\\\2714';\n line-height: 1;\n text-align: center;\n overflow: visible;\n }\n `;\n }\n\n constructor() {\n super();\n this.addEventListener('click', this.handleClick.bind(this));\n }\n\n updated(changed) {\n if (changed.has('subscribed')) {\n this.frequencyMatch = this.frequency === this.defaultFrequency;\n }\n }\n\n handleClick() {}\n\n render() {\n if (this.subscribed && !this.defaultFrequency)\n return html`\n <slot name=\"subscribed\"></slot>\n <slot name=\"frequency-mismatch\"></slot>\n `;\n\n if (this.subscribed && this.defaultFrequency === this.frequency)\n return html`\n <slot name=\"subscribed\"></slot>\n <slot name=\"frequency-match\"></slot>\n `;\n\n if (this.subscribed && this.defaultFrequency !== this.frequency)\n return html`\n <slot name=\"subscribed\"></slot>\n <slot name=\"frequency-mismatch\"></slot>\n `;\n\n return html`\n <slot name=\"not-subscribed\"></slot>\n `;\n }\n}\n\nexport const mapStateToProps = (state, ownProps = {}) => ({\n subscribed: makeOptedinSelector(ownProps.product)(state),\n frequency: makeProductFrequencyOptedInSelector(ownProps.product)(state),\n productDefaultFrequency: makeProductSpecificDefaultFrequencySelector((ownProps.product || {}).id)(state),\n prepaidShipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n defaultFrequency:\n makeProductDefaultFrequencySelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'defaultFrequency'),\n frequencies:\n // it's unclear whether the getFallbackValue result is ever used here, but leaving for backwards compatibility\n makeProductFrequencyOptionsSelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'frequencies'),\n ...templatesSelector(state, ownProps),\n productFrequencies: makeProductFrequenciesSelector(ownProps.product)(state)\n});\n\nexport const ConnectedOptinStatus = connect(mapStateToProps)(OptinStatus);\n\nexport default ConnectedOptinStatus;\n", "import { html } from 'lit-element';\nimport { optinProduct } from '../core/actions';\nimport { OptinStatus, mapStateToProps } from './OptinStatus';\nimport { connect } from '../core/connect';\nimport { defaultFrequency } from '../core/props';\nimport { resolveProduct } from '../core/resolveProperties';\nimport { frequencyToSellingPlan } from '../core/utils';\nimport platform from '../platform';\n\nexport class OptinButton extends OptinStatus {\n static get properties() {\n return {\n ...super.properties,\n frequency: { type: String, reflect: true },\n defaultFrequency,\n optinButtonLabel: { type: String }\n };\n }\n\n updated(changed) {\n if (changed.has('subscribed') || changed.has('frequencies')) {\n if (platform.shopify_selling_plans && this.store) {\n let buttonFreq = this.getAttribute('default-frequency');\n buttonFreq = frequencyToSellingPlan(buttonFreq, this.productFrequencies);\n this.sellingPlanFreq = buttonFreq;\n }\n this.frequencyMatch = this.frequency === this.optinFrequency;\n }\n }\n\n get optinFrequency() {\n let freq;\n\n // use the attribute since this.defaultFrequency comes from mapStateToProps and contains more logic\n if (this.sellingPlanFreq) {\n freq = this.sellingPlanFreq;\n } else if (this.hasAttribute('default-frequency')) {\n freq = this.getAttribute('default-frequency');\n } else {\n freq = this.offer ? this.offer.defaultFrequency : this.defaultFrequency;\n }\n if (platform.shopify_selling_plans && this.store) {\n freq = frequencyToSellingPlan(freq, this.productFrequencies);\n }\n\n return freq;\n }\n\n handleClick(ev) {\n this.optinProduct(resolveProduct(this), this.optinFrequency, this.offer);\n ev.preventDefault();\n }\n\n render() {\n return html`\n <slot name=\"default\">\n <button\n aria-labelledby=\"ogOfferOptInLabel\"\n role=\"radio\"\n aria-checked=\"${!!this.subscribed}\"\n class=\"btn radio ${this.subscribed ? 'active' : ''}\"\n ></button>\n <label id=\"ogOfferOptInLabel\">\n <slot>\n <slot name=\"label\"><og-text key=\"offerOptInLabel\"></og-text></slot>\n </slot>\n </label>\n </slot>\n `;\n }\n}\n\nexport const ConnectedOptinButton = connect(mapStateToProps, { optinProduct })(OptinButton);\n\nexport default ConnectedOptinButton;\n", "import { html } from 'lit-element';\nimport { optoutProduct } from '../core/actions';\nimport { OptinStatus, mapStateToProps } from './OptinStatus';\nimport { connect } from '../core/connect';\n\nexport class OptoutButton extends OptinStatus {\n static get properties() {\n return {\n ...super.properties,\n label: { type: String }\n };\n }\n\n handleClick(ev) {\n this.optoutProduct(this.product, this.offer);\n ev.preventDefault();\n }\n\n render() {\n return html`\n <slot name=\"default\">\n <button\n aria-labelledby=\"ogOfferOptOutLabel\"\n role=\"radio\"\n aria-checked=\"${!this.subscribed}\"\n class=\"btn radio ${this.subscribed ? '' : 'active'}\"\n ></button>\n <label id=\"ogOfferOptOutLabel\">\n <slot>\n <og-text key=\"offerOptOutLabel\"></og-text>\n </slot>\n </label>\n </slot>\n `;\n }\n}\n\nexport const ConnectedOptoutButton = connect(mapStateToProps, { optoutProduct })(OptoutButton);\n\nexport default ConnectedOptoutButton;\n", "import { html, css } from 'lit-element';\nimport {\n makeProductFrequencyOptedInSelector,\n makeOptedinSelector,\n getFallbackValue,\n templatesSelector,\n makeProductSpecificDefaultFrequencySelector,\n makeProductFrequenciesSelector,\n makeProductFrequencyOptionsSelector,\n makeProductDefaultFrequencySelector\n} from '../core/selectors';\nimport { connect } from '../core/connect';\nimport { subscribed, defaultFrequency } from '../core/props';\nimport { parseFrequency, parseFrequenciesList } from '../core/api';\nimport { withProduct } from '../core/resolveProperties';\nimport { TemplateElement } from '../core/base';\n\nexport const frequencyText = (frequency, initial) => {\n const { every, every_period: period } = parseFrequency(frequency);\n return every && period\n ? html`\n ${every}\n <og-text key=\"frequencyPeriods\" variant=\"${period}\" pluralize=\"${every}\"></og-text>\n ${initial && initial === frequency\n ? html`\n <og-text key=\"defaultFrequencyCopy\"></og-text>\n `\n : ''}\n `\n : frequency;\n};\n\nexport class FrequencyStatus extends withProduct(TemplateElement) {\n static get properties() {\n return {\n ...super.properties,\n disabled: { type: Boolean },\n subscribed,\n frequency: { type: String },\n defaultFrequency,\n productDefaultFrequency: { type: String },\n config: { type: Object },\n frequencies: {\n converter: {\n fromAttribute: parseFrequenciesList\n }\n }\n };\n }\n\n static get styles() {\n return css`\n :host[hidden] {\n display: none;\n }\n :host {\n display: inline-block;\n }\n `;\n }\n\n constructor() {\n super();\n this.frequencies = [];\n }\n\n render() {\n const frequency = this.frequency || this.defaultFrequency;\n return html`\n <span>\n ${(this.subscribed &&\n html`\n <slot name=\"subscribed\">${frequencyText(frequency)}</slot>\n `) ||\n ''}\n ${(!this.subscribed &&\n html`\n <slot name=\"not-subscribed\"></slot>\n `) ||\n ''}\n ${(this.subscribed &&\n this.defaultFrequency &&\n this.defaultFrequency !== this.frequency &&\n html`\n <slot name=\"frequency-mismatch\"></slot>\n `) ||\n ''}\n </span>\n `;\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => ({\n subscribed: makeOptedinSelector(ownProps.product)(state),\n frequency: makeProductFrequencyOptedInSelector(ownProps.product)(state),\n productDefaultFrequency: makeProductSpecificDefaultFrequencySelector((ownProps.product || {}).id)(state),\n frequencies:\n // it's unclear whether the getFallbackValue result is ever used here, but leaving for backwards compatibility\n makeProductFrequencyOptionsSelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'frequencies'),\n defaultFrequency:\n makeProductDefaultFrequencySelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'defaultFrequency'),\n ...templatesSelector(state, ownProps),\n productFrequencies: makeProductFrequenciesSelector(ownProps.product)(state)\n});\n\nexport const ConnectedFrequencyStatus = connect(mapStateToProps)(FrequencyStatus);\n\nexport default ConnectedFrequencyStatus;\n", "import { html, css } from 'lit-element';\nimport { productChangeFrequency, optoutProduct } from '../core/actions';\nimport { withChildOptions } from '../core/resolveProperties';\nimport { OptinStatus, mapStateToProps as mapStateToPropsOptinStatus } from './OptinStatus';\nimport { mapStateToProps, frequencyText } from './FrequencyStatus';\nimport { connect } from '../core/connect';\nimport { defaultFrequency } from '../core/props';\nimport { getFallbackValue, makeProductFrequencyOptionsSelector } from '../core/selectors';\n\nexport class OptinSelect extends withChildOptions(OptinStatus) {\n static get properties() {\n return {\n ...super.properties,\n frequencies: { type: Array, attribute: false },\n frequency: { type: String },\n defaultFrequency,\n /* The label used for the underlying select. */\n selectLabel: { type: String, attribute: 'select-label' }\n };\n }\n\n static get styles() {\n return css`\n :host {\n display: inline-block;\n cursor: pointer;\n background-color: var(--og-select-bg-color, #fff);\n border: var(--og-select-border, 1px solid #aaa);\n border-radius: var(--og-select-border-radius, 0.5em);\n border-width: var(--og-select-border-width, 1px);\n box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);\n }\n `;\n }\n\n get currentFrequency() {\n if (!this.subscribed) {\n return 'optedOut';\n }\n\n return this.frequency || this.productDefaultFrequency || this.defaultFrequency;\n }\n\n onOptinChange(value) {\n if (value === 'optedOut') {\n this.optoutProduct(this.product, this.offer);\n } else {\n this.productChangeFrequency(this.product, value, this.offer);\n }\n }\n\n render() {\n const { options: childOptions } = this.childOptions;\n let options;\n if (this.frequencies?.length) {\n const { frequenciesText } = this.productFrequencies;\n options = [\n ...([childOptions.find(option => option.value === 'optedOut')] || []),\n ...this.frequencies.map((value, ix) => ({\n value,\n text:\n frequenciesText && ix in frequenciesText ? frequenciesText[ix] : frequencyText(value, this.defaultFrequency)\n }))\n ];\n } else {\n options = childOptions;\n }\n\n return html`\n <og-select\n .options=\"${options}\"\n .selected=\"${this.currentFrequency}\"\n .onChange=\"${({ target: { value } }) => this.onOptinChange(value)}\"\n .ariaLabel=\"${this.selectLabel}\"\n ></og-select>\n `;\n }\n}\n\nexport const ConnectedOptinSelect = connect(\n (state, ownProps) => ({\n ...mapStateToPropsOptinStatus(state, ownProps),\n ...mapStateToProps(state, ownProps),\n frequencies:\n // it's unclear whether the getFallbackValue result is ever used here, but leaving for backwards compatibility\n makeProductFrequencyOptionsSelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'frequencies')\n }),\n { productChangeFrequency, optoutProduct }\n)(OptinSelect);\n\nexport default ConnectedOptinSelect;\n", "import { html, css } from 'lit-element';\nimport { fetchOrders, createIu, concludeUpsell } from '../core/actions';\nimport { connect } from '../core/connect';\nimport { auth } from '../core/props';\nimport { withProduct } from '../core/resolveProperties';\nimport { TemplateElement } from '../core/base';\n\nexport class UpsellButton extends withProduct(TemplateElement) {\n static get styles() {\n return css`\n :host[hidden] {\n display: none;\n }\n :host {\n display: inline-block;\n }\n `;\n }\n\n static get properties() {\n return {\n ...super.properties,\n upcomingOrderDate: {\n type: String,\n attribute: false\n },\n auth,\n isPreview: { type: Boolean, attribute: false },\n target: { type: String },\n // If set, creates the IU item immediately instead of opening a modal\n skipModal: { type: Boolean, attribute: 'skip-modal' }\n };\n }\n\n constructor() {\n super();\n this.fetchOrders = () => 0;\n this.createIu = () => 0;\n this.concludeUpsell = () => 0;\n this.addEventListener('click', this.handleClick.bind(this));\n }\n\n updated(changed) {\n if (changed.has('auth') && this.auth && !this.upcomingOrderDate && !this.isPreview) {\n this.fetchOrders();\n }\n }\n\n handleClick() {\n let modal;\n if (this.skipModal) {\n this.createIu(this.product, this.nextUpcomingOrder.public_id, 1, false, null);\n this.concludeUpsell(this.product);\n } else if (!this.target && this.offer) {\n // TODO remove offer shadowRoot built in code.\n modal = this.offer.querySelector('og-upsell-modal');\n if (!modal) {\n modal = this.offer.shadowRoot.querySelector('og-upsell-modal');\n }\n } else if (this.target) {\n modal = document.querySelector(this.target);\n } else {\n throw Error('You must specify a target attribute or place this element as child of og-offer');\n }\n if (modal) {\n modal.setAttribute('show', true);\n }\n }\n\n render() {\n return html`\n <slot>\n <og-next-upcoming-order></og-next-upcoming-order>\n </slot>\n `;\n }\n}\n\nexport const mapStateToProps = state => ({\n isPreview: state.previewUpsellOffer,\n nextUpcomingOrder: state.previewUpsellOffer ? { public_id: 'preview-order-id' } : state.nextUpcomingOrder\n});\n\nexport const ConnectedUpsellButton = connect(mapStateToProps, { fetchOrders, createIu, concludeUpsell })(UpsellButton);\n\nexport default UpsellButton;\n", "import { html } from 'lit-element';\nimport { concludeUpsell, createIu } from '../core/actions';\nimport { connect } from '../core/connect';\nimport { auth, defaultFrequency } from '../core/props';\nimport {\n makeOptedinSelector,\n makeProductFrequencyOptedInSelector,\n getFallbackValue,\n makeProductDefaultFrequencySelector\n} from '../core/selectors';\nimport { withProduct } from '../core/resolveProperties';\nimport { TemplateElement } from '../core/base';\n\nexport class UpsellModal extends withProduct(TemplateElement) {\n static get properties() {\n return {\n ...super.properties,\n defaultFrequency,\n auth,\n subscribed: { type: Boolean, attribute: false },\n frequency: { type: String, attribute: false },\n nextUpcomingOrder: { type: Object, attribute: false },\n show: { type: Boolean, attribute: 'show' },\n offerId: { type: String }\n };\n }\n\n constructor() {\n super();\n this.createIu = () => 0;\n this.concludeUpsell = () => 0;\n }\n\n render() {\n return html`\n <og-modal ?show=${this.show} @close=${() => this.close()} @confirm=${() => this.confirm()}>\n <div slot=\"content\">\n <slot>\n <slot name=\"content\">\n <og-text key=\"upsellModalContent\"></og-text>\n </slot>\n <slot name=\"offer\">\n <br />\n\n <og-optout-button>\n <slot name=\"opt-out-label\">\n <og-text key=\"upsellModalOptOutLabel\" slot=\"label\"></og-text>\n </slot>\n </og-optout-button>\n <br />\n <og-optin-button default-frequency=${this.defaultFrequency}>\n <slot name=\"opt-in-label\">\n <og-text key=\"upsellModalOptInLabel\" slot=\"label\"></og-text>\n </slot>\n </og-optin-button>\n <br />\n <slot name=\"every-label\">\n <og-text key=\"offerEveryLabel\"></og-text>\n </slot>\n <og-select-frequency default-frequency=${this.defaultFrequency}></og-select-frequency>\n </slot>\n </slot>\n </div>\n <span slot=\"confirm\">\n <slot name=\"confirm\"><og-text key=\"upsellModalConfirmLabel\"></og-text></slot>\n </span>\n <span slot=\"cancel\">\n <slot name=\"cancel\">\n <og-text key=\"upsellModalCancelLabel\"></og-text>\n </slot>\n </span>\n </og-modal>\n `;\n }\n\n set defaultFrequency(val) {\n this._defaultFrequency = val;\n }\n\n get defaultFrequency() {\n const freq = this.querySelector('og-select-frequency');\n if (freq) {\n return freq.defaultFrequency;\n }\n\n return this._defaultFrequency;\n }\n\n confirm() {\n this.createIu(\n this.product,\n this.nextUpcomingOrder.public_id,\n 1,\n this.subscribed,\n this.frequency || this.defaultFrequency\n );\n this.close();\n }\n\n close() {\n this.concludeUpsell();\n this.removeAttribute('show');\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => ({\n auth: state.auth,\n offerId: state.offerId,\n subscribed: makeOptedinSelector(ownProps.product)(state),\n frequency: makeProductFrequencyOptedInSelector(ownProps.product)(state),\n defaultFrequency:\n makeProductDefaultFrequencySelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'defaultFrequency'),\n nextUpcomingOrder: state.previewUpsellOffer ? { public_id: 'preview-order-id' } : state.nextUpcomingOrder,\n isPreview: state.previewUpsellOffer\n});\n\nexport const ConnectedUpsellModal = connect(mapStateToProps, {\n concludeUpsell,\n createIu\n})(UpsellModal);\n\nexport default UpsellModal;\n", "import { html, css } from 'lit-element';\n\nimport { optinProduct, optoutProduct } from '../core/actions';\nimport { OptinStatus, mapStateToProps } from './OptinStatus';\nimport { connect } from '../core/connect';\n\nexport class OptinToggle extends OptinStatus {\n static get properties() {\n return {\n ...super.properties,\n frequency: { type: String }\n };\n }\n\n static get styles() {\n return css`\n :host {\n cursor: default;\n display: inline-block;\n }\n\n .btn {\n position: relative;\n width: var(--og-radio-width, 1.4em);\n height: var(--og-radio-height, 1.4em);\n margin: var(--og-radio-margin, 0);\n padding: 0;\n border: 1px solid var(--og-checkbox-border-color, black);\n background: #fff;\n vertical-align: middle;\n color: var(--og-primary-color, black);\n display: inline-flex;\n justify-content: center;\n align-items: center;\n border-radius: 3px;\n }\n\n .btn.active {\n background: var(--og-checkbox-border-color, black);\n }\n\n .btn.active:after {\n content: '\u2713';\n color: #fff;\n transform: scale(1.6);\n margin-left: 2px;\n }\n `;\n }\n\n handleClick(ev) {\n if (this.subscribed) {\n this.optoutProduct(this.product, this.offer);\n } else {\n this.optinProduct(\n this.product,\n this.frequency || this.productDefaultFrequency || this.defaultFrequency,\n this.offer\n );\n }\n ev.preventDefault();\n }\n\n render() {\n return html`\n <slot name=\"default\">\n <button id=\"action-trigger\" class=\"btn checkbox ${this.subscribed ? 'active' : ''}\"></button>\n <label for=\"action-trigger\">\n <slot>\n <slot name=\"label\"><og-text key=\"offerOptInLabel\"></og-text></slot>\n </slot>\n </label>\n </slot>\n `;\n }\n}\n\nexport const ConnectedOptinToggle = connect(mapStateToProps, { optoutProduct, optinProduct })(OptinToggle);\n\nexport default ConnectedOptinToggle;\n", "import { LitElement, html } from 'lit-element';\nimport { connect } from '../core/connect';\nimport { withOfferTemplate } from '../core/resolveProperties';\n\nexport const pluralize = (word, count) => `${word}${parseInt(count, 10) > 1 ? 's' : ''}`;\n\nexport class Text extends withOfferTemplate(LitElement) {\n static get properties() {\n return {\n pluralize: { type: Number },\n variant: { type: Number },\n i18n: { type: Object, attribute: false },\n locale: { type: Object, attribute: false },\n key: {\n type: String\n }\n };\n }\n\n createRenderRoot() {\n return this;\n }\n\n connectedCallback() {\n super.connectedCallback();\n this._textOverride = this.innerText.trim();\n }\n\n getText() {\n return this._textOverride ? this._textOverride : this.getPluralizedText(this.getVariantText(this.key));\n }\n\n getVariantText(key) {\n const i18n = {\n ...this.i18n,\n ...(this.offer && this.offer.locale)\n };\n const text = typeof i18n[key] !== 'undefined' ? i18n[key] : '';\n if (typeof this.variant === 'undefined') {\n return text;\n }\n\n return text[this.variant];\n }\n\n getPluralizedText(text) {\n if (typeof this.pluralize === 'undefined') {\n return text;\n }\n\n return text ? pluralize(text, this.pluralize) : text;\n }\n\n render() {\n return html`\n ${this.getText()}\n `;\n }\n}\n\nexport const mapStateToProps = state => ({\n i18n: state.locale || {}\n});\n\nexport const ConnectedText = connect(mapStateToProps)(Text);\n\nexport default ConnectedText;\n", "import { LitElement, html } from 'lit-element';\nimport { connect } from '../core/connect';\nimport { withProduct } from '../core/resolveProperties';\nimport { safeProductId } from '../core/utils';\nimport { INCENTIVE_STANDARD_TYPES } from '../core/constants';\n\nexport class DiscountAmount {\n constructor(value) {\n this.value = value;\n this.className = 'DiscountAmount';\n }\n\n toString() {\n return `${this.value}`;\n }\n}\n\nclass DiscountPercent extends DiscountAmount {\n constructor(value) {\n super(value);\n this.className = 'DiscountPercent';\n }\n\n toString() {\n return `${super.toString()}%`;\n }\n}\n\nclass ShippingDiscountPercent extends DiscountPercent {\n constructor(value) {\n super(value);\n this.className = 'ShippingDiscountPercent';\n }\n\n toString() {\n return this.value === 100 ? 'free shipping' : super.toString();\n }\n}\n\nconst DISCOUNT_PERCENT = 'Discount Percent';\nconst DISCOUNT_AMOUNT = 'Discount Amount';\nconst TOTAL_PRICE = 'total_price';\nconst SHIPPING_TOTAL = 'shipping_total';\nconst SUB_TOTAL = 'sub_total';\n\nconst discountBuilder = ({ field, object, type, value }) => {\n const supportedDiscounts = [\n [new DiscountPercent(value), { field: TOTAL_PRICE, object: 'item', type: DISCOUNT_PERCENT }],\n [new DiscountAmount(value), { field: TOTAL_PRICE, object: 'item', type: DISCOUNT_AMOUNT }],\n [new ShippingDiscountPercent(value), { field: SHIPPING_TOTAL, object: 'order', type: DISCOUNT_PERCENT }],\n [new DiscountAmount(value), { field: SHIPPING_TOTAL, object: 'order', type: DISCOUNT_AMOUNT }],\n [new DiscountPercent(value), { field: SUB_TOTAL, object: 'order', type: DISCOUNT_PERCENT }],\n [new DiscountAmount(value), { field: SUB_TOTAL, object: 'order', type: DISCOUNT_AMOUNT }]\n ];\n\n const available = supportedDiscounts.find(([, it]) => it.field === field && it.object === object && it.type === type);\n return available && available[0];\n};\n\nexport const getTransformedDiscounts = discounts => {\n return discounts.map(discount => discountBuilder(discount)).filter(discount => discount !== undefined);\n};\n\nfunction isMatchingIncentive(incentive, { incentiveValue, incentiveClass }) {\n if (discountBuilder(incentive).className !== incentiveClass) {\n return false;\n }\n\n if (incentiveValue && incentiveValue.toString() !== incentive.value.toString()) {\n return false;\n }\n\n return true;\n}\n\nexport function replaceText(acc, curr) {\n return acc.replace(this.textToReplace, discountBuilder(curr));\n}\n\nconst preferredIncentiveStandards = [INCENTIVE_STANDARD_TYPES.PSI, INCENTIVE_STANDARD_TYPES.PROGRAM_WIDE];\n\nexport class IncentiveText extends withProduct(LitElement) {\n static get properties() {\n return {\n ...super.properties,\n incentives: { type: Object, attribute: false },\n from: { type: String },\n label: { type: String },\n initial: { type: Boolean, default: false },\n value: { type: Number }\n };\n }\n\n createRenderRoot() {\n return this;\n }\n\n render() {\n const incentiveClass = this.from;\n const incentiveValue = this.value;\n const incentiveType = this.initial ? 'initial' : 'ongoing';\n /** @type {import('../core/types/reducer').Incentive[]} */\n const incentivesOfType = this.incentives[incentiveType] || [];\n\n // prefer to display PSI or program wide incentives, if available\n // since the incentives response may contain other incentives that do not apply, e.g. prepaid, Nth order, customer group, etc.\n const preferredIncentives = incentivesOfType.filter(\n incentive =>\n // we only have criteria if the incentive is standardized\n incentive.criteria &&\n incentive.criteria.node_type === 'PREMISE' &&\n // prefer to show non-threshold discounts\n // we don't currently evaluate thresholds, so we don't know if they apply or not (especially if it's order-level)\n !incentive.threshold_field &&\n preferredIncentiveStandards.includes(incentive.criteria.standard)\n );\n\n const incentive = [\n // put preferred incentives first, so we return one of those if it matches\n ...preferredIncentives,\n // if no preferred incentives matched, try the rest\n ...incentivesOfType.filter(incentive => !preferredIncentives.includes(incentive))\n ].find(incentive => isMatchingIncentive(incentive, { incentiveClass, incentiveValue }));\n\n return html`\n ${this.label} ${incentive ? discountBuilder(incentive) : this.renderFallback()}\n `;\n }\n\n renderFallback() {\n return html`\n ${discountBuilder({\n field: 'sub_total',\n object: 'order',\n type: 'Discount Percent',\n value: this.value\n })}\n `;\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => ({\n incentives: (state.incentives || {})[ownProps && ownProps?.product && safeProductId(ownProps?.product?.id)] || {}\n});\n\nexport const ConnectedIncentiveText = connect(mapStateToProps)(IncentiveText);\n\nexport default ConnectedIncentiveText;\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isPrimitive} from '../lib/parts.js';\nimport {directive, NodePart, Part} from '../lit-html.js';\n\ninterface PreviousValue {\n readonly value: unknown;\n readonly fragment: DocumentFragment;\n}\n\n// For each part, remember the value that was last rendered to the part by the\n// unsafeHTML directive, and the DocumentFragment that was last set as a value.\n// The DocumentFragment is used as a unique key to check if the last value\n// rendered to the part was with unsafeHTML. If not, we'll always re-render the\n// value passed to unsafeHTML.\nconst previousValues = new WeakMap<NodePart, PreviousValue>();\n\n/**\n * Renders the result as HTML, rather than text.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive((value: unknown) => (part: Part): void => {\n if (!(part instanceof NodePart)) {\n throw new Error('unsafeHTML can only be used in text bindings');\n }\n\n const previousValue = previousValues.get(part);\n\n if (previousValue !== undefined && isPrimitive(value) &&\n value === previousValue.value && part.value === previousValue.fragment) {\n return;\n }\n\n const template = document.createElement('template');\n template.innerHTML = value as string; // innerHTML casts to string internally\n const fragment = document.importNode(template.content, true);\n part.setValue(fragment);\n previousValues.set(part, {value, fragment});\n});\n", "import { LitElement, html } from 'lit-element';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html';\nimport { connect } from '../core/connect';\nimport { withProduct } from '../core/resolveProperties';\nimport { makeBenefitMessagesSelector } from '../core/selectors';\n\nexport class BenefitMessages extends withProduct(LitElement) {\n static get properties() {\n return {\n ...super.properties,\n messages: { type: Array, attribute: false }\n };\n }\n\n createRenderRoot() {\n return this;\n }\n\n render() {\n if (!this.messages?.length) return html``;\n // Messages are expected to be pre-sanitized by SSPC, so we can safely render them as HTML.\n return html`\n <ul class=\"og-benefit-messages\">\n ${this.messages.map(\n msg => html`\n <li>${unsafeHTML(msg)}</li>\n `\n )}\n </ul>\n `;\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => makeBenefitMessagesSelector(ownProps?.product)(state);\n\nexport const ConnectedBenefitMessages = connect(mapStateToProps)(BenefitMessages);\n\nexport default ConnectedBenefitMessages;\n", "import { html, css } from 'lit-element';\nimport { productChangeFrequency } from '../core/actions';\nimport { withChildOptions } from '../core/resolveProperties';\nimport { FrequencyStatus, mapStateToProps, frequencyText } from './FrequencyStatus';\nimport { connect } from '../core/connect';\nimport { frequencyToSellingPlan } from '../core/utils';\n\nexport const frequencyEquals = (a, b) => {\n if (a === null || b === null) return false;\n return a.every === b.every && a.period === b.period;\n};\n\nexport class SelectFrequency extends withChildOptions(FrequencyStatus) {\n static get properties() {\n return {\n ...super.properties,\n defaultText: { type: String, attribute: 'default-text' }\n };\n }\n\n /**\n * // css customization i.e.\n * og-select-frequency {\n * background: black;\n * color: orange;\n * border-radius: 0;\n * font-weight: bold;\n * font-family: Impact;\n * --og-select-padding: 10px 30px 10px 10px;\n * font-size: 20px;\n * }\n */\n static get styles() {\n return css`\n :host {\n display: inline-block;\n cursor: pointer;\n background-color: var(--og-select-bg-color, #fff);\n border: var(--og-select-border, 1px solid #aaa);\n border-radius: var(--og-select-border-radius, 0.5em);\n border-width: var(--og-select-border-width, 1px);\n box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);\n z-index: 1;\n }\n `;\n }\n\n set defaultFrequency(val) {\n this._defaultFrequency = val;\n }\n\n // default frequency comes from redux store first, then default option value, and then finally attribute value.\n get defaultFrequency() {\n const { options, isSelected } = this.childOptions;\n let result;\n\n if (this.productDefaultFrequency) {\n result = this.productDefaultFrequency;\n } else if (isSelected) {\n result = isSelected;\n } else if (options.length) {\n result = options[0].value;\n } else {\n result = this._defaultFrequency;\n }\n\n // this runs for shopify selling plans translated to freq\n if (\n this.productFrequencies?.frequencies?.length &&\n result &&\n this.productFrequencies?.frequenciesEveryPeriod?.length\n ) {\n return frequencyToSellingPlan(result, this.productFrequencies);\n }\n\n return result;\n }\n\n get currentFrequency() {\n if (this.frequency) {\n return this.frequency;\n }\n return this.defaultFrequency;\n }\n\n productChangeFrequency(_, value) {\n this.frequency = value;\n }\n\n render() {\n let options;\n const defaultFrequency = this.defaultFrequency;\n\n if (this.frequencies?.length) {\n options = this.frequencies.map((value, ix) => {\n let text;\n const { frequenciesEveryPeriod, frequenciesText } = this.productFrequencies;\n if (frequenciesEveryPeriod && ix in frequenciesEveryPeriod) {\n text = frequencyText(frequenciesEveryPeriod[ix], defaultFrequency);\n } else if (frequenciesText && ix in frequenciesText) {\n text = frequenciesText[ix];\n } else {\n text = frequencyText(value, this.defaultFrequency);\n }\n return { value, text };\n });\n } else {\n ({ options } = this.childOptions);\n }\n\n if (!options.length) {\n options = (this.frequencies || []).map(value => ({\n value,\n text: frequencyText(value, defaultFrequency)\n }));\n }\n\n options = options.map(({ text, value }) => ({\n text:\n value === defaultFrequency\n ? html`\n ${text} ${this.defaultText || ''}\n `\n : text,\n value\n }));\n\n return html`\n <og-select\n .ariaLabel=\"${'Delivery frequency'}\"\n .options=\"${options}\"\n .selected=\"${this.currentFrequency}\"\n .onChange=\"${({ target: { value } }) => {\n this.productChangeFrequency(this.product, value, this.offer);\n }}\"\n ></og-select>\n `;\n }\n}\n\nexport const ConnectedSelectFrequency = connect(mapStateToProps, {\n productChangeFrequency\n})(SelectFrequency);\n\nexport default ConnectedSelectFrequency;\n", "const validParts = {\n // %d\tDay of the month as a decimal number (range 01 to 31).\n day: { day: '2-digit' },\n\n // %e\tDay of the month as a decimal number (range 1 to 31).\n 'day-numeric': { day: 'numeric' },\n\n // %a\tAbbreviated name of the day of the week.\n 'day-short': { weekday: 'short' },\n\n // %A\tFull name of the day of the week.\n 'day-long': { weekday: 'long' },\n\n // %m\tMonth as a decimal number (range 01 to 12).\n month: { month: '2-digit' },\n\n // %n\tMonth as a decimal number (range 1 to 12).\n 'month-numeric': { month: 'numeric' },\n\n // %b\tAbbreviated month name.\n 'month-short': { month: 'short' },\n\n // %B\tFull month name.\n 'month-long': { month: 'long' },\n\n // %y\tYear as a decimal number without a century (range 00 to 99).\n year: { year: '2-digit' },\n\n // %Y\tYear as a decimal number including the century.\n 'year-numeric': { year: 'numeric' }\n};\n\nexport const parse = date => {\n if (date instanceof Date) return date;\n return new Date(Date.parse(date));\n};\n\nexport const formatDate = (date, format) => {\n if (date instanceof Date) {\n return (format || '').toString().replace(/\\{\\{([-\\w]+)\\}\\}/g, it => {\n const part = it.replace(/[{}]/g, '');\n const value = validParts[part];\n\n if (typeof value === 'undefined') {\n return part;\n }\n\n const formatter = new Intl.DateTimeFormat('en-us', value);\n const dateInParts = formatter.formatToParts(date);\n const [{ value: result }] = dateInParts;\n return result;\n });\n }\n\n return date;\n};\n", "import { LitElement, html } from 'lit-element';\nimport { connect } from '../core/connect';\nimport { formatDate } from '../core/dateUtils';\n\nexport class FormattedDate extends LitElement {\n static get properties() {\n return {\n value: { type: String, reflect: true },\n format: { type: String }\n };\n }\n\n createRenderRoot() {\n return this;\n }\n\n render() {\n return html`\n ${formatDate(this.value, this.format || '{{month-long}} {{day}}, {{year-numeric}}')}\n `;\n }\n}\n\nexport const mapStateToProps = state => ({\n value: state.previewUpsellOffer ? new Date() : state.nextUpcomingOrder.place\n});\n\nexport const ConnectedNextUpcomingOrder = connect(mapStateToProps)(FormattedDate);\n\nexport default FormattedDate;\n", "import { html, css } from 'lit-element';\nimport memoize from 'lodash.memoize';\nimport { connect } from '../core/connect';\nimport { setPreview } from '../core/actions-preview';\nimport {\n fetchOffer,\n productHasChangedComponents,\n fetchOrders,\n optinProduct,\n setProductToSubscribe,\n setFirstOrderPlaceDate\n} from '../core/actions';\nimport {\n isSameProduct,\n getFallbackValue,\n templatesSelector,\n makeOptedoutSelector,\n makeProductFrequencyOptedInSelector,\n makeProductSpecificDefaultFrequencySelector,\n optedinSelector,\n autoshipSelector,\n makeOptedinSelector,\n kebabCase,\n makeProductDefaultFrequencySelector\n} from '../core/selectors';\nimport { product as productProp, auth as authProp } from '../core/props';\nimport { TemplateElement } from '../core/base';\nimport { onReady } from '../core/utils';\nimport { DEFAULT_OFFER_MODULE } from '../core/constants';\n\nconst memoizeKey = (...args) => JSON.stringify(args);\n\nconst logOnce = messageFn => {\n let hasLogged = false;\n return (...args) => {\n if (!hasLogged) {\n console.warn(messageFn(...args));\n hasLogged = true;\n }\n };\n};\n\nconst logMulticurrencyWarning = logOnce(\n (storeCurrency, primaryCurrency) =>\n `Hiding Ordergroove offer since the store currency ${storeCurrency} does not match your configured currency ${primaryCurrency} and you are not set up for multicurrency. Contact your Ordergroove representative for next steps.`\n);\n\nconst logProductSpecificFrequencyListWarning = logOnce(\n () => `Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists.`\n);\n\nexport const productAndComponents = memoize(\n (product, components) => Object.assign({ components }, product),\n memoizeKey\n);\n\nexport class Offer extends TemplateElement {\n static get properties() {\n return {\n ...super.properties,\n\n config: { type: Object, attribute: false },\n product: productProp,\n productComponents: { type: Array, attribute: 'product-components' },\n offerId: { type: String, attribute: false },\n auth: authProp,\n preview: { type: String, attribute: 'preview', reflect: 'true' },\n location: { type: String },\n autoshipByDefault: { type: Boolean, attribute: 'autoship-by-default' },\n productDefaultFrequency: { type: String, attribute: false },\n locale: { type: Object, attribute: true },\n firstOrderPlaceDate: { type: String, attribute: 'first-order-place-date' },\n productToSubscribe: { type: String, attribute: 'product-to-subscribe' },\n subscribed: { type: Boolean, reflect: true },\n frequency: { type: String, reflect: true },\n productFrequency: { type: String },\n isCart: { type: Boolean, attribute: 'cart' },\n optedin: { type: Object },\n variationId: { type: String },\n /** Attribute to force reading prices from the Offer response instead of the selling plan. Only used for testing. */\n overrideSellingPlanPrice: { type: Boolean, attribute: 'dev-override-selling-plan-price' }\n };\n }\n\n firstUpdated() {\n try {\n const preview = Array.from(this.getAttributeNames()).find(it => it.startsWith('preview-'));\n if (preview === 'preview-standard-offer') this.preview = 'regular';\n else if (preview === 'preview-upsell-offer') this.preview = 'upsell';\n else if (preview === 'preview-subscribed-offer') this.preview = 'subscribed';\n else if (preview === 'preview-prepaid-offer') this.preview = 'prepaid';\n } catch (e) {\n // in some rare cases, getAttributeNames throws an error and prevents the offer from initializing\n // since preview mode is non-essential, we can log and ignore it\n console.warn('Unable to set preview property', e);\n }\n }\n\n static get styles() {\n return css`\n :host[hidden] {\n display: none;\n }\n\n :host {\n display: block;\n }\n\n :host {\n color: var(--og-global-color, #000);\n font-family: var(--og-global-family, inherit);\n font-size: var(--og-global-size, inherit);\n padding: var(--og-wrapper-padding, 10px 0);\n min-width: var(--og-wrapper-min-width, 0);\n }\n\n p {\n margin: 0 0 0.3em;\n }\n\n :host og-upsell-button button {\n font-family: var(--og-upsell-family, inherit);\n font-size: var(--og-upsell-size, inherit);\n background-color: var(--og-upsell-background, inherit);\n color: var(--og-upsell-color, inherit);\n }\n\n .og-modal__btn {\n font-size: var(--og-modal-button-size, 0.875rem);\n font-family: var(--og-modal-button-family, inherit);\n padding-left: 1rem;\n padding-right: 1rem;\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n background-color: var(--og-modal-button-background, #e6e6e6);\n color: var(--og-modal-button-color, rgba(0, 0, 0, 0.8));\n border-radius: 0.25rem;\n border-style: none;\n border-width: 0;\n cursor: pointer;\n -webkit-appearance: button;\n text-transform: none;\n overflow: visible;\n line-height: 1.15;\n margin: 0;\n will-change: transform;\n -moz-osx-font-smoothing: grayscale;\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transition: -webkit-transform 0.25s ease-out;\n transition: transform 0.25s ease-out;\n transition:\n transform 0.25s ease-out,\n -webkit-transform 0.25s ease-out;\n }\n\n .og-modal__btn:focus,\n .og-modal__btn:hover {\n -webkit-transform: scale(1.05);\n transform: scale(1.05);\n }\n\n .og-modal__btn-primary {\n background-color: var(--og-confirm-button-background, #00449e);\n color: var(--og-confirm-button-color, #fff);\n }\n `;\n }\n\n static get initialTemplate() {\n return `\n <og-when test=\"regularEligible\">\n <div>\n\n <og-optout-button>\n <og-text key=\"offerOptOutLabel\"></og-text>\n </og-optout-button>\n </div>\n <div>\n <og-optin-button>\n <og-price discount>\n <span slot=\"prepend\">Subscribe and get</span>\n <span slot=\"append\">off</span>\n <og-text key=\"offerOptInLabel\" slot=\"fallback\"></og-text> \n </og-price>\n <og-price regular></og-price>\n <og-price subscription></og-price>\n \n </og-optin-button>\n <og-tooltip placement=\"bottom\">\n <div slot=\"trigger\">\n <og-text key=\"offerTooltipTrigger\"></og-text>\n </div>\n <div slot=\"content\">\n <og-text key=\"offerTooltipContent\"></og-text>\n </div>\n </og-tooltip>\n </div>\n <div style=\"margin-left: 2.2em\">\n <og-text key=\"offerEveryLabel\"></og-text>\n <og-select-frequency>\n <option value=\"3_1\" selected>3 Days</option>\n <option value=\"1_2\">1 Week</option>\n <option value=\"1_3\">1 Month</option>\n </og-select-frequency>\n </div>\n </og-when>\n\n <og-when test=\"upsellEligible\">\n <og-when test=\"!upcomingOrderContainsProduct\">\n <div class=\"og-iu-offer\">\n <og-text key=\"upsellButtonLabel\"></og-text>\n <og-upsell-button>\n <button type=\"button\">\n <og-text key=\"upsellButtonContent\"></og-text>\n <og-next-upcoming-order></og-next-upcoming-order>\n </button>\n </og-upsell-button>\n <og-upsell-modal>\n <og-text key=\"upsellModalContent\"></og-text>\n <br />\n\n <og-optout-button>\n <og-text key=\"upsellModalOptOutLabel\"></og-text>\n </og-optout-button>\n\n <br />\n\n <og-optin-button>\n <og-text key=\"upsellModalOptInLabel\"></og-text>\n </og-optin-button>\n <br />\n\n <og-text key=\"offerEveryLabel\"></og-text>\n <og-select-frequency>\n <option value=\"3_1\" selected>3 Days</option>\n <option value=\"1_2\">1 Week</option>\n <option value=\"1_3\">1 Month</option>\n </og-select-frequency>\n\n <button slot=\"confirm\" class=\"og-modal__btn og-modal__btn-primary\">\n <og-text key=\"upsellModalConfirmLabel\"></og-text>\n </button>\n <button slot=\"cancel\" class=\"og-modal__btn\"><og-text key=\"upsellModalCancelLabel\"></og-text></button>\n </og-upsell-modal>\n </div>\n </og-when>\n <og-when test=\"upcomingOrderContainsProduct\">\n The product is in your next upcomming order\n </og-when>\n </og-when>\n \n `;\n }\n\n constructor() {\n super();\n this.module = 'pdp';\n this.product = {};\n this.productComponents = [];\n this.fetchOffer = () => 0;\n this.fetchOrders = () => 0;\n this.productHasChangedComponents = () => 0;\n this.setFirstOrderPlaceDate = () => 0;\n this.setProductToSubscribe = () => 0;\n this.productChangeFrequency = () => 0;\n }\n\n applyTemplate(template) {\n super.applyTemplate(template);\n const { id: variationId, locale } = template;\n this.variationId = variationId;\n this.locale = locale;\n const event = new CustomEvent('template-changed');\n this.dispatchEvent(event);\n }\n\n updated(changed) {\n if (changed.has('preview')) {\n this.setPreview(this.preview, changed.get('preview'), this);\n }\n this.frequency = this.defaultFrequency;\n\n if (changed.has('product') && !this.isPreview) {\n onReady(() => this.fetchOffer(this.product.id, DEFAULT_OFFER_MODULE, this));\n }\n\n if (changed.has('firstOrderPlaceDate') && this.product.id && !this.isPreview) {\n this.setFirstOrderPlaceDate(this.product.id, this.firstOrderPlaceDate);\n }\n\n if (changed.has('productToSubscribe') && this.product.id && !this.isPreview) {\n this.setProductToSubscribe(this.product.id, this.productToSubscribe);\n }\n\n if (changed.has('auth') && this.auth && !this.isPreview) {\n this.fetchOrders();\n }\n\n if (changed.has('productComponents')) {\n const newProductWithComponents = productAndComponents(this.product, this.productComponents);\n const oldProductWithComponents = Object.assign({}, this.product, {\n components: changed.get('productComponents')\n });\n\n if (!isSameProduct(newProductWithComponents, oldProductWithComponents)) {\n this.productHasChangedComponents(newProductWithComponents, oldProductWithComponents);\n }\n }\n\n if (\n (changed.has('offerId') ||\n changed.has('autoshipByDefault') ||\n changed.has('location') ||\n changed.has('product')) &&\n this.offerId &&\n this.autoshipByDefault &&\n (this.location === 'cart' || this.isCart) &&\n this.product.id &&\n this.optinProduct &&\n !(this.optedin || []).find(product => isSameProduct(product, this.product))\n ) {\n this.optinProduct(\n {\n ...this.product,\n ...(this.productComponents.length && { components: this.productComponents })\n },\n this.defaultFrequency,\n this\n );\n }\n }\n\n get isPreview() {\n return this.preview || window.og.previewMode;\n }\n\n get shouldEnableOffer() {\n // currently, only the shopify reducer populates storeCurrency\n if (this.config && this.config.storeCurrency && this.config.merchantSettings) {\n const shouldEnable =\n this.config.merchantSettings.multicurrency_enabled ||\n this.config.storeCurrency === this.config.merchantSettings.currency_code;\n if (!shouldEnable) {\n logMulticurrencyWarning(this.config.storeCurrency, this.config.merchantSettings.currency_code);\n return false;\n }\n }\n\n return true;\n }\n\n render() {\n return this.shouldEnableOffer\n ? html`\n <slot></slot>\n `\n : null;\n }\n\n get defaultFrequency() {\n const storeFrequency = this.productFrequency || this.productDefaultFrequency;\n\n if (storeFrequency) {\n return storeFrequency;\n }\n\n const freq = this.querySelector('og-select-frequency');\n if (freq && freq.currentFrequency) {\n return freq.currentFrequency;\n }\n\n // not certain if this logic was used or not -- the following code was inlined from a shared function that was only used here\n const attributeValue = this.getValueFromAttribute('defaultFrequency');\n if (attributeValue) {\n return attributeValue;\n }\n\n if (this.template && this.template.config && typeof this.template.config.defaultFrequency !== 'undefined') {\n return this.template.config.defaultFrequency;\n }\n\n return this.configDefaultFrequency;\n }\n\n getValueFromAttribute(key) {\n const attrName = kebabCase(key);\n if (this.hasAttribute(attrName)) {\n const attr = this.getAttribute(attrName);\n if (attr.toString().toLowerCase() === 'true') return true;\n if (attr.toString().toLowerCase() === 'false') return false;\n return attr;\n }\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => ({\n config: state.config,\n auth: state.auth,\n offerId: ((state.productOffer || {})[(ownProps.product || {}).id] || [])[0],\n configDefaultFrequency: makeProductDefaultFrequencySelector(ownProps.product?.id)(state),\n productFrequency: makeProductFrequencyOptedInSelector(ownProps.product)(state),\n productDefaultFrequency: makeProductSpecificDefaultFrequencySelector((ownProps.product || {}).id)(state),\n autoshipByDefault:\n (state.config && state.config.autoshipByDefault) ||\n getFallbackValue(ownProps, 'autoshipByDefault', autoshipSelector(state)[(ownProps.product || {}).id]),\n ...(makeOptedoutSelector(ownProps.product)(state) && { autoshipByDefault: false }),\n optedin: optedinSelector(state),\n subscribed: makeOptedinSelector(ownProps.product)(state),\n ...templatesSelector(state)\n});\n\nexport const ConnectedOffer = connect(mapStateToProps, {\n fetchOffer,\n fetchOrders,\n productHasChangedComponents,\n optinProduct,\n setFirstOrderPlaceDate,\n setProductToSubscribe,\n setPreview\n})(Offer);\n\nexport default ConnectedOffer;\n", "import { receiveOffer, receiveOrders, authorize, unauthorized, optinProduct, setBenefitMessages } from './actions';\nimport { getObjectStructuredProductPlans } from './adapters';\nimport * as constants from './constants';\n\nexport const setPreviewStandardOffer = (isPreview, productId, offer) =>\n async function setPreviewStandardOfferThunk(dispatch) {\n await dispatch({\n type: constants.SET_PREVIEW_STANDARD_OFFER,\n payload: { isPreview, productId }\n });\n await dispatch({\n type: constants.UNAUTHORIZED\n });\n await dispatch(\n setBenefitMessages({\n '47c01e9aacbe40389b5c7325d79091aa': { 'en-US': 'Coffee products with 15% off' },\n e6534b9d877f41e586c37b7d8abc3a58: { 'en-US': 'Get a free gift on your 3rd order' },\n f35e842710b24929922db4a529eecd40: { 'en-US': 'Free shipping for your recurring orders' }\n })\n );\n await dispatch(\n receiveOffer(\n {\n in_stock: { [productId]: true },\n eligibility_groups: { [productId]: ['subscription', 'upsell'] },\n result: 'success',\n autoship: { [productId]: true },\n autoship_by_default: { [productId]: false },\n modifiers: {},\n module_view: { regular: '096135e6650111e9a444bc764e106cf4' },\n incentives_display: {\n '47c01e9aacbe40389b5c7325d79091aa': {\n field: 'sub_total',\n object: 'order',\n type: 'Discount Percent',\n value: 5\n },\n e6534b9d877f41e586c37b7d8abc3a58: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n f35e842710b24929922db4a529eecd40: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n '5be321d7c17f4e18a757212b9a20bfcc': {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 1\n }\n },\n incentives: {\n [productId]: {\n initial: ['5be321d7c17f4e18a757212b9a20bfcc'],\n ongoing: [\n 'e6534b9d877f41e586c37b7d8abc3a58',\n '47c01e9aacbe40389b5c7325d79091aa',\n 'f35e842710b24929922db4a529eecd40'\n ]\n }\n }\n },\n offer,\n productId\n )\n );\n };\n\nexport const mergeProductPlansToState = (state, newProductPlans) => {\n Object.entries(newProductPlans).forEach(([key, value]) => {\n if (Object.prototype.hasOwnProperty.call(state, key)) {\n const mergedArray = state[key].concat(value);\n const uniqueArray = [...new Set(mergedArray.map(item => JSON.stringify(item)))];\n state[key] = uniqueArray.map(item => JSON.parse(item));\n } else {\n state[key] = value;\n }\n });\n return state;\n};\n\nexport const setPreviewUpsellOffer = (isPreview, productId, offer) =>\n async function setPreviewUpsellOfferThunk(dispatch, getState) {\n await dispatch({ type: constants.SET_PREVIEW_UPSELL_OFFER, payload: { isPreview, productId } });\n\n const { merchantId } = getState();\n if (isPreview) {\n await dispatch(\n setBenefitMessages({\n '47c01e9aacbe40389b5c7325d79091aa': { 'en-US': 'Coffee products with 15% off' },\n e6534b9d877f41e586c37b7d8abc3a58: { 'en-US': 'Get a free gift on your 3rd order' }\n })\n );\n await dispatch(\n receiveOffer(\n {\n in_stock: { [productId]: true },\n module_view: { regular: '096135e6650111e9a444bc764e106cf4' },\n default_frequencies: { [productId]: { every: 1, every_period: 3 } },\n eligibility_groups: { [productId]: ['subscription', 'upsell'] },\n result: 'success',\n autoship: { [productId]: true },\n autoship_by_default: { [productId]: false },\n modifiers: {}\n },\n offer,\n productId\n )\n );\n await dispatch(\n receiveOrders({\n count: 1,\n next: null,\n previous: null,\n results: [\n {\n merchant: '0e5de2bedc5e11e3a2e4bc764e106cf4',\n customer: 'TestCust',\n payment: 'e98e789aba0111e9b90fbc764e107990',\n shipping_address: 'b3a5816ae59611e78937bc764e1043b0',\n public_id: '23322d4a83eb11ea9a1ebc764e101db1',\n sub_total: '206.98',\n tax_total: '0.00',\n shipping_total: '10.00',\n discount_total: '0.00',\n total: '216.98',\n created: '2020-04-21 11:14:11',\n place: '2020-06-24 00:00:00',\n cancelled: null,\n tries: 0,\n generic_error_count: 0,\n status: 1,\n type: 1,\n order_merchant_id: null,\n rejected_message: null,\n extra_data: null,\n locked: false,\n oos_free_shipping: false\n }\n ]\n })\n );\n await dispatch(authorize(merchantId, 'sig_field', 'ts', 'sig'));\n } else {\n await dispatch(unauthorized());\n }\n };\n\nexport const setPreviewPrepaid = (isPreview, productId, offer) =>\n async function setPreviewPrepaidThunk(dispatch, getState) {\n const existingProductPlans = getState().productPlans;\n\n await dispatch({\n type: constants.SET_PREVIEW_PREPAID_OFFER,\n payload: { isPreview, productId }\n });\n await dispatch({\n type: constants.UNAUTHORIZED\n });\n await dispatch(\n setBenefitMessages({\n '47c01e9aacbe40389b5c7325d79091aa': { 'en-US': 'Coffee products with 15% off' },\n e6534b9d877f41e586c37b7d8abc3a58: { 'en-US': 'Get a free gift on your 3rd order' }\n })\n );\n await dispatch(\n receiveOffer(\n {\n in_stock: { [productId]: true },\n eligibility_groups: { [productId]: ['subscription', 'upsell', 'prepaid'] },\n result: 'success',\n autoship: { [productId]: true },\n autoship_by_default: { [productId]: false },\n modifiers: {},\n module_view: { regular: '096135e6650111e9a444bc764e106cf4' },\n incentives_display: {\n '47c01e9aacbe40389b5c7325d79091aa': {\n field: 'sub_total',\n object: 'order',\n type: 'Discount Percent',\n value: 5\n },\n e6534b9d877f41e586c37b7d8abc3a58: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n f35e842710b24929922db4a529eecd40: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n '5be321d7c17f4e18a757212b9a20bfcc': {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 1\n }\n },\n incentives: {\n [productId]: {\n initial: ['5be321d7c17f4e18a757212b9a20bfcc'],\n ongoing: [\n 'e6534b9d877f41e586c37b7d8abc3a58',\n '47c01e9aacbe40389b5c7325d79091aa',\n 'f35e842710b24929922db4a529eecd40'\n ]\n }\n }\n },\n offer,\n productId\n )\n );\n await dispatch({\n type: constants.RECEIVE_PRODUCT_PLANS,\n payload: mergeProductPlansToState(\n existingProductPlans,\n getObjectStructuredProductPlans({\n [productId]: [\n {\n frequency: '1_3',\n regularPrice: '$15.00',\n subscriptionPrice: '$12.00',\n discountRate: '25%',\n prepaidShipments: 3,\n regularPrepaidPrice: '$36.00',\n prepaidSavingsPerShipment: '$3.00',\n prepaidSavingsTotal: '$9.00',\n prepaidExtraSavingsPercentage: '10%'\n },\n {\n frequency: '1_3',\n regularPrice: '$15.00',\n subscriptionPrice: '$12.00',\n discountRate: '20%',\n prepaidShipments: 6,\n regularPrepaidPrice: '$72.00',\n prepaidSavingsPerShipment: '$3.00',\n prepaidSavingsTotal: '$18.00',\n prepaidExtraSavingsPercentage: '10%'\n },\n {\n frequency: '1_3',\n regularPrice: '$15.00',\n subscriptionPrice: '$12.00',\n discountRate: '20%',\n prepaidShipments: 12,\n regularPrepaidPrice: '$144.00',\n prepaidSavingsPerShipment: '$3.00',\n prepaidSavingsTotal: '$36.00',\n prepaidExtraSavingsPercentage: '10%'\n }\n ]\n })\n )\n });\n await dispatch({\n type: constants.SET_CONFIG,\n payload: {\n prepaidSellingPlans: {\n [productId]: [\n {\n numberShipments: 3,\n sellingPlan: '1_3'\n },\n {\n numberShipments: 6,\n sellingPlan: '1_3'\n },\n {\n numberShipments: 12,\n sellingPlan: '1_3'\n }\n ]\n }\n }\n });\n };\n\nexport const setPreview = (value, oldValue, offer) =>\n async function (dispatch, _getState) {\n await dispatch({ type: constants.LOCAL_STORAGE_CLEAR });\n await dispatch({\n type: constants.SET_PREVIEW_STANDARD_OFFER,\n payload: { isPreview: false, productId: offer.product.id }\n });\n await dispatch({\n type: constants.SET_PREVIEW_UPSELL_OFFER,\n payload: { isPreview: false, productId: offer.product.id }\n });\n\n switch (value) {\n case 'regular':\n dispatch(setPreviewStandardOffer(true, offer.product.id, offer));\n break;\n case 'upsell':\n dispatch(setPreviewUpsellOffer(true, offer.product.id, offer));\n break;\n case 'subscribed':\n dispatch(setPreviewStandardOffer(true, offer.product.id, offer));\n dispatch(optinProduct(offer.product, '2_2'));\n break;\n case 'prepaid':\n dispatch(setPreviewPrepaid(true, offer.product.id, offer));\n // Prepaid needs to be subscribed to appear\n dispatch(optinProduct(offer.product, '1_3'));\n break;\n default:\n }\n };\n", "import { LitElement, html, css } from 'lit-element';\n\nexport class Modal extends LitElement {\n constructor() {\n super();\n this.showCancelButton = true;\n this.showConfirmButton = true;\n }\n\n static get properties() {\n return {\n title: { type: String, attribute: false },\n content: { type: String, attribute: false },\n confirmText: { type: String, attribute: false },\n cancelText: { type: String, attribute: false },\n showCancelButton: { type: Boolean },\n showConfirmButton: { type: Boolean },\n show: { type: Boolean, attribute: 'show' }\n };\n }\n\n static get styles() {\n return css`\n :host[hidden] {\n display: none;\n }\n\n :host {\n display: block;\n }\n\n .og-modal {\n display: none;\n }\n\n .og-modal.is-open {\n display: block;\n }\n\n .og-modal__overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.6);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n }\n\n .og-modal__container {\n background-color: var(--og-modal-background-color, #fff);\n padding: var(--og-modal-padding, 30px);\n max-width: 500px;\n max-height: 100vh;\n border-radius: var(--og-modal-border-radius, 4px);\n box-sizing: border-box;\n }\n\n .og-modal__header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .og-modal__title {\n margin-top: 0;\n margin-bottom: 0;\n font-weight: 600;\n font-size: 1.25rem;\n line-height: 1.25;\n color: #00449e;\n box-sizing: border-box;\n }\n\n .og-modal__close {\n background: transparent;\n border: 0;\n }\n\n .og-modal__close:before {\n content: '\u2715';\n }\n\n .og-modal__content {\n margin-top: 2rem;\n margin-bottom: 2rem;\n line-height: 1.5;\n }\n\n .og-modal__btn {\n font-size: var(--og-modal-button-size, 0.875rem);\n font-family: var(--og-modal-button-family, inherit);\n padding-left: 1rem;\n padding-right: 1rem;\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n background-color: var(--og-modal-button-background, #e6e6e6);\n color: var(--og-modal-button-color, rgba(0, 0, 0, 0.8));\n border-radius: 0.25rem;\n border-style: none;\n border-width: 0;\n cursor: pointer;\n -webkit-appearance: button;\n text-transform: none;\n overflow: visible;\n line-height: 1.15;\n margin: 0;\n will-change: transform;\n -moz-osx-font-smoothing: grayscale;\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transition: -webkit-transform 0.25s ease-out;\n transition: transform 0.25s ease-out;\n transition:\n transform 0.25s ease-out,\n -webkit-transform 0.25s ease-out;\n }\n\n .og-modal__btn:focus,\n .og-modal__btn:hover {\n -webkit-transform: scale(1.05);\n transform: scale(1.05);\n }\n\n .og-modal__btn-primary {\n background-color: var(--og-confirm-button-background, #00449e);\n color: var(--og-confirm-button-color, #fff);\n }\n .btn {\n cursor: pointer;\n }\n `;\n }\n\n close() {\n this.removeAttribute('show');\n this.dispatchEvent(new CustomEvent('close'));\n }\n\n confirm() {\n this.removeAttribute('show');\n this.dispatchEvent(new CustomEvent('confirm'));\n }\n\n get confirmButton() {\n return this.showConfirmButton\n ? html`\n <span @click=\"${() => this.confirm()}\">\n <slot name=\"confirm\" class=\"btn\">\n <button class=\"og-modal__btn og-modal__btn-primary og-modal__confirm\" @click=\"${() => this.confirm()}\">\n ${this.confirmText}\n </button>\n </slot>\n </span>\n `\n : html``;\n }\n\n get cancelButton() {\n return this.showCancelButton\n ? html`\n <span @click=\"${() => this.close()}\" class=\"btn\">\n <slot name=\"cancel\">\n <button class=\"og-modal__btn og-modal__cancel\" @click=\"${() => this.close()}\">${this.cancelText}</button>\n </slot>\n </span>\n `\n : html``;\n }\n\n render() {\n if (!this.show) return html``;\n\n return html`\n <div class=\"og-modal is-open\" aria-hidden=\"true\">\n <div class=\"og-modal__overlay\" tabindex=\"-1\">\n <div class=\"og-modal__container\" role=\"dialog\" aria-modal=\"true\">\n <header class=\"og-modal__header\">\n <h2 class=\"og-modal__title\">\n <slot name=\"title\">${this.title}</slot>\n </h2>\n <button class=\"og-modal__close\" aria-label=\"Close\" @click=\"${() => this.close()}\"></button>\n </header>\n <main class=\"og-modal__content\">\n <slot name=\"content\">${this.content}</slot>\n </main>\n <footer class=\"og-modal__footer\">${this.confirmButton} ${this.cancelButton}</footer>\n </div>\n </div>\n </div>\n `;\n }\n}\n\nexport default Modal;\n", "/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {AttributePart, directive, Part} from '../lit-html.js';\n\nconst previousValues = new WeakMap<Part, unknown>();\n\n/**\n * For AttributeParts, sets the attribute if the value is defined and removes\n * the attribute if the value is undefined.\n *\n * For other part types, this directive is a no-op.\n */\nexport const ifDefined = directive((value: unknown) => (part: Part) => {\n const previousValue = previousValues.get(part);\n\n if (value === undefined && part instanceof AttributePart) {\n // If the value is undefined, remove the attribute, but only if the value\n // was previously defined.\n if (previousValue !== undefined || !previousValues.has(part)) {\n const name = part.committer.name;\n part.committer.element.removeAttribute(name);\n }\n } else if (value !== previousValue) {\n part.setValue(value);\n }\n\n previousValues.set(part, value);\n});\n", "import { LitElement, css, html } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\n\nexport class Select extends LitElement {\n static get styles() {\n return css`\n :host {\n display: inline-block;\n color: inherit;\n position: relative;\n height: 100%;\n cursor: inherit;\n font-family: inherit;\n font-weight: inherit;\n }\n select {\n font-weight: inherit;\n display: block;\n height: 100%;\n cursor: inherit;\n color: inherit;\n font-family: inherit;\n font-size: 1em;\n line-height: 1.3;\n padding: var(--og-select-padding, 0.4em 1.8em 0.3em 0.5em);\n width: 100%;\n max-width: 100%;\n box-sizing: border-box;\n margin: 0;\n border: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n }\n select::-ms-expand {\n display: none;\n }\n select:focus {\n outline: none;\n }\n select option {\n font-weight: inherit;\n }\n span {\n position: absolute;\n // background: white;\n color: inherit;\n fill: white;\n pointer-events: none;\n right: 0.3em;\n top: 50%;\n z-index: 1;\n font-size: 1em;\n line-height: 0.2em;\n transform: scaleY(0.5);\n }\n `;\n }\n\n static get properties() {\n return {\n options: { type: Array },\n selected: { type: String },\n // we intentionally don't convert from the \"aria-label\" attribute here\n // since if we set that on the element, we are also assigning a label to the wraper <og-select> element which can cause screen readers to read out the same text twice\n // https://github.com/WICG/webcomponents/issues/1073\n ariaLabel: { type: String }\n };\n }\n\n render() {\n const handleOnChange = ev => this.onChange(ev);\n return html`\n <select @change=\"${handleOnChange}\" aria-label=\"${ifDefined(this.ariaLabel)}\">\n ${this.options.map(\n option => html`\n <option\n value=\"${option.value}\"\n ?selected=${option.value === this.selected}\n .selected=${option.value === this.selected}\n >\n ${option.text}\n </option>\n `\n )}\n </select>\n <span>▼</span>\n `;\n }\n}\n\nexport default Select;\n", "import { LitElement, html, css } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\n\nconst ACTIVATION_TYPES = {\n AUTOMATIC: 'automatic',\n MANUAL: 'manual'\n};\n\nexport class Tooltip extends LitElement {\n constructor() {\n super();\n this.triggerLabel = 'Show tooltip';\n this.open = false;\n /** Default is \"automatic\" for backwards compatibility with existing templates */\n this.activationType = ACTIVATION_TYPES.AUTOMATIC;\n }\n\n static get properties() {\n return {\n placement: { type: String, default: 'bottom' },\n /** Set the aria-label attribute of the trigger. */\n triggerLabel: { type: String, attribute: 'trigger-label' },\n /**\n * \"automatic\" - show tooltip on hover and focus\n * \"manual\" - show tooltip on hover and click\n */\n activationType: { type: String, attribute: 'activation-type' },\n /** Whether the tooltip is showing. Internal property; only here so that we re-render when it changes */\n open: { type: Boolean, attribute: false }\n };\n }\n\n static get styles() {\n return css`\n :host[hidden] {\n display: none;\n }\n\n :host {\n display: inline-block;\n position: relative;\n z-index: 9;\n }\n\n /* reset default button styles */\n button.trigger {\n all: unset;\n }\n\n /* do not reset the button's default focus outline */\n button.trigger:focus {\n outline: revert;\n }\n\n .trigger {\n display: block;\n cursor: pointer;\n }\n\n /* for manual activation, hide the content completely from screen readers when the tooltip is closed */\n /* otherwise, interactive elements may receive focus even when they are not visible */\n [data-manual] .content {\n visibility: hidden;\n }\n\n .content {\n box-sizing: border-box;\n font-family: var(--og-tooltip-family, inherit);\n font-size: var(--og-tooltip-size, inherit);\n color: var(--og-tooltip-color, inherit);\n background-color: var(--og-tooltip-background, #ececec);\n box-shadow: var(--og-tooltip-box-shadow, 2px 2px 6px rgba(0, 0, 0, 0.28));\n display: block;\n opacity: 0;\n padding: var(--og-tooltip-padding, 0.5em);\n text-align: var(--og-tooltip-text-align, left);\n pointer-events: none;\n position: absolute;\n transform: translateY(10px);\n transition: transform 0.25s ease-out;\n z-index: 99999;\n border-radius: var(--og-tooltip-border-radius, 0);\n }\n\n .content:after {\n content: ' ';\n height: 0;\n position: absolute;\n width: 0;\n }\n\n .top {\n bottom: 100%;\n margin-bottom: 10px;\n }\n\n .bottom {\n top: 100%;\n margin-top: 10px;\n }\n\n .left {\n right: 100%;\n margin-right: 10px;\n }\n\n .right {\n left: 100%;\n margin-left: 10px;\n }\n\n .top-left {\n bottom: 100%;\n margin-bottom: 10px;\n right: 100%;\n margin-right: -16px;\n }\n\n .top-right {\n bottom: 100%;\n margin-bottom: 10px;\n left: 100%;\n margin-left: -16px;\n }\n\n .bottom-left {\n top: 100%;\n margin-top: 10px;\n right: 100%;\n margin-right: -16px;\n }\n\n .bottom-right {\n top: 100%;\n margin-top: 10px;\n left: 100%;\n margin-left: -16px;\n }\n\n .bottom-left:after,\n .bottom-right:after,\n .top-left:after,\n .top-right:after,\n .top:after,\n .bottom:after {\n margin-left: -10px;\n left: 50%;\n border-left: solid transparent 10px;\n border-right: solid transparent 10px;\n }\n\n .top-left:after,\n .top-right:after,\n .top:after {\n bottom: -10px;\n border-top: solid var(--og-tooltip-background, #ececec) 10px;\n }\n .bottom-left:after,\n .top-left:after {\n left: auto;\n right: 0;\n }\n\n .bottom-right:after,\n .top-right:after {\n left: 0;\n right: auto;\n margin-left: 0;\n }\n\n .bottom-left:after,\n .bottom-right:after,\n .bottom:after {\n top: -10px;\n border-bottom: solid var(--og-tooltip-background, #ececec) 10px;\n }\n\n .left:after,\n .right:after {\n margin-top: -10px;\n top: 50%;\n border-top: solid transparent 10px;\n border-bottom: solid transparent 10px;\n }\n .right:after {\n left: -10px;\n border-right: solid var(--og-tooltip-background, #ececec) 10px;\n }\n .left:after {\n right: -10px;\n border-left: solid var(--og-tooltip-background, #ececec) 10px;\n }\n\n .tooltip[data-open] .content {\n visibility: visible;\n opacity: 1;\n width: 200px;\n pointer-events: auto;\n transform: translateY(0px);\n }\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.abortController = new AbortController();\n const signal = this.abortController.signal;\n\n this.addEventListener('mouseenter', this.handleMouseEnter.bind(this), { signal });\n this.addEventListener('mouseleave', this.handleMouseLeave.bind(this), { signal });\n this.addEventListener('focusin', this.handleFocusIn.bind(this), { signal });\n this.addEventListener('focusout', this.handleFocusOut.bind(this), { signal });\n this.addEventListener('keydown', this.handleKeyDown.bind(this), { signal });\n\n document.addEventListener('click', this.handleDocumentClick.bind(this), { signal });\n }\n\n async recalculatePosition() {\n // wait for state changes to apply\n await this.updateComplete;\n if (!this.open) return;\n const trigger = this.shadowRoot.querySelector('.trigger');\n const triggerRect = trigger.getBoundingClientRect();\n const content = this.shadowRoot.querySelector('.content');\n const contentRect = content.getBoundingClientRect();\n if (!this.placement || this.placement === 'top' || this.placement === 'bottom')\n content.style.left = `${(-1 * contentRect.width + triggerRect.width) / 2}px`;\n else if (this.placement === 'left' || this.placement === 'right')\n content.style.top = `${(-1 * contentRect.height + triggerRect.height) / 2}px`;\n }\n\n handleMouseEnter() {\n this.open = true;\n this.recalculatePosition();\n }\n\n handleMouseLeave() {\n this.open = false;\n }\n\n handleFocusIn() {\n if (this.activationType !== ACTIVATION_TYPES.AUTOMATIC) return;\n this.open = true;\n this.recalculatePosition();\n }\n\n handleFocusOut(event) {\n if (this.activationType !== ACTIVATION_TYPES.AUTOMATIC) return;\n // keep the tooltip open if we're moving focus to another element inside the tooltip\n if (!this.contains(event.relatedTarget)) {\n this.open = false;\n }\n }\n\n handleKeyDown(event) {\n if (this.activationType !== ACTIVATION_TYPES.MANUAL) return;\n // close the tooltip on Escape press\n if (event.key === 'Escape' && this.open) {\n this.open = false;\n event.stopPropagation();\n }\n }\n\n handleClick() {\n if (this.activationType !== ACTIVATION_TYPES.MANUAL) return;\n this.open = !this.open;\n this.recalculatePosition();\n }\n\n handleDocumentClick(event) {\n if (this.activationType !== ACTIVATION_TYPES.MANUAL || !this.open) return;\n // close the tooltip if the user clicks outside of it\n if (!this.contains(event.target)) {\n this.open = false;\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n // remove event listeners\n this.abortController.abort();\n }\n\n render() {\n // allow removing aria-label by setting trigger-label to any falsy value\n // e.g. if the content inside the tooltip is sufficient\n const triggerLabel = this.triggerLabel ? this.triggerLabel : undefined;\n\n return html`\n <span class=\"tooltip\" ?data-open=\"${this.open}\" ?data-manual=\"${this.activationType === ACTIVATION_TYPES.MANUAL}\">\n ${this.activationType === ACTIVATION_TYPES.MANUAL\n ? html`\n <button\n class=\"trigger\"\n aria-label=\"${ifDefined(triggerLabel)}\"\n aria-expanded=\"${this.open}\"\n aria-controls=\"tooltip-content\"\n @click=\"${this.handleClick}\"\n >\n <slot name=\"trigger\">${this.trigger}</slot>\n </button>\n `\n : html`\n <span class=\"trigger\" tabindex=\"0\" role=\"button\" aria-label=\"${ifDefined(triggerLabel)}\">\n <slot name=\"trigger\">${this.trigger}</slot>\n </span>\n `}\n <div class=\"content ${this.placement || 'bottom'}\" role=\"tooltip\" id=\"tooltip-content\">\n <slot name=\"content\">${this.content}</slot>\n </div>\n </span>\n `;\n }\n}\n\nexport default Tooltip;\n", "import { LitElement, html } from 'lit-element';\nimport { connect } from '../core/connect';\nimport {\n makeProductPrepaidShipmentOptionsSelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makePrepaidShipmentsSelectedSelector\n} from '../core/selectors';\nimport { productChangePrepaidShipments } from '../core/actions';\nimport { withProduct } from '../core/resolveProperties';\nimport { getDefaultPrepaidOption } from '../shopify/utils';\n\nexport class PrepaidStatus extends withProduct(LitElement) {\n static get properties() {\n return {\n options: { type: Array },\n shipmentsOptedIn: { type: Number },\n prepaidShipmentsSelected: { type: Number },\n defaultPrepaidShipments: { type: Number, attribute: 'default-prepaid-shipments' }\n };\n }\n\n get prepaidOptedIn() {\n return this.shipmentsOptedIn > 1;\n }\n\n get selectedNumberOfShipments() {\n return this.prepaidShipmentsSelected || this.shipmentsOptedIn || this.getDefaultPrepaidShipments();\n }\n\n getDefaultPrepaidShipments() {\n return this.options.includes(this.defaultPrepaidShipments)\n ? this.defaultPrepaidShipments\n : getDefaultPrepaidOption(this.options);\n }\n\n handleSelect({ target: { value } }) {\n const valueAsNumber = +value;\n this.productChangePrepaidShipments(this.product, valueAsNumber, this.offer);\n }\n\n render() {\n return html``;\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => ({\n options: makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state),\n shipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n prepaidShipmentsSelected: makePrepaidShipmentsSelectedSelector(ownProps.product)(state)\n});\n\nexport const ConnectedPrepaidStatus = connect(mapStateToProps, { productChangePrepaidShipments })(PrepaidStatus);\n\nexport default ConnectedPrepaidStatus;\n", "import { html, css } from 'lit-element';\nimport { connect } from '../core/connect';\nimport {\n makeProductPrepaidShipmentOptionsSelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makePrepaidShipmentsSelectedSelector\n} from '../core/selectors';\nimport { productChangePrepaidShipments } from '../core/actions';\nimport { PrepaidStatus } from './PrepaidStatus';\n\nexport class PrepaidToggle extends PrepaidStatus {\n constructor() {\n super();\n this.options = [];\n this.text = 'shipments';\n }\n\n static get properties() {\n return {\n ...super.properties,\n text: { type: String }\n };\n }\n\n // copied from SelectFrequency\n static get styles() {\n return css`\n og-select {\n display: inline-block;\n cursor: pointer;\n background-color: var(--og-select-bg-color, #fff);\n border: var(--og-select-border, 1px solid #aaa);\n border-width: var(--og-select-border-width, 1px);\n box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);\n z-index: 1;\n }\n\n input {\n width: 1.2em;\n height: 1.2em;\n accent-color: var(--og-prepaid-checkbox-color, black);\n border-radius: 4px;\n }\n `;\n }\n\n handleChange(e) {\n if (e.target.checked) {\n this.productChangePrepaidShipments(this.product, this.selectedNumberOfShipments, this.offer);\n } else {\n this.productChangePrepaidShipments(this.product, null, this.offer);\n }\n }\n\n render() {\n if (this.options.length === 0) {\n return html``;\n }\n\n const displayOptions = this.options.map(value => ({\n value: value,\n text: `${value} ${this.text}`\n }));\n\n return html`\n <div>\n <input id=\"cbx\" type=\"checkbox\" .checked=${this.prepaidOptedIn} @change=${this.handleChange} />\n <label for=\"cbx\">\n <slot name=\"label\">Prepay for</slot>\n ${this.options.length > 1\n ? html`\n <og-select\n .options=${displayOptions}\n .selected=${this.selectedNumberOfShipments}\n .onChange=\"${e => this.handleSelect(e)}\"\n ></og-select>\n `\n : html`\n <span>${displayOptions[0].text}</span>\n `}\n <slot name=\"append\"></slot>\n </label>\n </div>\n `;\n }\n}\n\nconst mapStateToProps = (state, ownProps) => ({\n options: makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state),\n shipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n prepaidShipmentsSelected: makePrepaidShipmentsSelectedSelector(ownProps.product)(state)\n});\n\nconst ConnectedPrepaidToggle = connect(mapStateToProps, { productChangePrepaidShipments })(PrepaidToggle);\n\nexport { ConnectedPrepaidToggle };\n", "import { css, html } from 'lit-element';\nimport { connect } from '../core/connect';\n\nimport {\n makeProductPrepaidShipmentOptionsSelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makePrepaidShipmentsSelectedSelector\n} from '../core/selectors';\nimport { safeProductId } from '../core/utils';\nimport { PrepaidStatus } from './PrepaidStatus';\n\nexport class PrepaidData extends PrepaidStatus {\n static get properties() {\n return {\n ...super.properties,\n productPlans: { type: Object },\n prepaidShipmentsSelected: { type: Number },\n totalPrice: { type: Boolean, reflect: true, attribute: 'total-price' },\n perDeliveryPrice: { type: Boolean, reflect: true, attribute: 'per-delivery-price' },\n totalSavings: { type: Boolean, reflect: true, attribute: 'total-savings' },\n perDeliverySavings: { type: Boolean, reflect: true, attribute: 'per-delivery-savings' },\n percentageSavings: { type: Boolean, reflect: true, attribute: 'percentage-savings' },\n extraPercentageSavings: { type: Boolean, reflect: true, attribute: 'extra-percentage-savings' },\n numberOfShipments: { type: Boolean, reflect: true, attribute: 'number-of-shipments' }\n };\n }\n\n static get styles() {\n return css`\n :host {\n display: inline-block;\n text-indent: initial;\n }\n `;\n }\n\n get value() {\n const realProductId = safeProductId(this.product);\n const plans = this.productPlans[realProductId] || [];\n\n const targetShipments = this.selectedNumberOfShipments;\n let currentPlan = plans.find(plan => plan.prepaidShipments > 1 && plan.prepaidShipments === targetShipments);\n\n if (!currentPlan) {\n currentPlan = plans.find(plan => plan.prepaidShipments > 1);\n if (!currentPlan) return '';\n }\n\n const {\n discountRate,\n subscriptionPrice,\n prepaidShipments,\n regularPrepaidPrice,\n prepaidSavingsPerShipment,\n prepaidSavingsTotal,\n prepaidExtraSavingsPercentage\n } = currentPlan;\n\n if (this.totalPrice) {\n return regularPrepaidPrice;\n }\n\n if (this.perDeliveryPrice) {\n return subscriptionPrice;\n }\n\n if (this.totalSavings) {\n return prepaidSavingsTotal;\n }\n\n if (this.perDeliverySavings) {\n return prepaidSavingsPerShipment;\n }\n\n if (this.percentageSavings) {\n return discountRate;\n }\n\n if (this.extraPercentageSavings) {\n return prepaidExtraSavingsPercentage;\n }\n\n if (this.numberOfShipments) {\n return prepaidShipments;\n }\n\n return '';\n }\n\n render() {\n const value = this.value;\n if (value)\n return html`\n <slot name=\"prepend\"></slot>\n ${value}\n <slot name=\"append\"></slot>\n `;\n\n return html`\n <slot name=\"fallback\"></slot>\n `;\n }\n}\nconst mapStateToProps = (state, ownProps) => ({\n options: makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state),\n shipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n prepaidShipmentsSelected: makePrepaidShipmentsSelectedSelector(ownProps.product)(state),\n productPlans: state.productPlans\n});\n\nconst ConnectedPrepaidData = connect(mapStateToProps)(PrepaidData);\n\nexport { ConnectedPrepaidData };\n", "import { html, css } from 'lit-element';\n\nimport {\n makeProductPrepaidShipmentOptionsSelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makePrepaidShipmentsSelectedSelector\n} from '../core/selectors';\nimport { productChangePrepaidShipments } from '../core/actions';\nimport { connect } from '../core/connect';\nimport { PrepaidStatus } from './PrepaidStatus';\n\nexport class PrepaidButton extends PrepaidStatus {\n constructor() {\n super();\n this.addEventListener('click', this.handleClick.bind(this));\n }\n\n static get styles() {\n return css`\n :host {\n cursor: pointer;\n display: inline-block;\n }\n\n :host[hidden] {\n display: none;\n }\n\n .btn {\n position: relative;\n width: var(--og-radio-width, 1.4em);\n height: var(--og-radio-height, 1.4em);\n margin: var(--og-radio-margin, 0);\n padding: 0;\n border: 1px solid var(--og-primary-color, var(--og-border-color, black));\n background: #fff;\n border-radius: 100%;\n vertical-align: middle;\n color: var(--og-primary-color, var(--og-btn-color, black));\n }\n\n .radio {\n text-indent: -9999px;\n flex-shrink: 0;\n }\n\n .radio {\n border-color: var(--og-checkbox-border-color, black);\n }\n\n .radio.active::after {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n background: var(--og-checkbox-border-color, black);\n }\n\n .radio.active::after {\n content: ' ';\n border-radius: 100%;\n border: 2px solid #fff;\n }\n `;\n }\n\n handleClick(ev) {\n if (!this.prepaidOptedIn) {\n this.productChangePrepaidShipments(this.product, this.selectedNumberOfShipments, this.offer);\n }\n ev.preventDefault();\n }\n\n render() {\n return html`\n <slot name=\"default\">\n <button id=\"action-trigger\" class=\"btn radio ${this.prepaidOptedIn ? 'active' : ''}\"></button>\n <label for=\"action-trigger\">\n <slot name=\"label\"><og-text key=\"prepaidOptInLabel\"></og-text></slot>\n </label>\n </slot>\n `;\n }\n}\n\nconst mapStateToProps = (state, ownProps) => ({\n options: makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state),\n shipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n prepaidShipmentsSelected: makePrepaidShipmentsSelectedSelector(ownProps.product)(state)\n});\n\nexport const ConnectedPrepaidButton = connect(mapStateToProps, { productChangePrepaidShipments })(PrepaidButton);\n\nexport default ConnectedPrepaidButton;\n", "import { html, css } from 'lit-element';\nimport { connect } from '../core/connect';\nimport {\n makeProductPrepaidShipmentOptionsSelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makePrepaidShipmentsSelectedSelector\n} from '../core/selectors';\nimport { productChangePrepaidShipments } from '../core/actions';\nimport { PrepaidStatus } from './PrepaidStatus';\n\nexport class PrepaidSelect extends PrepaidStatus {\n constructor() {\n super();\n this.options = [];\n this.text = 'shipments';\n }\n\n static get properties() {\n return {\n ...super.properties,\n text: { type: String },\n /* The label used for the underlying select. */\n selectLabel: { type: String, attribute: 'select-label' }\n };\n }\n\n static get styles() {\n return css`\n og-select {\n display: inline-block;\n cursor: pointer;\n background-color: var(--og-select-bg-color, #fff);\n border: var(--og-select-border, 1px solid #aaa);\n border-width: var(--og-select-border-width, 1px);\n box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);\n z-index: 1;\n }\n `;\n }\n\n render() {\n if (this.options.length === 0) {\n return html``;\n }\n\n const displayOptions = this.options.map(value => ({\n value: value,\n text: `${value} ${this.text}`\n }));\n\n return html`\n ${this.options.length > 1\n ? html`\n <og-select\n .options=${displayOptions}\n .selected=${this.selectedNumberOfShipments}\n .onChange=\"${e => this.handleSelect(e)}\"\n .ariaLabel=\"${this.selectLabel}\"\n ></og-select>\n `\n : html`\n <span>${displayOptions[0].text}</span>\n `}\n <slot name=\"append\"></slot>\n `;\n }\n}\n\nconst mapStateToProps = (state, ownProps) => ({\n options: makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state),\n shipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n prepaidShipmentsSelected: makePrepaidShipmentsSelectedSelector(ownProps.product)(state)\n});\n\nconst ConnectedPrepaidSelect = connect(mapStateToProps, { productChangePrepaidShipments })(PrepaidSelect);\n\nexport { ConnectedPrepaidSelect };\n", "import { html } from 'lit-element';\nimport { optinProduct } from '../core/actions';\nimport { OptinButton } from './OptinButton';\nimport { mapStateToProps } from './OptinStatus';\nimport { connect } from '../core/connect';\nimport { resolveProduct } from '../core/resolveProperties';\n\nexport class SubscriptionButton extends OptinButton {\n /*\n * The main difference from this SubscriptionButton from the OptinButton is that\n * this button is disabled when the prepaid shipments are enabled.\n *\n * It has prepaid information so it can work together with the PrepaidButton.\n */\n\n static get properties() {\n return {\n ...super.properties,\n prepaidShipmentsOptedIn: { type: Number }\n };\n }\n\n get isActive() {\n if (this.prepaidShipmentsOptedIn > 0) {\n return false;\n }\n return this.subscribed;\n }\n\n handleClick(ev) {\n if (!this.isActive) {\n /*\n By using the `frequencies` we won't need to use the `defaultFrequency` property from the offer element.\n This is because the `frequencies` property will always evaluate to pay as you go frequencies, where the defaultFrequency\n could be a prepaid frequency if there are positive prepaidShipmentsOptedIn.\n */\n const payAsYouGoFrequency =\n this.frequencies && this.frequencies.length > 0 ? this.frequencies[0] : this.optinFrequency;\n this.optinProduct(resolveProduct(this), payAsYouGoFrequency, this.offer);\n }\n ev.preventDefault();\n }\n\n render() {\n return html`\n <slot name=\"default\">\n <button id=\"action-trigger\" class=\"btn radio ${this.isActive ? ' active' : ''}\"></button>\n <label for=\"action-trigger\">\n <slot>\n <slot name=\"label\"><og-text key=\"offerOptInLabel\"></og-text></slot>\n </slot>\n </label>\n </slot>\n `;\n }\n}\n\nexport const ConnectedSubscriptionButton = connect(mapStateToProps, { optinProduct })(SubscriptionButton);\n\nexport default ConnectedSubscriptionButton;\n", "import { LitElement, html, css } from 'lit-element';\n\nimport * as actions from '../core/actions';\n\nexport class TestWizard extends LitElement {\n static get styles() {\n return css`\n :host {\n position: fixed;\n top: 5em;\n righit: 5em;\n background-color: rgba(255, 255, 255, 0.7);\n width: 400px;\n padding: 1em;\n border-radius: 5px;\n border: 1px solid #ccc;\n box-shadow: 2px 2px 0 0 #000;\n }\n\n button {\n margin: 0 0.5em 0.5em;\n background-color: gray;\n color: white;\n border: 0;\n border-radius: 3px;\n cursor: pointer;\n padding: 0.5em;\n }\n\n button.primary {\n background-color: blue;\n padding: 1em;\n color: white;\n border: 0;\n border-radius: 3px;\n }\n\n button[disabled] {\n background-color: #777;\n }\n\n div {\n margin-bottom: 0.5em;\n }\n\n .message {\n margin-left: 0.5em;\n margin: 1em;\n }\n\n .success {\n color: green;\n }\n\n .error {\n color: red;\n }\n\n .warning {\n color: orange;\n }\n a {\n color: white;\n }\n `;\n }\n\n runTests() {\n this.results = [];\n this.disabled = true;\n this.requestUpdate();\n\n const offerElements = document.querySelectorAll('og-offer');\n offerElements.forEach(element => {\n const state = element.store.getState();\n const productAttribute = element.getAttribute('product');\n const locationAttribute = element.getAttribute('location');\n const result = {\n messages: this.getOfferAttributeMessages(productAttribute, locationAttribute).concat(\n this.getOfferRequestMessages(productAttribute, state)\n ),\n product: productAttribute\n };\n this.results.push(result);\n });\n this.testsRan = true;\n this.disabled = false;\n this.requestUpdate();\n }\n\n getOfferAttributeMessages(productAttribute, locationAttribute) {\n const messages = [];\n\n if (!productAttribute) {\n messages.push({\n name: 'Offer element found but missing product attribute',\n type: 'error'\n });\n }\n\n if (!locationAttribute) {\n messages.push({\n name: 'Offer element found but missing location attribute',\n type: 'warning'\n });\n }\n\n if (productAttribute && locationAttribute) {\n messages.push({\n name: 'Offer element found and properly tagged',\n type: 'success'\n });\n }\n\n return messages;\n }\n\n getOfferRequestMessages(productAttribute, state) {\n const inStock = state.inStock[productAttribute];\n const autoshipEligible = state.autoshipEligible[productAttribute];\n const messages = [];\n\n if (productAttribute && inStock === false) {\n messages.push({\n name: 'This product is marked as out of stock in the OG database',\n type: 'warning'\n });\n }\n\n if (productAttribute && autoshipEligible === false) {\n messages.push({\n name: 'This product is not eligible for autoship',\n type: 'warning'\n });\n }\n\n if (productAttribute && inStock === null && autoshipEligible === null) {\n messages.push({\n name: 'This product does not exist in our database',\n type: 'error'\n });\n }\n\n return messages;\n }\n\n resultsCodeBlock() {\n return this.results.length === 0\n ? html`\n <div class=\"message error\">No offer element found on the page</div>\n `\n : this.results.map(\n (result, ix) => html`\n <div>For offer tag with product = \"${result.product}\"</div>\n ${result.messages.map(\n message => html`\n <div class=\"message ${message.type}\">${message.name}</div>\n `\n )}\n <button @click=${this.toggleProductFlags(ix, {})}>Set inStock and eligible</button>\n <br />\n <button @click=${this.toggleProductFlags(ix, { inStock: false })}>Set to not inStock</button>\n <br />\n <button @click=${this.toggleProductFlags(ix, { autoship: false })}>Set to not eligible</button>\n <br />\n <button @click=${this.toggleProductFlags(ix, { autoship: false, inStock: false })}>\n Set to not eligible and not in stock\n </button>\n <br />\n <button @click=${this.toggleUpsellPreview(ix)}>Toggle upsell/regular in this offer</button>\n <br />\n <button @click=${this.toggleUpsellNextOrder(ix)}>upsell product is in next order</button>\n <br />\n `\n );\n }\n\n toggleUpsellPreview(ix) {\n return ev => {\n ev.preventDefault();\n const offer = document.querySelectorAll('og-offer')[ix];\n if (!offer.getAttribute('preview-upsell-offer')) {\n offer.setAttribute('preview-upsell-offer', true);\n } else {\n offer.removeAttribute('preview-upsell-offer');\n }\n this.runTests();\n };\n }\n\n toggleProductFlags(ix, { inStock = true, autoship = true, groups = ['subscription', 'upsell'] }) {\n return ev => {\n ev.preventDefault();\n const offer = document.querySelectorAll('og-offer')[ix];\n const productId = offer.product.id;\n offer.store.dispatch(\n actions.receiveOffer(\n {\n in_stock: { [productId]: inStock },\n eligibility_groups: { [productId]: groups },\n result: 'success',\n autoship: { [productId]: autoship },\n module_view: { regular: '58a01e9aacbe40389b5c7325d79091bb' },\n modifiers: {},\n incentives_display: {\n '47c01e9aacbe40389b5c7325d79091aa': {\n field: 'sub_total',\n object: 'order',\n type: 'Discount Percent',\n value: 5\n },\n e6534b9d877f41e586c37b7d8abc3a58: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 5\n },\n f35e842710b24929922db4a529eecd40: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n '5be321d7c17f4e18a757212b9a20bfcc': {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 1\n }\n },\n incentives: {\n [productId]: {\n initial: ['5be321d7c17f4e18a757212b9a20bfcc'],\n ongoing: [\n 'e6534b9d877f41e586c37b7d8abc3a58',\n '47c01e9aacbe40389b5c7325d79091aa',\n 'f35e842710b24929922db4a529eecd40'\n ]\n }\n }\n },\n {},\n productId\n )\n );\n this.runTests();\n };\n }\n\n toggleUpsellNextOrder(ix) {\n return ev => {\n const offer = document.querySelectorAll('og-offer')[ix];\n const productId = offer.product.id;\n\n ev.preventDefault();\n offer.store.dispatch(\n actions.receiveItems({\n count: 1,\n next: null,\n previous: null,\n results: [\n {\n order: '24d50352579511ea806cbc764e100cfd',\n offer: null,\n subscription: '8a076b7a0ea011e7a5bcbc764e105eda',\n product: productId,\n components: [],\n quantity: 1,\n public_id: '24d6901e579511ea806cbc764e100cfd',\n product_attribute: null,\n price: '14.99',\n extra_cost: '0.00',\n total_price: '13.49',\n one_time: false,\n frozen: false,\n first_placed: null\n }\n ]\n })\n );\n this.runTests();\n };\n }\n\n render() {\n return html`\n <div>\n ${this.testsRan\n ? this.resultsCodeBlock()\n : html`\n <div>Click the button to run tests</div>\n `}\n <button ?disabled=${this.disabled} @click=\"${this.runTests.bind(this)}\" class=\"primary\">Run Test</button>\n </div>\n `;\n }\n}\n\nexport default TestWizard;\n", "import { TestWizard } from './components/TestWizard';\n\nexport default function () {\n const name = 'og-test-wizard';\n if (!customElements.get(name)) {\n customElements.define(name, TestWizard);\n }\n const modal = document.createElement(name);\n document.body.appendChild(modal);\n}\n", "import runTests from './run-tests';\n\nexport const keys = [\n 79, // O\n 71, // G\n 68, // D\n 69, // E\n 86 // V\n];\n\nexport const enable = () => {\n if (window.OG_OFFERS_TEST_MODE_ENABLE) return;\n window.OG_OFFERS_TEST_MODE_ENABLE = true;\n let keysCounter = 0;\n document.addEventListener(\n 'keyup',\n async function (e) {\n const key = e.which;\n if (key === keys[keysCounter]) {\n const currentkeys = keys[keysCounter];\n setTimeout(function () {\n if (keysCounter <= currentkeys) keysCounter = 0;\n }, 5000);\n keysCounter += 1;\n if (keysCounter >= keys.length) {\n runTests();\n }\n } else {\n keysCounter = 0;\n }\n },\n false\n );\n};\n\nexport default enable;\n", "import { html, css } from 'lit-element';\nimport { connect } from '../core/connect';\n\nimport { withProduct } from '../core/resolveProperties';\nimport { TemplateElement } from '../core/base';\nimport {\n makeDiscountedProductPriceSelector,\n makeProductDefaultFrequencySelector,\n makeProductFrequencyOptedInSelector\n} from '../core/selectors';\nimport { safeProductId } from '../core/utils';\n\nexport class Price extends withProduct(TemplateElement) {\n static get properties() {\n return {\n ...super.properties,\n regular: { type: Boolean, reflect: true },\n subscription: { type: Boolean, reflect: true },\n discount: { type: Boolean, reflect: true },\n /** Force displaying the pay-as-you-go price. This is relevant when there is a prepaid plan that the user has opted into, and you still want to display the pay-as-you-go price for comparison */\n payAsYouGo: { type: Boolean, reflect: true, attribute: 'pay-as-you-go' },\n frequency: { type: Object },\n /** If Shopify, this is derived from the selling plans attached to the product */\n productPlans: { type: Object },\n /** The discounted price, as calculated from the Offers API response */\n discountedProductPriceFromOffers: { type: Object }\n };\n }\n\n static get styles() {\n return css`\n :host::before {\n clip-path: inset(100%);\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n }\n\n :host([subscription])::before {\n content: 'Discounted subscription price';\n }\n\n :host([regular])::before {\n content: 'Regular price';\n }\n `;\n }\n\n get value() {\n const realProductId = safeProductId(this.product);\n const frequency = this.frequency || this.configDefaultFrequency || this.offer?.defaultFrequency;\n const plans = this.productPlans[realProductId] || [];\n\n let currentPlan = this.payAsYouGo\n ? plans.find(plan => plan.prepaidShipments === null || plan.prepaidShipments === undefined)\n : plans.find(plan => plan.frequency === frequency);\n\n if (!currentPlan) return '';\n\n // default to pulling from the selling plan\n let { regularPrice, discountRate, subscriptionPrice } = currentPlan;\n // if the selling plan has no price adjustments, then use the offer response to determine the discounted price\n // this will be true for merchants on standardized offer profiles\n // we still rely on the selling plan for prepaid subscriptions, for simplicity\n if (\n // overrideSellingPlanPrice is a dev flag to force using the offer price for testing purposes\n (currentPlan.hasPriceAdjustments === false || this.offer?.overrideSellingPlanPrice) &&\n !currentPlan.prepaidShipments\n ) {\n ({ regularPrice, discountRate, subscriptionPrice } = this.discountedProductPriceFromOffers);\n }\n\n // if payAsYouGo, always show the price even if no discount\n // it's unclear if this was the original intention, but preserving existing behavior\n if (subscriptionPrice === regularPrice && !this.payAsYouGo) return '';\n\n if (this.regular) {\n return regularPrice;\n }\n if (this.discount) return discountRate;\n return subscriptionPrice;\n }\n\n render() {\n const value = this.value;\n if (value)\n return html`\n <slot name=\"prepend\"></slot>\n ${value}\n <slot name=\"append\"></slot>\n `;\n\n return html`\n <slot name=\"fallback\"></slot>\n `;\n }\n}\nconst mapStateToProps = (state, ownProps) => ({\n productPlans: state.productPlans,\n configDefaultFrequency: makeProductDefaultFrequencySelector(ownProps.product?.id)(state),\n frequency: makeProductFrequencyOptedInSelector(ownProps.product)(state),\n discountedProductPriceFromOffers: makeDiscountedProductPriceSelector(ownProps.product?.id)(state)\n});\n\nexport default connect(mapStateToProps)(Price);\n", "import { offersLiveEditor } from '@ordergroove/offers-live-editor';\nimport { setStore } from './core/connect';\nimport * as adapters from './core/adapters';\nimport * as actions from './core/actions';\nimport { ConnectedWhen } from './components/When';\nimport { ConnectedOptinButton } from './components/OptinButton';\nimport { ConnectedOptoutButton } from './components/OptoutButton';\nimport { ConnectedOptinSelect } from './components/OptinSelect';\nimport { ConnectedUpsellButton } from './components/UpsellButton';\nimport { ConnectedUpsellModal } from './components/UpsellModal';\nimport { ConnectedOptinToggle } from './components/OptinToggle';\nimport { ConnectedOptinStatus } from './components/OptinStatus';\nimport { ConnectedText } from './components/Text';\nimport { ConnectedIncentiveText } from './components/IncentiveText';\nimport { ConnectedBenefitMessages } from './components/BenefitMessages';\nimport { ConnectedSelectFrequency } from './components/SelectFrequency';\nimport { ConnectedNextUpcomingOrder } from './components/NextUpcomingOrder';\nimport { ConnectedOffer } from './components/Offer';\nimport { Modal } from './components/Modal';\nimport { Select } from './components/Select';\nimport { Tooltip } from './components/Tooltip';\nimport { ConnectedFrequencyStatus } from './components/FrequencyStatus';\nimport { ConnectedPrepaidToggle } from './components/PrepaidToggle';\nimport { ConnectedPrepaidData } from './components/PrepaidData';\nimport { ConnectedPrepaidButton } from './components/PrepaidButton';\nimport { ConnectedPrepaidSelect } from './components/PrepaidSelect';\nimport { ConnectedSubscriptionButton } from './components/SubscriptionButton';\nimport * as testMode from './test-mode';\nimport { RECEIVE_PRODUCT_PLANS } from './core/constants';\nimport ConnectedPrice from './components/Price';\nimport platform from './platform';\n\nexport default function makeApi(store) {\n testMode.enable();\n\n setStore(store);\n\n try {\n customElements.define('og-when', ConnectedWhen);\n customElements.define('og-text', ConnectedText);\n customElements.define('og-incentive-text', ConnectedIncentiveText);\n customElements.define('og-benefit-messages', ConnectedBenefitMessages);\n customElements.define('og-offer', ConnectedOffer);\n customElements.define('og-select-frequency', ConnectedSelectFrequency);\n customElements.define('og-optout-button', ConnectedOptoutButton);\n customElements.define('og-optin-toggle', ConnectedOptinToggle);\n customElements.define('og-optin-status', ConnectedOptinStatus);\n customElements.define('og-optin-button', ConnectedOptinButton);\n customElements.define('og-optin-select', ConnectedOptinSelect);\n customElements.define('og-upsell-button', ConnectedUpsellButton);\n customElements.define('og-frequency-status', ConnectedFrequencyStatus);\n customElements.define('og-modal', Modal);\n customElements.define('og-select', Select);\n customElements.define('og-tooltip', Tooltip);\n customElements.define('og-upsell-modal', ConnectedUpsellModal);\n customElements.define('og-next-upcoming-order', ConnectedNextUpcomingOrder);\n customElements.define('og-price', ConnectedPrice);\n customElements.define('og-prepaid-toggle', ConnectedPrepaidToggle);\n customElements.define('og-prepaid-data', ConnectedPrepaidData);\n customElements.define('og-prepaid-button', ConnectedPrepaidButton);\n customElements.define('og-prepaid-select', ConnectedPrepaidSelect);\n customElements.define('og-subscription-button', ConnectedSubscriptionButton);\n } catch (err) {\n console.info('OG WebComponents already registered, skipping.');\n }\n\n // // use this syntax to allow es6 module be called as default function og.offers(...)\n // module.exports = offers.initialize;\n let isReady = false;\n const offers = {\n store,\n isReady: () => isReady,\n setEnvironment(e) {\n store.dispatch(actions.setEnvironment(e));\n return this;\n },\n setMerchantId(m) {\n store.dispatch(actions.setMerchantId(m));\n return this;\n },\n setAuthUrl(authUrl) {\n store.dispatch(actions.setAuthUrl(authUrl));\n return this;\n },\n receiveMerchantSettings(settings) {\n store.dispatch(actions.receiveMerchantSettings(settings));\n return this;\n },\n getProductsForPurchasePost(productIds = []) {\n return adapters.getProductsForPurchasePost(store.getState(), productIds);\n },\n getOptins(productIds = []) {\n return adapters.getProductsForPurchasePost(store.getState(), productIds);\n },\n clear() {\n store.dispatch(actions.checkout());\n },\n addOptinChangedCallback(fn) {\n if (typeof fn === 'function') document.addEventListener('optin-changed', e => fn(e.detail));\n },\n disableOptinChangedCallbacks() {\n document.addEventListener('optin-changed', e => e.stopPropagation(), true);\n },\n\n register() {\n /* noop */\n },\n previewMode(set) {\n window.og = window.og || {};\n if (set === false) {\n delete window.og;\n } else {\n window.og.previewMode = true;\n console.log('OG Offers preview mode enabled');\n }\n return this;\n },\n config(configuration) {\n store.dispatch(actions.setConfig(configuration));\n return this;\n },\n setLocale(locale) {\n store.dispatch(actions.setLocale(locale));\n return this;\n },\n /**\n * Set benefit messages keyed by incentive public id. Each value is a\n * locale map (IETF tag \u2192 message text) for the incentive; the consumer\n * picks the appropriate locale at render time. Replaces the entire map.\n * @param {{ [incentivePublicId: string]: { [locale: string]: string } }} messages\n */\n setBenefitMessages(messages) {\n store.dispatch(actions.setBenefitMessages(messages));\n return this;\n },\n addTemplate(tagName, content, configOption) {\n store.dispatch(actions.addTemplate(tagName, content, configOption));\n return this;\n },\n /**\n * templates object where keys are selectors and values are content\n */\n setTemplates(templates) {\n store.dispatch(actions.setTemplates(templates));\n return this;\n },\n\n setPublicPath(_publicPath) {\n return this;\n },\n\n resolveSettings(merchantId, env, settings, storeInstance = store) {\n // window.og_settings does not affect Shopify selling plan offers\n if (platform.shopify_selling_plans) return;\n\n if (merchantId && env && settings) {\n let products = [];\n if (settings.product) {\n products.push(settings.product);\n } else if (settings.cart && Array.isArray(settings.cart.products)) {\n products = products.concat(settings.cart.products);\n }\n\n const state = storeInstance.getState();\n const { sessionId } = state;\n if (sessionId) {\n products.forEach(product => storeInstance.dispatch(actions.requestOffer(product)));\n }\n\n if (settings.product_discounts && typeof settings.product_discounts === 'object') {\n storeInstance.dispatch({ type: RECEIVE_PRODUCT_PLANS, payload: settings.product_discounts });\n }\n }\n },\n\n /**\n * Initialize OG object\n * @param {*} merchantId\n * @param {*} env\n * @param {*} authUrl\n * @param {import('./core/types/api').MerchantSettings} merchantSettings\n */\n initialize(merchantId, env, authUrl, merchantSettings = {}) {\n // settings resolves once, before anything.\n if (isReady) {\n console.warn('og.offers has been initialized already. Skipping.');\n }\n\n const state = store.getState();\n // dont re-trigger actions if value is the same. allowing set new authurl only\n if (merchantId && merchantId !== state.merchantId) offers.setMerchantId(merchantId);\n if (env && env !== state.environment?.name) offers.setEnvironment(env);\n // always set merchant settings\n offers.receiveMerchantSettings(merchantSettings);\n\n // allow set new authUrl\n if (authUrl) offers.setAuthUrl(authUrl);\n\n // ensure to dispatch settings actions before any other action\n if (!isReady) {\n offers.resolveSettings(merchantId, env, window.og_settings, store);\n }\n\n isReady = true;\n\n return this;\n }\n };\n\n window.OG = window.OG || {};\n Object.assign(window.OG, offers);\n Object.assign(offers.initialize, offers);\n\n offersLiveEditor(window.opener, offers);\n\n return offers;\n}\n", "import { combineReducers } from 'redux';\nimport * as constants from './constants';\nimport { isSameProduct } from './selectors';\nimport { stringifyFrequency } from './api';\nimport { getObjectStructuredProductPlans } from './adapters';\nimport { safeProductId, getMatchingProductIfExists } from './utils';\nimport { experimentsReducer } from './experiments';\n\nimport {\n AuthState,\n EnvironmentState,\n AutoshipByDefaultState,\n AutoshipEligibleState,\n BenefitMessagesState,\n ConfigState,\n Incentive,\n IncentiveObject,\n IncentivesState,\n NextUpcomingOrderState,\n OptedInState,\n OptedOutState,\n PrepaidShipmentsSelectedState,\n PriceState,\n ProductPlansState,\n ReceiveOfferPayload\n} from './types/reducer';\nimport { EmptyObject } from './types/utility';\nimport { IncentiveDisplay, IncentivesDisplayEnhanced } from './types/api';\n\nexport const optedin = (state: OptedInState = [], action): OptedInState => {\n switch (action.type) {\n case constants.LOCAL_STORAGE_CLEAR:\n return [];\n case constants.LOCAL_STORAGE_CHANGE:\n return action.newValue ? action.newValue.optedin : state;\n case constants.OPTIN_PRODUCT:\n case constants.PRODUCT_CHANGE_FREQUENCY: {\n // since prepaid maps to a different set of frequencies, we remove prepaidShipments when frequency is changed\n const [{ prepaidShipments, ...oldone }, rest] = getMatchingProductIfExists(state, action.payload.product);\n return rest.concat({\n ...oldone,\n ...action.payload.product,\n frequency: action.payload.frequency\n });\n }\n case constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS: {\n const { payload } = action;\n const [{ prepaidShipments, ...oldone }, rest] = getMatchingProductIfExists(state, payload.product);\n const newState = {\n ...oldone,\n ...payload.product\n };\n if (payload.prepaidShipments) {\n newState.prepaidShipments = payload.prepaidShipments;\n }\n return rest.concat(newState);\n }\n case constants.OPTOUT_PRODUCT:\n return state.filter(a => !isSameProduct(action.payload.product, a));\n case constants.PRODUCT_HAS_CHANGED:\n return state.map(product =>\n isSameProduct(action.payload.product, product) ? { ...product, ...action.payload.newProduct } : product\n );\n case constants.CONVERT_ONE_TIME:\n return state.filter(a => !isSameProduct(action.payload.product, a));\n case constants.CHECKOUT:\n return [];\n default:\n return state;\n }\n};\n\nexport const optedout = (state: OptedOutState = [], action): OptedOutState => {\n switch (action.type) {\n case constants.LOCAL_STORAGE_CLEAR:\n return [];\n case constants.LOCAL_STORAGE_CHANGE:\n return action.newValue ? action.newValue.optedout : state;\n case constants.OPTIN_PRODUCT:\n case constants.PRODUCT_CHANGE_FREQUENCY:\n return state.filter(a => !isSameProduct(action.payload.product, a));\n case constants.OPTOUT_PRODUCT: {\n const [oldone, rest] = getMatchingProductIfExists(state, action.payload.product);\n return rest.concat({\n ...oldone,\n ...action.payload.product,\n frequency: action.payload.frequency\n });\n }\n case constants.PRODUCT_HAS_CHANGED:\n return state.map(product =>\n isSameProduct(action.payload.product, product) ? { ...product, ...action.payload.newProduct } : product\n );\n case constants.CHECKOUT:\n return [];\n default:\n return state;\n }\n};\n\nexport const nextUpcomingOrder = (state: NextUpcomingOrderState = {}, { type, payload }): NextUpcomingOrderState => {\n switch (type) {\n case constants.RECEIVE_ORDERS:\n return payload && payload.count > 0\n ? {\n ...state,\n ...(payload.results[0] && {\n ...payload.results[0],\n place: new Date(Date.parse(payload.results[0].place.replace(/-/gi, '/')))\n })\n }\n : state;\n case constants.RECEIVE_ORDER_ITEMS:\n return {\n ...state,\n products: (payload.results || []).map(it => it.product)\n };\n case constants.CREATE_ONE_TIME:\n // when CREATE_IU_ORDER payload is just order item object created\n return {\n ...state,\n ...payload,\n public_id: payload.order,\n ...(payload.product && { products: (state.products || []).concat(payload.product) })\n };\n default:\n return state;\n }\n};\n\nexport const autoshipEligible = (state: AutoshipEligibleState = {}, action): AutoshipEligibleState => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...action.payload.autoship\n };\n default:\n return state;\n }\n};\n\nexport const inStock = (state = {}, action) => {\n switch (action.type) {\n // force offer to refresh when requesting a new one\n case constants.REQUEST_OFFER:\n return { ...state };\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...action.payload.in_stock\n };\n default:\n return state;\n }\n};\n\nexport const eligibilityGroups = (state = {}, action) => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...action.payload.eligibility_groups\n };\n default:\n return state;\n }\n};\n\nconst mapIncentive = (\n incentive: string[],\n incentiveDisplay: IncentiveDisplay,\n incentiveDisplayEnhanced?: IncentivesDisplayEnhanced\n): Incentive[] => {\n return incentive.map(i => {\n const enhanced = incentiveDisplayEnhanced?.[i];\n return {\n ...incentiveDisplay[i],\n // for standard incentives, include the criteria so we know which kind of incentive (e.g. PSI, prepaid, etc)\n ...(enhanced\n ? {\n enhanced: true,\n criteria: enhanced.criteria\n ? enhanced.criteria\n : // when there is no criteria in the enhanced incentive, it means it's a program wide incentive\n // for ease-of-use, we set use a \"PROGRAM_WIDE\" pseudo-standard here\n {\n node_type: 'PREMISE',\n standard: constants.INCENTIVE_STANDARD_TYPES.PROGRAM_WIDE,\n premise_value: null\n },\n threshold_field: enhanced.threshold_field,\n threshold_value: enhanced.threshold_value\n }\n : {}),\n id: [i][0]\n };\n });\n};\n\nexport const incentives = (\n state: IncentivesState = {},\n action: { type: string; payload: ReceiveOfferPayload }\n): IncentivesState => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...[...new Set(Object.keys(action.payload.incentives || {}))].reduce(\n (obj, uniqueProductId) => ({\n ...obj,\n [uniqueProductId]: Object.entries(action.payload.incentives)\n .filter(([productId]) => productId === uniqueProductId)\n .reduce(\n (incentiveObj: IncentiveObject | EmptyObject, [, { initial, ongoing }]) => ({\n ...incentiveObj,\n initial: [\n ...(incentiveObj.initial || []),\n ...mapIncentive(\n initial,\n action.payload.incentives_display,\n action.payload.incentives_display_enhanced\n )\n ],\n ongoing: [\n ...(incentiveObj.ongoing || []),\n ...mapIncentive(\n ongoing,\n action.payload.incentives_display,\n action.payload.incentives_display_enhanced\n )\n ]\n }),\n {}\n )\n }),\n {}\n )\n };\n default:\n return state;\n }\n};\n\nexport const frequency = (state = {}, action) => {\n switch (action.type) {\n case constants.OPTIN_PRODUCT:\n case constants.PRODUCT_CHANGE_FREQUENCY:\n return {\n ...state,\n [safeProductId(action.payload.product)]: action.payload.frequency\n };\n case constants.OPTOUT_PRODUCT:\n return { ...state, [safeProductId(action.payload.product)]: undefined };\n default:\n return state;\n }\n};\n\nexport const auth = (state: AuthState = false, action): AuthState => {\n switch (action.type) {\n case constants.AUTHORIZE:\n return {\n ...action.payload\n };\n case constants.UNAUTHORIZED:\n return false;\n default:\n return state;\n }\n};\n\nexport const merchantId = (state = '', action) => {\n switch (action.type) {\n case constants.SET_MERCHANT_ID:\n return action.payload;\n default:\n return state;\n }\n};\n\nexport const authUrl = (state = null, action) => {\n switch (action.type) {\n case constants.SET_AUTH_URL:\n return action.payload;\n default:\n return state;\n }\n};\n\nexport const offer = (state = {}, action) => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n offerId: (action.payload.module_view || {}).regular,\n ...action.payload.modifiers\n };\n default:\n return state;\n }\n};\n\nexport const offerId = (state = '', action) => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return (action.payload.module_view || {}).regular || '';\n default:\n return state;\n }\n};\nexport const sessionId = (state = null, action) => {\n switch (action.type) {\n case constants.LOCAL_STORAGE_CLEAR:\n return null;\n case constants.CREATED_SESSION_ID:\n return action.payload;\n default:\n return state;\n }\n};\n\nexport const productOffer = (state = {}, action) => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...Object.entries(action.payload.autoship)\n .map(([key]) => ({ [key]: Object.keys(action.payload.modifiers) }))\n .reduce((acc, object) => ({ ...acc, ...object }), {})\n };\n case constants.CHECKOUT:\n return {};\n default:\n return state;\n }\n};\n\nexport const firstOrderPlaceDate = (state = {}, action) => {\n switch (action.type) {\n case constants.SET_FIRST_ORDER_PLACE_DATE:\n return {\n ...state,\n [safeProductId(action.payload.product)]: action.payload.firstOrderPlaceDate\n };\n default:\n return state;\n }\n};\n\nexport const productToSubscribe = (state = {}, action) => {\n switch (action.type) {\n case constants.SET_PRODUCT_TO_SUBSCRIBE:\n return {\n ...state,\n [safeProductId(action.payload.product)]: action.payload.productToSubscribe\n };\n default:\n return state;\n }\n};\n\nexport const environment = (state: EnvironmentState = {}, action): EnvironmentState => {\n switch (action.type) {\n case constants.SET_ENVIRONMENT_LOCAL:\n return {\n ...state,\n name: 'local',\n apiUrl: 'http://py3web.ordergroove.localhost',\n legoUrl: 'http://py3lego.ordergroove.localhost'\n };\n case constants.SET_ENVIRONMENT_STAGING:\n return {\n ...state,\n name: constants.ENV_STAGING,\n apiUrl: 'https://staging.offers.ordergroove.com',\n // scUrl: 'https://staging.sc.ordergroove.com',\n // widgetsUrl: 'https://staging.static.ordergroove.com',\n // masterDbUrl: 'https://staging.v2.ordergroove.com',\n // reorderUrl: 'https://staging.static.ordergroove.com/reorder/',\n legoUrl: 'https://staging.restapi.ordergroove.com'\n };\n case constants.SET_ENVIRONMENT_DEV:\n return {\n ...state,\n name: constants.ENV_DEV,\n apiUrl: 'https://dev.offers.ordergroove.com',\n // scUrl: 'https://dev.sc.ordergroove.com',\n // widgetsUrl: 'https://dev.static.ordergroove.com',\n // masterDbUrl: 'https://dev.api.ordergroove.com',\n // reorderUrl: 'https://staging.static.ordergroove.com/reorder/',\n legoUrl: 'https://dev.restapi.ordergroove.com'\n };\n case constants.SET_ENVIRONMENT_PROD:\n return {\n ...state,\n name: constants.ENV_PROD,\n apiUrl: 'https://offers.ordergroove.com',\n // scUrl: 'https://sc.ordergroove.com',\n // widgetsUrl: 'https://static.ordergroove.com',\n // masterDbUrl: 'https://api.ordergroove.com',\n // reorderUrl: 'https://static.ordergroove.com/reorder/',\n legoUrl: 'https://restapi.ordergroove.com'\n };\n default:\n return state;\n }\n};\n\nexport const locale = (\n state = {\n offerOptInLabel: 'Subscribe to save',\n offerIncentiveText: 'Save {{ogIncentive DiscountPercent}} when you subscribe',\n offerOptOutLabel: 'Deliver one-time only',\n offerEveryLabel: 'Delivery Every',\n offerTooltipTrigger: '[?]',\n offerTooltipContent: 'Seems this is a great subscription offering. Many fun details about this program exist.',\n optinButtonLabel: '\u2022',\n optoutButtonLabel: '\u2022',\n optinStatusOptedInLabel: \"You're opted in!\",\n optinStatusOptedOutLabel: \"You're not opted in.\",\n optinToggleLabel: '\u2022',\n upsellButtonLabel: 'Add item to order on ',\n upsellButtonPrefix: '',\n upsellModalContent: 'Some upsell modal content',\n upsellModalOptInLabel: 'Subscribe',\n upsellModalOptOutLabel: 'Purchase one time',\n upsellModalTitle: 'Impulse Upsell',\n upsellModalConfirmLabel: 'Ok',\n upsellModalCancelLabel: 'Cancel',\n defaultFrequencyCopy: '(Most Popular)',\n frequencyPeriods: {\n 1: 'day',\n 2: 'week',\n 3: 'month'\n },\n prepaidOptInLabel: 'Prepaid Subscription',\n prepaidShipmentsLabel: 'Number of prepaid shipments'\n },\n action\n) => {\n switch (action.type) {\n case constants.SET_LOCALE:\n return { ...state, ...action.payload };\n default:\n return state;\n }\n};\n\nexport const config = (\n state: ConfigState = {\n offerType: 'radio'\n },\n action\n): ConfigState => {\n switch (action.type) {\n case constants.SET_CONFIG:\n return {\n ...state,\n ...action.payload,\n // these are not populated by default; only if the merchant calls the config method on the Offers API\n defaultFrequency: action.payload.defaultFrequency\n ? stringifyFrequency(action.payload.defaultFrequency)\n : state.defaultFrequency,\n frequenciesEveryPeriod: [],\n frequencies: action.payload.frequencies ? action.payload.frequencies.map(stringifyFrequency) : state.frequencies\n };\n case constants.RECEIVE_MERCHANT_SETTINGS:\n return {\n ...state,\n merchantSettings: {\n ...action.payload\n }\n };\n default:\n return state;\n }\n};\n\nexport const previewStandardOffer = (state = false, action) => {\n switch (action.type) {\n case constants.SET_PREVIEW_STANDARD_OFFER:\n return action.payload.isPreview;\n default:\n return state;\n }\n};\n\nexport const previewUpsellOffer = (state = false, action) => {\n switch (action.type) {\n case constants.SET_PREVIEW_UPSELL_OFFER:\n return action.payload.isPreview;\n default:\n return state;\n }\n};\n\nexport const previewPrepaidOffer = (state = false, action) => {\n switch (action.type) {\n case constants.SET_PREVIEW_PREPAID_OFFER:\n return action.payload.isPreview;\n default:\n return state;\n }\n};\n\nexport const autoshipByDefault = (state: AutoshipByDefaultState = {}, action): AutoshipByDefaultState => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...action.payload.autoship_by_default\n };\n default:\n return state;\n }\n};\n\nexport const defaultFrequencies = (state = [], action) => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...action.payload.default_frequencies\n };\n default:\n return state;\n }\n};\n\nexport const templates = (state = [], action) => {\n switch (action.type) {\n case constants.SET_TEMPLATES:\n return [...(action.payload || [])];\n case constants.ADD_TEMPLATE:\n // Unshift the payload at the top\n return [action.payload, ...state];\n default:\n return state;\n }\n};\n\nexport const productPlans = (state: ProductPlansState = {}, action): ProductPlansState => {\n switch (action.type) {\n case constants.RECEIVE_PRODUCT_PLANS:\n return getObjectStructuredProductPlans(action.payload);\n default:\n return state;\n }\n};\n\nexport const prepaidShipmentsSelected = (\n state: PrepaidShipmentsSelectedState = {},\n action\n): PrepaidShipmentsSelectedState => {\n switch (action.type) {\n // Given that, in the cart, products will have a composed id (<productId>:<cartId>) and that every time\n // a product changes in the cart we need to sync these changes back with the eComm platform, this operation\n // may result in a new cartId that needs to replace the old product's cartId in order to have the\n // prepaidShipmentsSelected object up-to-date\n case constants.CART_PRODUCT_KEY_HAS_CHANGED: {\n const { [action.payload.oldCartProductKey]: preservedPrepaidShipments, ...stateWithoutOldCartProductKey } = state;\n return { ...stateWithoutOldCartProductKey, [action.payload.newCartProductKey]: preservedPrepaidShipments };\n }\n case constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS:\n if (action.payload.prepaidShipments) {\n return { ...state, [action.payload.product.id]: action.payload.prepaidShipments };\n }\n return state;\n default:\n return state;\n }\n};\n\nexport const price = (state: PriceState = {}, _action) => state;\n\nexport const benefitMessages = (state: BenefitMessagesState = {}, action): BenefitMessagesState => {\n switch (action.type) {\n case constants.SET_BENEFIT_MESSAGES:\n return { ...(action.payload || {}) };\n default:\n return state;\n }\n};\n\nexport default combineReducers({\n optedin,\n optedout,\n nextUpcomingOrder,\n autoshipEligible,\n inStock,\n eligibilityGroups,\n incentives,\n frequency,\n auth,\n merchantId,\n authUrl,\n offer,\n offerId,\n experiments: experimentsReducer,\n sessionId,\n productOffer,\n firstOrderPlaceDate,\n productToSubscribe,\n environment,\n locale,\n config,\n previewStandardOffer,\n previewUpsellOffer,\n autoshipByDefault,\n defaultFrequencies,\n templates,\n productPlans,\n prepaidShipmentsSelected,\n price,\n benefitMessages\n});\n", "import { getPayAsYouGoSellingPlan, money, percentage } from '../utils';\nimport { ShopifyProductEntity, ShopifySellingPlanAllocationsEntity, ShopifySellingPlansEntity } from '../types/shopify';\nimport { ProductPlanEntity } from '../types/productPlan';\n\nexport const isPrepaidAllocation = (allocation: ShopifySellingPlanAllocationsEntity) =>\n Array.isArray(allocation.selling_plan?.options) &&\n allocation.selling_plan?.options.some(option => option?.name === 'Shipment amount');\n\nexport const getPrepaidShipmentsNumberFromOptions = options => {\n if (options && options.length > 1) {\n const shipmentAmountArray = options.find(option => option?.name === 'Shipment amount').value.split(' ');\n return shipmentAmountArray.length > 0 ? +shipmentAmountArray[0] : null;\n }\n\n return null;\n};\n\nexport const getAllocationFrequency = (allocation: ShopifySellingPlanAllocationsEntity) => {\n // now frequency every_period will match with selling_plan_id so no need to convert it\n return (allocation.selling_plan_id || (allocation.selling_plan?.id ?? '')).toString();\n};\n\nexport const getAllocationRegularPrice = (allocation: ShopifySellingPlanAllocationsEntity, currency: string) => {\n return money(allocation.compare_at_price, currency);\n};\n\nexport const getAllocationSubscriptionPrice = (allocation: ShopifySellingPlanAllocationsEntity, currency: string) => {\n if (isPrepaidAllocation(allocation)) {\n const prepaidShipmentsPerBilling = getPrepaidShipmentsNumberFromOptions(allocation.selling_plan?.options);\n const pricePerShipment = Math.round(allocation.price / prepaidShipmentsPerBilling);\n return money(pricePerShipment, currency);\n }\n\n return money(allocation.price, currency);\n};\n\nconst getPrepaidPercentage = (allocation: ShopifySellingPlanAllocationsEntity, pricePerShipment: number) => {\n return Math.round(((allocation.compare_at_price - pricePerShipment) * 100) / allocation.compare_at_price);\n};\n\nexport const getAllocationDiscountRate = (allocation: ShopifySellingPlanAllocationsEntity, currency: string) => {\n if (isPrepaidAllocation(allocation)) {\n const prepaidShipmentsPerBilling = getPrepaidShipmentsNumberFromOptions(allocation.selling_plan?.options);\n const pricePerShipment = allocation.price / prepaidShipmentsPerBilling;\n const prepaidPercentageSavings = getPrepaidPercentage(allocation, pricePerShipment);\n\n return percentage(prepaidPercentageSavings);\n }\n\n let formatted_discount = '';\n\n if (allocation.price_adjustments[0]?.value_type === 'percentage') {\n formatted_discount = percentage(allocation.price_adjustments[0].value);\n } else if (allocation.price_adjustments[0]?.value) {\n formatted_discount = money(allocation.price_adjustments[0].value, currency);\n } else if (allocation.compare_at_price) {\n formatted_discount = money(allocation.compare_at_price - allocation.price, currency);\n }\n\n return formatted_discount;\n};\n\nexport const getAllocationNumberOfShipments = (allocation: ShopifySellingPlanAllocationsEntity) => {\n if (isPrepaidAllocation(allocation)) {\n return getPrepaidShipmentsNumberFromOptions(allocation.selling_plan?.options);\n }\n return null;\n};\n\nexport const addPrepaidPriceAndSavings = (\n allocation: ShopifySellingPlanAllocationsEntity,\n productPlan: ProductPlanEntity,\n payAsYouGoPlan: ShopifySellingPlansEntity,\n currency: string\n) => {\n const prepaidShipmentsPerBilling = getPrepaidShipmentsNumberFromOptions(allocation.selling_plan?.options);\n const pricePerShipment = allocation.price / prepaidShipmentsPerBilling;\n const prepaidSaving = allocation.compare_at_price - pricePerShipment;\n const prepaidPercentageSavings = getPrepaidPercentage(allocation, pricePerShipment);\n const payAsYouGoAdjustment = payAsYouGoPlan?.price_adjustments?.[0];\n const payAsYouGoPercentage =\n payAsYouGoAdjustment && payAsYouGoAdjustment.value_type === 'percentage' ? payAsYouGoAdjustment.value : null;\n\n productPlan['regularPrepaidPrice'] = money(allocation.price, currency);\n productPlan['prepaidSavingsPerShipment'] = money(Math.round(prepaidSaving), currency);\n productPlan['prepaidSavingsTotal'] = money(Math.round(prepaidSaving * prepaidShipmentsPerBilling), currency);\n\n if (payAsYouGoPercentage && prepaidPercentageSavings) {\n productPlan['prepaidExtraSavingsPercentage'] = percentage(prepaidPercentageSavings - payAsYouGoPercentage);\n }\n\n return productPlan;\n};\n\nexport const mapSellingPlanToDiscount = (\n allocation: ShopifySellingPlanAllocationsEntity,\n sellingPlans: ShopifySellingPlansEntity[],\n currency: string\n) => {\n if (!allocation.selling_plan) {\n allocation.selling_plan = sellingPlans.find(plan => plan.id === allocation.selling_plan_id);\n }\n\n const productPlan: ProductPlanEntity = {\n frequency: getAllocationFrequency(allocation),\n regularPrice: getAllocationRegularPrice(allocation, currency),\n subscriptionPrice: getAllocationSubscriptionPrice(allocation, currency),\n discountRate: getAllocationDiscountRate(allocation, currency),\n prepaidShipments: getAllocationNumberOfShipments(allocation),\n hasPriceAdjustments: allocation.price_adjustments?.length > 0\n };\n\n if (isPrepaidAllocation(allocation)) {\n const payAsYouGoPlan = getPayAsYouGoSellingPlan(sellingPlans);\n return addPrepaidPriceAndSavings(allocation, productPlan, payAsYouGoPlan, currency);\n }\n\n return productPlan;\n};\n\nexport const sellingPlanAllocationsReducer = (\n acc: ProductPlanEntity[],\n cur: ShopifySellingPlanAllocationsEntity,\n sellingPlans: ShopifySellingPlansEntity[] = [],\n currency: string\n) => [...acc, mapSellingPlanToDiscount(cur, sellingPlans, currency)];\n\nexport const getSellingPlans = (product: ShopifyProductEntity) =>\n product.selling_plan_groups.reduce<ShopifySellingPlansEntity[]>(\n (allGroups, group) => [...allGroups, ...group.selling_plans.map(selling_plan => ({ ...selling_plan, group }))],\n []\n );\n", "import * as constants from '../../core/constants';\nimport { getFirstSellingPlan, isOgFrequency, mapFrequencyToSellingPlan, safeProductId } from '../../core/utils';\nimport type {\n ConfigState,\n ReceiveMerchantSettingsPayload,\n ReceiveOfferPayload,\n SetupProductPayload\n} from '../../core/types/reducer';\n\nimport {\n getPayAsYouGoSellingPlanGroup,\n sellingPlansToEveryPeriod,\n sellingPlansToFrequencies,\n getPrepaidShipments\n} from '../utils';\nimport { ShopifyProductEntity, ShopifySellingPlanGroupsEntity, ShopifyVariantsEntity } from '../types/shopify';\n\nconst config = (\n state: ConfigState = {\n offerType: 'radio',\n productFrequencies: {},\n frequencies: [],\n frequenciesEveryPeriod: []\n },\n action\n): ConfigState => {\n if (constants.SETUP_PRODUCT === action.type) {\n const {\n payload: { product, currency }\n } = action as { payload: SetupProductPayload };\n let configToAdd: ConfigState = {};\n let productFrequencies: ConfigState['productFrequencies'] = product.variants?.reduce(\n (acc, variant) => reduceSellingPlansToFrequencies(acc, variant, product.selling_plan_groups, state),\n {}\n );\n\n let updatedProductFrequencies = {\n ...state.productFrequencies,\n ...productFrequencies\n };\n\n configToAdd = {\n ...configToAdd,\n productFrequencies: updatedProductFrequencies,\n // populate the old frequency fields for backwards compatibility\n // these are only needed if someone was reading our config state directly, which shouldn't be common but is possible\n ...Object.values(updatedProductFrequencies)[0]\n };\n\n // prepaid selling plans\n const prepaidSellingPlans = getPrepaidSellingPlans(product);\n if (Object.keys(prepaidSellingPlans).length) {\n configToAdd = {\n ...configToAdd,\n prepaidSellingPlans: { ...state.prepaidSellingPlans, ...prepaidSellingPlans }\n };\n }\n return {\n ...state,\n ...configToAdd,\n storeCurrency: currency\n };\n }\n\n if (constants.RECEIVE_OFFER === action.type) {\n const {\n payload: { offer: offerEl }\n } = action as { payload: ReceiveOfferPayload };\n const { defaultFrequency, product } = offerEl || {};\n const { prepaidSellingPlans = {} } = state;\n\n // productFrequencies does not have entries for the cart ID\n // eligible frequencies apply to cart entries for the product\n const productId = safeProductId(product?.id);\n const currentProductFrequencies = state.productFrequencies[productId];\n\n let updatedProductFrequencies: ConfigState['productFrequencies'] = {\n ...state.productFrequencies,\n [productId]: {\n ...currentProductFrequencies,\n defaultFrequency: getUpdatedDefaultFrequency(\n productId,\n defaultFrequency,\n prepaidSellingPlans,\n currentProductFrequencies?.frequencies,\n currentProductFrequencies?.frequenciesEveryPeriod\n )\n }\n };\n\n return {\n ...state,\n productFrequencies: updatedProductFrequencies,\n // populate the old frequency fields for backwards compatibility\n ...Object.values(updatedProductFrequencies)[0]\n };\n }\n\n if (constants.RECEIVE_MERCHANT_SETTINGS === action.type) {\n return {\n ...state,\n merchantSettings: {\n ...(action.payload as ReceiveMerchantSettingsPayload)\n }\n };\n }\n\n return state;\n};\n\nfunction getFrequencies(\n productSellingPlanGroups: ShopifySellingPlanGroupsEntity[],\n state: { defaultFrequency?: string }\n) {\n const sellingPlanGroup = getPayAsYouGoSellingPlanGroup(productSellingPlanGroups);\n const frequencies = sellingPlansToFrequencies(sellingPlanGroup);\n if (frequencies?.length) {\n const frequenciesEveryPeriod = sellingPlansToEveryPeriod(sellingPlanGroup);\n const frequenciesText = sellingPlanGroup.options?.[0]?.values || frequencies;\n let defaultFrequency = state?.defaultFrequency;\n\n if (defaultFrequency && isOgFrequency(defaultFrequency)) {\n defaultFrequency =\n mapFrequencyToSellingPlan(frequencies, frequenciesEveryPeriod, defaultFrequency) ||\n getFirstSellingPlan(frequencies) ||\n defaultFrequency;\n }\n return {\n frequencies,\n frequenciesEveryPeriod,\n frequenciesText,\n ...(defaultFrequency ? { defaultFrequency } : {})\n };\n }\n return null;\n}\n\nfunction reduceSellingPlansToFrequencies(\n acc: ConfigState['productFrequencies'],\n variant: ShopifyVariantsEntity,\n sellingPlanGroups: ShopifySellingPlanGroupsEntity[],\n state: ConfigState\n) {\n const sellingPlanGroupIdsForProduct = variant.selling_plan_allocations.map(\n allocation => allocation.selling_plan_group_id\n );\n const applicableSellingPlanGroups = sellingPlanGroups.filter(group =>\n sellingPlanGroupIdsForProduct.includes(group.id)\n );\n const frequencies = getFrequencies(applicableSellingPlanGroups, state.productFrequencies[variant.id]);\n if (frequencies) {\n acc[variant.id] = frequencies;\n }\n return acc;\n}\n\nfunction getUpdatedDefaultFrequency(\n productId: string,\n offerElementDefaultFrequency: string,\n prepaidSellingPlans: ConfigState['prepaidSellingPlans'],\n frequencies: string[] | undefined = [],\n frequenciesEveryPeriod: string[] | undefined = []\n) {\n // We don't want to be setting the default frequency to a prepaid selling plan\n if (prepaidSellingPlans[productId]?.some(({ sellingPlan }) => sellingPlan === offerElementDefaultFrequency)) {\n return getFirstSellingPlan(frequencies) || offerElementDefaultFrequency;\n }\n\n if (!isOgFrequency(offerElementDefaultFrequency)) {\n return offerElementDefaultFrequency;\n }\n\n return (\n mapFrequencyToSellingPlan(frequencies, frequenciesEveryPeriod, offerElementDefaultFrequency) ||\n getFirstSellingPlan(frequencies) ||\n offerElementDefaultFrequency\n );\n}\n\nexport function getPrepaidSellingPlans(\n product: ShopifyProductEntity\n): Record<string, { numberShipments: number; sellingPlan: string }[]> {\n const prepaidSellingPlanGroups = product?.selling_plan_groups.filter(group => /^Prepaid-.*/.test(group.name));\n if (!prepaidSellingPlanGroups.length) {\n return {};\n }\n\n return prepaidSellingPlanGroups.reduce((acc, cur) => {\n const variant = cur.name.split('-')[1];\n\n const sellingPlanInfo = cur.selling_plans.map(sellingPlanObject => {\n return {\n numberShipments: getPrepaidShipments(sellingPlanObject),\n sellingPlan: String(sellingPlanObject.id)\n };\n });\n\n return { ...acc, [variant]: sellingPlanInfo };\n }, {});\n}\n\nexport default config;\n", "import { combineReducers } from 'redux';\nimport * as constants from '../core/constants';\n\nimport baseReducer, {\n autoshipByDefault,\n auth,\n authUrl,\n benefitMessages,\n defaultFrequencies,\n eligibilityGroups,\n environment,\n firstOrderPlaceDate,\n incentives,\n locale,\n merchantId,\n nextUpcomingOrder,\n optedin as coreOptedin,\n optedout,\n offerId,\n previewStandardOffer,\n previewUpsellOffer,\n productToSubscribe,\n sessionId,\n templates,\n prepaidShipmentsSelected\n} from '../core/reducer';\nimport {\n getFirstSellingPlan,\n hasShopifySellingPlans,\n isOgFrequency,\n mapFrequencyToSellingPlan,\n safeProductId,\n getMatchingProductIfExists\n} from '../core/utils';\nimport type {\n AutoshipEligibleState,\n OfferElement,\n OptedInState,\n OptInItem,\n PriceState,\n ReceiveOfferPayload,\n SetupProductPayload\n} from '../core/types/reducer';\n\nimport { sellingPlanAllocationsReducer, getSellingPlans } from './reducers/productPlans';\nimport config, { getPrepaidSellingPlans } from './reducers/config';\nimport { experimentsReducer } from '../core/experiments';\nimport {\n getPayAsYouGoSellingPlanGroup,\n getPayAsYouGoSellingPlanGroups,\n sellingPlansToEveryPeriod,\n sellingPlansToFrequencies,\n getPrepaidShipments,\n getDefaultPrepaidOption\n} from './utils';\nimport { EmptyObject } from '../core/types/utility';\nimport { ELIGIBILITY_GROUPS } from '../core/constants';\n\nconst overrideLineKey = (state, productId, newValue) => {\n const keys = Object.keys(state).filter(it => it.startsWith(productId.toString()));\n if (keys.length) {\n return { ...state, ...keys.reduce((acc, cur) => ({ ...acc, [cur]: newValue }), {}) };\n }\n return state;\n};\n\nexport const getDefaultSellingPlan = (\n sellingPlans: string[],\n frequenciesEveryPeriod: string[],\n defaultFrequency: string | undefined\n) => {\n if (!defaultFrequency) {\n return null;\n }\n\n if (!isOgFrequency(defaultFrequency)) {\n return defaultFrequency;\n }\n\n if (hasShopifySellingPlans(sellingPlans, frequenciesEveryPeriod)) {\n const sellingPlan = mapFrequencyToSellingPlan(sellingPlans, frequenciesEveryPeriod, defaultFrequency);\n\n if (sellingPlan) {\n return sellingPlan;\n }\n\n return getFirstSellingPlan(sellingPlans);\n }\n\n return defaultFrequency;\n};\n\nexport const mapExistingOptinsFromOfferResponse = (\n state: OptedInState,\n offerEl: OfferElement | EmptyObject,\n frequencyConfig: ReceiveOfferPayload['frequencyConfig']\n) =>\n state.map(it => {\n if (isOgFrequency(it?.frequency)) {\n return {\n ...it,\n frequency: hasShopifySellingPlans(frequencyConfig?.frequencies, frequencyConfig?.frequenciesEveryPeriod)\n ? mapFrequencyToSellingPlan(\n frequencyConfig?.frequencies,\n frequencyConfig?.frequenciesEveryPeriod,\n it.frequency\n ) ||\n mapFrequencyToSellingPlan(\n frequencyConfig?.frequencies,\n frequencyConfig?.frequenciesEveryPeriod,\n offerEl?.defaultFrequency\n ) ||\n getFirstSellingPlan(frequencyConfig?.frequencies)\n : it.frequency\n };\n }\n\n return it;\n });\n\nexport const reduceNewOptinsFromOfferResponse = (\n {\n autoship = {},\n autoship_by_default = {},\n default_frequencies = {},\n in_stock = {},\n eligibility_groups = {}\n }: ReceiveOfferPayload,\n existingOptins: OptedInState,\n offerEl: OfferElement | EmptyObject,\n frequencyConfig: ReceiveOfferPayload['frequencyConfig'],\n prepaidSellingPlans: ReceiveOfferPayload['prepaidSellingPlans']\n) =>\n Object.keys(autoship).reduce((acc, id) => {\n // if the user is not opted in and the product is set to default to subscription\n if (!existingOptins.some(it => it.id === id) && autoship_by_default[id] && in_stock[id]) {\n if (autoship[id]) {\n return acc.concat({\n id,\n frequency: getOptInDefaultFrequency({\n frequencyConfig,\n offerEl,\n default_frequencies,\n id\n })\n });\n } else if (eligibility_groups[id]?.includes(ELIGIBILITY_GROUPS.PREPAID)) {\n // if the product is prepaid eligible but not subscription eligible, opt them into a prepaid subscription\n const prepaidPlan = prepaidSellingPlans ? getDefaultPrepaidOption(prepaidSellingPlans) : null;\n return acc.concat({\n id,\n // we might not have a prepaid plan yet if the Shopify product request hasn't completed (SETUP_PRODUCT)\n frequency: prepaidPlan?.sellingPlan || PREPAID_PLACEHOLDER,\n prepaidShipments: prepaidPlan?.numberShipments || null\n });\n }\n }\n\n return acc;\n }, []);\n\nconst getOptInDefaultFrequency = ({\n frequencyConfig,\n offerEl,\n default_frequencies,\n id\n}: {\n frequencyConfig: ReceiveOfferPayload['frequencyConfig'];\n offerEl: OfferElement | EmptyObject;\n default_frequencies: ReceiveOfferPayload['default_frequencies'];\n id: string;\n}) => {\n const { frequencies: sellingPlans, frequenciesEveryPeriod } = frequencyConfig;\n const { defaultFrequency } = offerEl || {};\n const psdf = default_frequencies[id];\n let frequency;\n\n if (default_frequencies[id] && hasShopifySellingPlans(sellingPlans, frequenciesEveryPeriod)) {\n frequency =\n mapFrequencyToSellingPlan(sellingPlans, frequenciesEveryPeriod, `${psdf.every}_${psdf.every_period}`) ||\n getDefaultSellingPlan(sellingPlans, frequenciesEveryPeriod, defaultFrequency) ||\n getFirstSellingPlan(sellingPlans);\n } else if (default_frequencies[id]) {\n frequency = `${psdf.every}_${psdf.every_period}`;\n } else {\n frequency = getDefaultSellingPlan(sellingPlans, frequenciesEveryPeriod, defaultFrequency) || '_'; // Placeholder to be backfilled in SETUP_PRODUCT reducer\n }\n\n return frequency;\n};\n\nconst productOrVariantInStockReducer = (acc, cur) => ({\n ...overrideLineKey(acc, cur.id, cur.available),\n [cur.id]: cur.available\n});\n\nconst reduceProductCartLine = (acc, cur) => {\n const productId = safeProductId(cur.key);\n return { ...acc, [cur.key]: acc[productId] || null };\n};\n\nexport const autoshipEligible = (state: AutoshipEligibleState = {}, action): AutoshipEligibleState => {\n if (constants.SETUP_CART === action.type) {\n const { payload: cart } = action;\n return cart.items.reduce(reduceProductCartLine, state);\n }\n if (constants.SETUP_PRODUCT === action.type) {\n const {\n payload: { product }\n } = action as { payload: SetupProductPayload };\n const applicableSellingPlanGroups = getPayAsYouGoSellingPlanGroups(product?.selling_plan_groups);\n\n const ogSellingPlanIds = new Set(\n applicableSellingPlanGroups.flatMap(group => group.selling_plans.map(sellingPlan => sellingPlan.id)) ?? []\n );\n\n return product.variants.reduce((acc, cur) => {\n const productSellingPlansFromOG =\n cur?.selling_plan_allocations?.filter(sellingPlan => ogSellingPlanIds.has(sellingPlan.selling_plan_id)) ?? [];\n // a product is autoship eligible if it has plans from the default or PSFL selling plan group\n // the presence of prepaid selling plans does not mean it is autoship eligible\n const isAutoshipEligible = productSellingPlansFromOG.length > 0;\n\n return {\n ...overrideLineKey(acc, cur.id, isAutoshipEligible),\n [cur.id]: isAutoshipEligible\n };\n }, state);\n }\n if (constants.SET_PREVIEW_STANDARD_OFFER === action.type) {\n if (action.payload.isPreview !== true) return state;\n return { ...state, ...{ [action.payload.productId]: true } };\n }\n return state;\n};\n\nexport const inStock = (state = {}, action) => {\n if (constants.SETUP_CART === action.type) {\n const cart = action.payload;\n\n return cart.items.reduce(reduceProductCartLine, state);\n }\n\n if (constants.SETUP_PRODUCT === action.type) {\n const {\n payload: { product }\n } = action as { payload: SetupProductPayload };\n // it's unclear whether this needs to check the base product object or could only check the variants\n // leaving for now to preserve backwards compatibility\n return [product, ...(product?.variants ?? [])]?.reduce(productOrVariantInStockReducer, state) || state;\n }\n // force offer to refresh when requesting a new one\n if (constants.REQUEST_OFFER === action.type && action.payload.product === null) {\n return { ...state };\n }\n if (constants.SET_PREVIEW_STANDARD_OFFER === action.type) {\n if (action.payload.isPreview !== true) return state;\n return { ...state, ...{ [action.payload.productId]: true } };\n }\n return state;\n};\n\nexport const offer = (state = {}, _action) => state;\n\nfunction getOptedInItem(cartItem) {\n const prepaidShipments = getPrepaidShipments(cartItem.selling_plan_allocation.selling_plan);\n const item: OptInItem = {\n id: cartItem.key,\n frequency: `${cartItem.selling_plan_allocation.selling_plan.id}`\n };\n if (prepaidShipments) {\n item.prepaidShipments = prepaidShipments;\n }\n return item;\n}\n\nconst PREPAID_PLACEHOLDER = 'prepaid-replace-me';\nexport const optedin = (state: OptedInState = [], action): OptedInState => {\n if (constants.SETUP_CART === action.type) {\n const cart = action.payload;\n return state\n .filter(it => !it.id.includes(':'))\n .concat(cart.items.reduce((acc, cur) => (cur.selling_plan_allocation ? [...acc, getOptedInItem(cur)] : acc), []));\n }\n\n if (constants.RECEIVE_OFFER === action.type) {\n const payload = action.payload as ReceiveOfferPayload;\n const { offer: offerEl = {}, frequencyConfig, prepaidSellingPlans } = payload;\n const existingOptins = mapExistingOptinsFromOfferResponse(state, offerEl, frequencyConfig);\n const newOptins = reduceNewOptinsFromOfferResponse(\n payload,\n existingOptins,\n offerEl,\n frequencyConfig,\n prepaidSellingPlans\n );\n\n return [...existingOptins, ...newOptins];\n }\n\n if (constants.SETUP_PRODUCT === action.type) {\n const { product } = action.payload;\n const sellingPlanGroup = getPayAsYouGoSellingPlanGroup(product?.selling_plan_groups);\n const prepaidSellingPlans = getPrepaidSellingPlans(product);\n const frequencies = sellingPlanGroup ? sellingPlansToFrequencies(sellingPlanGroup) : [];\n const frequenciesEveryPeriod = sellingPlanGroup ? sellingPlansToEveryPeriod(sellingPlanGroup) : [];\n\n return state\n .map(curr => {\n const prepaidSellingPlansForVariant = prepaidSellingPlans[curr.id];\n if (sellingPlanGroup && isOgFrequency(curr.frequency)) {\n return {\n ...curr,\n frequency:\n mapFrequencyToSellingPlan(frequencies, frequenciesEveryPeriod, curr.frequency) ||\n getFirstSellingPlan(frequencies)\n };\n } else if (curr.frequency === PREPAID_PLACEHOLDER && prepaidSellingPlansForVariant?.length > 0) {\n // if we opted the user into a prepaid plan on RECEIVE_OFFER and now have the actual selling plan information, update it\n const { sellingPlan, numberShipments } = getDefaultPrepaidOption(prepaidSellingPlansForVariant);\n return {\n ...curr,\n frequency: sellingPlan,\n prepaidShipments: numberShipments\n };\n }\n\n return curr;\n })\n .filter(i => i.frequency !== PREPAID_PLACEHOLDER); // remove any leftover placeholders\n }\n\n if (constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS === action.type) {\n const { payload } = action;\n // core reducer sets prepaid shipments\n const newState = coreOptedin(state, action);\n // get the new frequency (selling plan) that matches the prepaid shipments\n const [oldone, rest] = getMatchingProductIfExists(newState, payload.product);\n return rest.concat({\n ...oldone,\n ...payload.product,\n frequency: payload.frequency\n });\n }\n\n return coreOptedin(state, action);\n};\n\nexport const price = (state: PriceState = {}, action): PriceState => {\n if (constants.SETUP_PRODUCT === action.type) {\n const {\n payload: { product }\n } = action as { payload: SetupProductPayload };\n return (\n product.variants?.reduce(\n (acc, cur) => ({\n ...acc,\n [cur.id]: { value: cur.price }\n }),\n state\n ) || state\n );\n }\n\n return state;\n};\n\nexport const productOffer = (state = {}, _action) => state;\n\nexport const productPlans = (state = {}, action) => {\n if (constants.SETUP_PRODUCT === action.type) {\n const {\n payload: { product, currency }\n } = action as { payload: SetupProductPayload };\n\n const sellingPlans = getSellingPlans(product);\n\n return (\n product.variants.reduce(\n (acc, cur) => ({\n ...acc,\n [cur.id]: cur.selling_plan_allocations?.reduce(\n (accumulator, current) => sellingPlanAllocationsReducer(accumulator, current, sellingPlans, currency),\n []\n )\n }),\n state\n ) || state\n );\n }\n if (constants.SETUP_CART === action.type) {\n const cart = action.payload;\n return (\n cart.items.reduce(\n (acc, cur) =>\n cur.selling_plan_allocation\n ? {\n ...acc,\n [cur.key]: sellingPlanAllocationsReducer([], cur.selling_plan_allocation, [], cart.currency)\n }\n : acc,\n state\n ) || state\n );\n }\n return state;\n};\n\nconst reducer = combineReducers({\n auth,\n authUrl,\n autoshipByDefault,\n autoshipEligible,\n config,\n defaultFrequencies,\n eligibilityGroups,\n environment,\n firstOrderPlaceDate,\n incentives,\n inStock,\n locale,\n merchantId,\n nextUpcomingOrder,\n offer,\n offerId,\n experiments: experimentsReducer,\n optedin,\n optedout,\n previewStandardOffer,\n previewUpsellOffer,\n price,\n productOffer,\n productPlans,\n productToSubscribe,\n sessionId,\n templates,\n prepaidShipmentsSelected,\n benefitMessages\n});\n\nexport default function shopifyReducer(state, action) {\n if (window.og && window.og.previewMode) return baseReducer(state, action);\n return reducer(state, action);\n}\n", "import memoize from 'lodash.memoize';\nimport { debounce } from 'throttle-debounce';\n\nimport {\n CART_PRODUCT_KEY_HAS_CHANGED,\n CART_UPDATED_EVENT,\n OPTIN_PRODUCT,\n OPTOUT_PRODUCT,\n PRODUCT_CHANGE_FREQUENCY,\n PRODUCT_CHANGE_PREPAID_SHIPMENTS,\n RECEIVE_OFFER,\n REQUEST_OFFER,\n SETUP_CART,\n SETUP_PRODUCT\n} from '../core/constants';\n\nimport { isShopifyDiscountFunctionInUseSelector, makeSubscribedSelector } from '../core/selectors';\nimport { getOrCreateHidden, safeProductId } from '../core/utils';\nimport { getTrackingKey } from './shopifyTrackingMiddleware';\nimport { ShopifyCart, ShopifyProductEntity } from './types/shopify';\nimport { SetupProductPayload, SetupCartPayload, OfferElement, State } from '../core/types/reducer';\nimport { type Store } from 'redux';\n\nconst SHOPIFY_ROOT = window.Shopify?.routes?.root || '/';\nconst CART_PAGE_URL = '/cart';\nconst CART_JS_URL = `${SHOPIFY_ROOT}cart.js`;\nconst CART_CHANGE_URL = `${SHOPIFY_ROOT}cart/change.js`;\nconst CART_UPDATE_URL = `${SHOPIFY_ROOT}cart/update.js`;\nconst PRODUCTS_URL = `${SHOPIFY_ROOT}products/`;\nconst OFFER_ATTRIBUTE_NAME = '__ordergroove_offer_id';\n\n/**\n * List of section DOM elements to update via section-rendering api https://shopify.dev/api/section-rendering\n */\nconst DEFAULT_SHOPIFY_CART_AJAX_SECTIONS =\n '[id^=\"shopify-section-\"][id$=__cart-items], [id^=\"shopify-section-\"][id$=\"__cart-footer\"],#cart-live-region-text,#cart-icon-bubble';\nconst makeSyncProductId = offer =>\n debounce(100, false, function (form) {\n const { id } = Object.fromEntries([...new FormData(form).entries()]);\n if (id) {\n offer.setAttribute('product', id);\n } else {\n offer.removeAttribute('product');\n }\n });\n\nasync function getCurrency() {\n const windowCurrency = window.Shopify?.currency?.active;\n if (windowCurrency) {\n return windowCurrency;\n }\n const cart = await getCart();\n return cart.currency;\n}\n\nexport async function setupPdp(store, offer) {\n const handle = guessProductHandle(offer);\n if (handle) {\n try {\n const [product, currency] = await Promise.all([getProduct(handle), getCurrency()]);\n const payload: SetupProductPayload = { product, offer, currency: currency };\n store.dispatch({ type: SETUP_PRODUCT, payload });\n } catch (err) {\n console.warn('OG: Unable to fetch product details for PDP', err);\n }\n }\n // try closest form (safer)\n let form = offer.closest('form');\n // sometimes template is so closest does not work\n // <div>\n // <og-offer ..>\n // </div>\n // <div>\n // <form action=\"/cart/add\"/>\n // </div>\n if (!form) {\n let ref = offer.parentElement;\n // look up parents element of offer that contains the form. This will fix eventually category offers.\n while (ref) {\n form = ref.querySelector('form[action$=\"/cart/add\"]');\n if (form) break;\n if (ref.tagName.toLowerCase() === 'body') break;\n ref = ref.parentElement;\n }\n }\n\n if (form) {\n // this code watches the cart form for changes, so that we can update the product ID on the offer when the variant changes\n const syncProductId = makeSyncProductId(offer);\n // watch the cart form for changes\n // note: changes to hidden inputs do not fire change events\n form.addEventListener('change', () => syncProductId(form));\n // watch for added/removed nodes anywhere in the cart form (including updates to text content)\n // also watch for changes to the \"value\" attribute, which will catch changes to hidden inputs\n const mo = new MutationObserver(e => {\n // if we're only looking at attribute changes\n if (e.every(it => it.type === 'attributes')) {\n // sync the product ID only if the \"id\" input changed - this happens when the product variant changes\n // for performance reasons, avoid reacting to every form attribute change\n if (e.some(it => (it.target as HTMLInputElement).name === 'id')) {\n syncProductId(form);\n }\n } else {\n syncProductId(form);\n }\n });\n mo.observe(form, { subtree: true, childList: true, attributes: true, attributeFilter: ['value'] });\n } else {\n console.info('no /cart/add form found for og-offer', offer);\n }\n}\n\nasync function getCart(): Promise<ShopifyCart> {\n return (await fetch(CART_JS_URL)).json();\n}\n\n/**\n * Attemps to guess the product handle o\n * @returns\n */\nexport function guessProductHandle(offer): string {\n return (\n [\n // Allow specify data-shopify-product-handle attribute offer level so it will work on category qv\n // <og-offer product=\"{{ card_product.selected_or_first_available_variant.id }}\"\n // data-shopify-product-handle=\"{{ card_product.handle }}\"\n // location=\"category\"></og-offer>\n () => offer?.dataset.shopifyProductHandle,\n () =>\n // Use the oembed to get the product handle\n (document\n .querySelector('[href$=\".oembed\"]')\n ?.getAttribute('href')\n ?.match(/\\/([^/]+)\\.oembed$/) || [])[1],\n\n () =>\n // Use the open graph og:type==product and og:url to get the product handle\n ((document.querySelector('meta[property=\"og:type\"][content=\"product\"]') &&\n document\n .querySelector('meta[property=\"og:url\"][content]')\n ?.getAttribute('content')\n ?.match(/\\/([^/]+)$/)) ||\n [])[1],\n\n () =>\n // use any json in the markup\n [...document.querySelectorAll('[type$=json]')]\n .map(it => JSON.parse(it.textContent || '{}'))\n .find(it => it.handle && it.price)?.handle\n ]\n // returns the first truthy and prevent call next functions\n .reduce((acc, cur) => acc || cur(), '')\n );\n}\n\nconst getProduct = memoize(async function (handle: string): Promise<ShopifyProductEntity> {\n return (await fetch(`${PRODUCTS_URL}${handle}.js`)).json();\n});\n\nasync function setupCart(store, offer) {\n const cart = await getCart();\n const { items } = cart;\n const cartPayload: SetupCartPayload = cart;\n store.dispatch({ type: SETUP_CART, payload: cartPayload });\n\n // some minicart templates does not contains line.key but contains line which corresponds to\n // the index on the cart items (Vedge)\n\n const productAsCartLine = Number(offer.product.id);\n if (productAsCartLine <= items.length) {\n offer.setAttribute('product', items[productAsCartLine - 1].key);\n }\n\n const products = await Promise.all(Array.from(new Set(items.map(({ handle }) => handle))).map(getProduct));\n products.forEach(product => {\n const payload: SetupProductPayload = { product, offer, currency: cart.currency };\n store.dispatch({ type: SETUP_PRODUCT, payload });\n });\n}\n\n/**\n * Synchronizes the optins/optouts using shopify cart ajax api\n *\n * @param action\n * @param store\n */\nexport async function synchronizeCartOptin(action: any, store: any) {\n const offerElement = action.payload.offer;\n const selling_plan = action.payload.frequency || getSubscribedFrequency(action.payload.product.id, store);\n const trackingEvent = getTrackingEvent(action);\n\n if (!offerElement?.isCart) {\n return;\n }\n\n try {\n // disable the interactions on the offer since we need to process its side-effects first.\n offerElement.style.pointerEvents = 'none';\n offerElement.style.opacity = '.7';\n\n const sectionsToUpdate = Array.from(document.querySelectorAll(DEFAULT_SHOPIFY_CART_AJAX_SECTIONS));\n\n const key = action.payload.product.id; // shopify cart.item.key\n const cart = await getCart();\n const offerIx = cart?.items?.findIndex(it => it.key === key); // cart.items[offerIx];\n const item = cart.items[offerIx];\n const qty = item.quantity;\n const productId = safeProductId(key);\n\n const offerIdAttribute = getOfferIdAttribute(store);\n const attributes = {\n ...Object.fromEntries([trackingEvent]),\n ...(offerIdAttribute ? { [OFFER_ATTRIBUTE_NAME]: offerIdAttribute } : {})\n };\n\n if (Object.keys(attributes).length > 0) {\n // update the cart attributes\n const updateRes = await fetch(CART_UPDATE_URL, {\n method: 'POST',\n credentials: 'same-origin',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n attributes\n })\n });\n\n if (updateRes.status !== 200) throw new Error('Cart attributes not updated');\n }\n\n const changeRes = await fetch(CART_CHANGE_URL, {\n method: 'POST',\n credentials: 'same-origin',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n id: key,\n quantity: qty,\n properties: item.properties,\n selling_plan: selling_plan || null,\n sections: sectionsToUpdate.map((el: HTMLElement) => el.id.replace(/^shopify-section-/, ''))\n })\n });\n\n if (changeRes.status !== 200) throw new Error('Cart not updated');\n\n const newCart: ShopifyCart = await changeRes.json();\n\n // If both carts have same length we can update the item.key\n // to the original offer element, at least provide\n // some graceful degradations if no sections nor cart page\n const newKey =\n cart.items.length === newCart.items.length\n ? newCart.items[offerIx].key\n : newCart.items.find(\n line =>\n line.quantity === qty &&\n // @ts-expect-error - existing issue flagged after enabling type checking; ignoring for now\n line.product_id === productId &&\n ((!selling_plan && !line.selling_plan_allocation) ||\n line?.selling_plan_allocation.selling_plan.id === selling_plan)\n )?.key;\n\n if (newKey) {\n store.dispatch({\n type: CART_PRODUCT_KEY_HAS_CHANGED,\n payload: {\n oldCartProductKey: key,\n newCartProductKey: newKey\n }\n });\n\n offerElement.setAttribute('product', newKey);\n }\n\n // dispatch SETUP_CART so offer does not flip the state\n const newCartPayload: SetupCartPayload = newCart;\n store.dispatch({ type: SETUP_CART, payload: newCartPayload });\n\n // Use a custom event to hook custom cart updates.\n const cartUpdateEvent = new CustomEvent(CART_UPDATED_EVENT, { bubbles: true, cancelable: true });\n offerElement.dispatchEvent(cartUpdateEvent);\n\n // Let client uses preventDefault if they want to skip default logic after event.\n if (cartUpdateEvent.defaultPrevented) return;\n\n const sections = newCart.sections;\n\n if (Object.values(sections).length) {\n sectionsToUpdate.forEach((sectionElement: HTMLElement) => {\n const sectionId = sectionElement.id.replace(/^shopify-section-/, '');\n if (!(sectionId in sections)) return;\n\n const sectionRawHtml = sections[sectionId];\n\n const el = new DOMParser()\n .parseFromString(sectionRawHtml.toString() || '', 'text/html')\n .getElementById(sectionElement.id);\n if (el) {\n sectionElement.innerHTML = el.innerHTML;\n }\n });\n } else if (window.location.pathname.startsWith(CART_PAGE_URL)) {\n // only do if we are on the cart page\n window.location.reload();\n }\n } catch (err) {\n console.log('OG Error updating cart', err);\n } finally {\n offerElement.style.pointerEvents = 'auto';\n offerElement.style.opacity = '1';\n }\n}\n\n/**\n * Returns a tracking event adhering to the below format:\n *\n * og__<ts in seconds>: \"<product_id>,<action>,<location>,<selling_plan optional>,<variation_id optional>\"\n *\n * Examples:\n *\n * - optin_product with selling plan ID 123 and variation ID 456:\n * og__165653130: \"optin_product,pdp,123,456\"\n *\n * - optin_product with no selling plan and variation ID 456:\n * og__165653137: \"optin_product,pdp,,456\"\n *\n * - optin_product with selling plan ID 123 and no variation ID:\n * og__165653139: \"optin_product,pdp,123,\"\n *\n * - optin_product with no selling plan and no variation ID:\n * og__165653141: \"optin_product,pdp,,\"\n *\n * - optout_product with variation id 456:\n * og__165653135: \"optout_product,pdp,,456\"\n *\n * - product_change_frequency with selling plan ID 123 and variation ID 456:\n * og__165653131: \"product_change_frequency,pdp,123,456\"\n *\n * @param action a Redux action\n * @return {Array} an array with positional values key, value\n */\nexport function getTrackingEvent(action): Array<string> {\n const product_id = action.payload.product.id;\n if (!product_id) return [];\n const key = getTrackingKey();\n const location = action.payload.offer?.location || '';\n const variation = action.payload.offer?.variationId || '';\n const value = [product_id, action.type.toLowerCase(), location];\n\n switch (action.type) {\n case REQUEST_OFFER:\n case OPTOUT_PRODUCT:\n value.push(''); // No selling plan should be associated with these actions\n value.push(variation);\n break;\n case OPTIN_PRODUCT:\n case PRODUCT_CHANGE_FREQUENCY:\n value.push(action.payload.frequency);\n value.push(variation);\n break;\n default:\n return []; // we dont track anything else\n }\n\n return [key, value.join(',')];\n}\n\nexport function getSubscribedFrequency(productId, store) {\n const subscribedSelector = makeSubscribedSelector({ id: productId });\n const optin = subscribedSelector(store.getState());\n const sellingPlanId = optin ? optin.frequency : undefined;\n return sellingPlanId;\n}\n\nfunction getOfferIdAttribute(store: Store<State>) {\n const state = store.getState();\n // if the Shopify Discount Function is being used, we need to pass along the offer ID as a cart attribute so the discount is calculated correctly\n if (isShopifyDiscountFunctionInUseSelector(state)) {\n return state.offerId;\n }\n return null;\n}\n\n/**\n * // update <input type=\"hidden\" name=\"selling_plan\"/> if available\n *\n * @param store\n */\nexport function synchronizeSellingPlan(store: any, offerElement?: OfferElement) {\n if (offerElement?.isCart) return; // hidden inputs are used when product page, not cart.\n if (!offerElement?.shouldEnableOffer) return; // do not set a selling plan if we're hiding the offer\n\n [...document.querySelectorAll('form[action$=\"/cart/add\"] [name=id]')].forEach((productIdInput: HTMLInputElement) => {\n const productId = productIdInput.value;\n\n const sellingPlanId = getSubscribedFrequency(productId, store);\n\n getOrCreateHidden(productIdInput.form, 'selling_plan', sellingPlanId);\n getOrCreateHidden(productIdInput.form, `attributes[og__session]`, store.getState().sessionId);\n\n const offerIdAttribute = getOfferIdAttribute(store);\n if (offerIdAttribute) {\n getOrCreateHidden(productIdInput.form, `attributes[${OFFER_ATTRIBUTE_NAME}]`, offerIdAttribute);\n }\n\n if (offerElement) {\n // use this to update the product attributes in future\n }\n });\n}\n\nexport default function shopifyMiddleware(store) {\n return next => action => {\n /**\n * This redux middleware will perform Shopify specific side-effects such as change\n * the product selling plan when offer is cart\n */\n switch (action.type) {\n case OPTIN_PRODUCT:\n case OPTOUT_PRODUCT:\n case PRODUCT_CHANGE_FREQUENCY:\n break;\n case REQUEST_OFFER:\n if (action.payload.offer?.isCart) {\n setupCart(store, action.payload.offer);\n } else {\n setupPdp(store, action.payload.offer);\n }\n break;\n default:\n }\n\n next(action);\n\n switch (action.type) {\n case OPTIN_PRODUCT:\n case OPTOUT_PRODUCT:\n case PRODUCT_CHANGE_FREQUENCY:\n case PRODUCT_CHANGE_PREPAID_SHIPMENTS:\n synchronizeCartOptin(action, store);\n // falls through\n case REQUEST_OFFER:\n case RECEIVE_OFFER:\n case SETUP_PRODUCT:\n synchronizeSellingPlan(store, action.payload.offer);\n break;\n default:\n }\n };\n}\n", "import { OPTIN_PRODUCT, OPTOUT_PRODUCT, PRODUCT_CHANGE_FREQUENCY, RECEIVE_OFFER } from '../core/constants';\nimport { getTrackingEvent, getSubscribedFrequency } from './shopifyMiddleware';\n\n/**\n * Creates or updates a hidden input used for tracking on non-cart pages\n *\n * @param product_id a product ID\n * @param name an input name, og_<timestamp in seconds>\n * @param value an input value, <tracking event>\n * @return {undefined}\n */\nexport function updateTrackingInputs(product_id: string, name: string, value: string) {\n const store2FormElementSelector = `[name=\"id\"][value=\"${product_id}\"]`;\n const store1FormElementSelector = `form[action=\"/cart/add\"] option[value=\"${product_id}\"]`;\n if (!name) return;\n let cartAddFormElements = document.querySelectorAll(store2FormElementSelector);\n if (!cartAddFormElements.length) {\n cartAddFormElements = document.querySelectorAll(store1FormElementSelector);\n }\n [...cartAddFormElements].forEach((cartAddFormElement: HTMLInputElement) => {\n const parent = cartAddFormElement.form;\n\n let input = parent?.querySelector(`[name=\"${name}\"]`) as HTMLInputElement;\n if (!input) {\n input = document.createElement('input');\n input.type = 'hidden';\n input.name = `attributes[${name}]`;\n parent?.appendChild(input);\n }\n input.value = value;\n });\n}\n\nexport function getTrackingKey() {\n return `og__${Math.ceil(new Date().getTime() / 1000)}`;\n}\n\nexport function addDefaultToSubTracking(action, store) {\n // check if default to sub\n const isDefaultToSub = action.payload.offer?.autoshipByDefault;\n if (!isDefaultToSub) return;\n\n // if default to sub, get tracking info\n const productId = action.payload.offer?.product.id;\n const key = getTrackingKey();\n const location = action.payload.offer?.location || '';\n const variation = action.payload.offer?.variationId || '';\n const frequency = getSubscribedFrequency(productId, store);\n const value = [productId, OPTIN_PRODUCT.toLowerCase(), location, frequency, variation];\n const inputValue = value.join(',');\n updateTrackingInputs(productId, key, inputValue);\n}\n\nexport default function shopifyTrackingMiddleware(store) {\n return next => action => {\n next(action);\n\n switch (action.type) {\n case OPTIN_PRODUCT:\n case OPTOUT_PRODUCT:\n case PRODUCT_CHANGE_FREQUENCY: {\n const offerElement = action.payload.offer;\n const trackingEvent = getTrackingEvent(action);\n\n if (offerElement && !offerElement.isCart) {\n updateTrackingInputs(offerElement.product.id, trackingEvent[0], trackingEvent[1]);\n }\n break;\n }\n case RECEIVE_OFFER:\n addDefaultToSubTracking(action, store);\n break;\n default:\n }\n };\n}\n", "import { authorize } from '../core/actions';\nimport { clearCookie, getCookieValue, getMainJs, resolveEnvAndMerchant } from '../core/utils';\n\nconst SHOPIFY_OG_AUTH_ENDPOINT = '/apps/subscriptions/auth/';\nconst SHOPIFY_OG_AUTH_BEGIN = 'og_auth_begin';\nconst SHOPIFY_OG_AUTH_END = 'og_auth_end';\n\ntype ShopifyOGAuth = {\n customerId: string;\n timestamp: number;\n signature: string;\n};\n\n/**\n * We tag shopify liquid this way.\n * window.ogShopifyConfig = {\n * {%- if customer -%}\n * customer: {\n * id: \"{{customer.id}}\",\n * email: \"{{customer.email}}\",\n * signature: \"{{signature}}\",\n * timestamp: \"{{timestamp}}\",\n * },\n * {%- else -%}\n * customer: null,\n * {%- endif -%}\n */\ntype OgShopifyConfigCustomer = {\n id: string;\n signature: string;\n timestamp: string;\n email?: string;\n};\n\ntype OgShopifyConfig = {\n customer?: OgShopifyConfigCustomer;\n};\n\n/**\n * We rely on window.ogShopifyConfig side of integration\n */\ndeclare global {\n interface Window {\n og: {\n previewMode: boolean;\n };\n ogShopifyConfig: OgShopifyConfig;\n Shopify?: {\n routes?: {\n root: string;\n };\n currency?: {\n active: string;\n rate: string;\n };\n };\n }\n}\n\nconst parseIntegrationTempAuth = (raw: string) => {\n const [id, timestamp, signature, email] = atob(raw).split('|');\n return {\n id,\n signature,\n timestamp,\n email\n } as OgShopifyConfigCustomer;\n};\n/**\n *\n * Markup needed for integration:\n * ```html\n * <script src=\"https://static.ordergroove.com/<merchant_id>/main.js\" {% if customer -%}\n * {%- assign secret_key = shop.metafields.accentuate.theme_hash_key -%}\n * {%- assign timestamp = \"now\" | date: \"%s\" -%}\n * {%- assign signature = customer.id | append: \"|\" | append: timestamp | hmac_sha256: secret_key -%}\n * data-customer=\"{{customer.id | append: \"|\" | append: timestamp | append: \"|\" | append: signature | append: \"|\" | append: customer.email | base64_encode }}\"\n * {%- endif %}></script>\n * ```\n */\nexport async function authorizeShopifyCustomer({ store }) {\n const [merchantId] = resolveEnvAndMerchant();\n const script = getMainJs();\n\n let customer = script?.dataset.customer\n ? parseIntegrationTempAuth(script.dataset.customer)\n : window.ogShopifyConfig?.customer;\n if (customer) {\n const val = await getOrCreateAuthCookie(customer);\n if (val) {\n const [sig_field, ts, sig] = val.split('|');\n store.dispatch(authorize(merchantId, sig_field, Number(ts), sig));\n }\n } else {\n clearCookie('og_auth');\n }\n}\n/**\n * Borrow from here https://github.com/ordergroove/shopify-app/blob/88becb621b29776a946ab0cd3ae215043e174626/server/lib/theme-partials/js/helpers/cookies.js#L18\n * @param customer\n * @returns\n */\nexport async function fetchOGSignature(customer: OgShopifyConfigCustomer) {\n try {\n const response = await fetch(\n `${SHOPIFY_OG_AUTH_ENDPOINT}?customer=${customer.id}&customer_signature=${customer.signature}&customer_timestamp=${customer.timestamp}`\n );\n const data = await response.text();\n const beginningIndex = data.lastIndexOf(SHOPIFY_OG_AUTH_BEGIN);\n\n if (beginningIndex < 0) throw 'Invalid response from OG auth endpoint';\n\n return JSON.parse(\n data.substring(beginningIndex + SHOPIFY_OG_AUTH_BEGIN.length, data.lastIndexOf(SHOPIFY_OG_AUTH_END))\n ) as ShopifyOGAuth;\n } catch (err) {\n console.error(err);\n }\n}\n/**\n * Original source https://github.com/ordergroove/shopify-app/blob/88becb621b29776a946ab0cd3ae215043e174626/server/lib/theme-partials/js/helpers/cookies.js#L56\n *\n * @param customer\n * @returns\n */\nexport async function getOrCreateAuthCookie(customer: OgShopifyConfigCustomer) {\n const ogAuthCookie = getCookieValue('og_auth');\n\n // The cookie hasn't expired yet so we don't need to refresh the auth\n if (ogAuthCookie) {\n return ogAuthCookie;\n }\n const { customerId, timestamp, signature } = await fetchOGSignature(customer);\n\n if (!customerId) return '';\n\n // set expiration to now + 2hrs\n const ogToday = new Date();\n const binarySignature = btoa(signature);\n ogToday.setTime(ogToday.getTime() + 2 * 60 * 60 * 1000);\n const value = `${customerId}|${timestamp}|${binarySignature};expires=${ogToday.toUTCString()}`;\n document.cookie = `og_auth=${value};secure;path=/`;\n return value;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;04BAkBe,SAAAA,EAASC,EAAOC,EAAYC,EAAUC,EAAc,CAMlE,IAAIC,EACAC,EAAY,GAGZC,EAAW,EAGf,SAASC,GAAuB,CAC3BH,GACHI,aAAaJ,CAAD,CAEb,CAJQG,EAAAA,EAAAA,wBAOT,SAASE,GAAS,CACjBF,EAAoB,EACpBF,EAAY,EACZ,CAHQI,EAAAA,EAAAA,UAML,OAAOR,GAAe,YACzBE,EAAeD,EACfA,EAAWD,EACXA,EAAaS,QAQd,SAASC,GAAuB,CAAA,QAAAC,EAAA,UAAA,OAAZC,EAAY,IAAA,MAAAD,CAAA,EAAAE,EAAA,EAAAA,EAAAF,EAAAE,IAAZD,EAAYC,GAAA,UAAAA,GAC/B,IAAIC,EAAO,KACPC,EAAUC,KAAKC,IAAL,EAAaZ,EAE3B,GAAID,EACH,OAID,SAASc,GAAO,CACfb,EAAWW,KAAKC,IAAL,EACXhB,EAASkB,MAAML,EAAMF,CAArB,CACA,CAHQM,EAAAA,EAAAA,QAST,SAASE,GAAQ,CAChBjB,EAAYM,MACZ,CAFQW,EAAAA,EAAAA,SAILlB,GAAgB,CAACC,GAKpBe,EAAI,EAGLZ,EAAoB,EAEhBJ,IAAiBO,QAAaM,EAAUhB,EAK3CmB,EAAI,EACMlB,IAAe,KAYzBG,EAAYkB,WACXnB,EAAekB,EAAQF,EACvBhB,IAA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AAO,OAChBO,GAA+BP,EAAO,6BACtCQ,GAAYR,EAAO,UACnBS,GAA6BT,EAAO,2BACpCU,GAAaV,EAAO,WACpBW,GAAcX,EAAO,YACrBY,GAAWZ,EAAO,SAClBa,GAAkBb,EAAO,gBACzBc,GAAad,EAAO,WACpBe,GAAqBf,EAAO,mBAC5BgB,GAAiBhB,EAAO,eACxBiB,GAAYjB,EAAO,UACnBkB,GAAgBlB,EAAO,cACvBmB,GAAgBnB,EAAO,cACvBoB,GAAepB,EAAO,aACtBqB,GAAYrB,EAAO,UACnBsB,GAAetB,EAAO,aACtBuB,GAAgBvB,EAAO,cACvBwB,GAAWC,EAAA,IAAMC,GAAqB1B,CAAM,EAAjC,YAGxB,IAAO2B,GAAQC,EAAO,WA1CtBC,IAqDIA,GAAAC,IAAA,MAAAD,GAAU,uBACZE,GAAQ,IAAMC,GAAyBJ,CAAM,CAAC",
|
|
6
|
-
"names": ["throttle", "delay", "noTrailing", "callback", "debounceMode", "timeoutID", "cancelled", "lastExec", "clearExistingTimeout", "clearTimeout", "cancel", "undefined", "wrapper", "_len", "arguments_", "_key", "self", "elapsed", "Date", "now", "exec", "apply", "clear", "setTimeout", "__name", "debounce", "atBegin", "require_lodash", "__commonJSMin", "exports", "module", "FUNC_ERROR_TEXT", "HASH_UNDEFINED", "funcTag", "genTag", "reRegExpChar", "reIsHostCtor", "freeGlobal", "freeSelf", "root", "getValue", "object", "key", "__name", "isHostObject", "value", "result", "arrayProto", "funcProto", "objectProto", "coreJsData", "maskSrcKey", "uid", "funcToString", "hasOwnProperty", "objectToString", "reIsNative", "splice", "Map", "getNative", "nativeCreate", "Hash", "entries", "index", "length", "entry", "hashClear", "hashDelete", "hashGet", "data", "hashHas", "hashSet", "ListCache", "listCacheClear", "listCacheDelete", "assocIndexOf", "lastIndex", "listCacheGet", "listCacheHas", "listCacheSet", "MapCache", "mapCacheClear", "mapCacheDelete", "getMapData", "mapCacheGet", "mapCacheHas", "mapCacheSet", "array", "eq", "baseIsNative", "isObject", "isMasked", "pattern", "isFunction", "toSource", "map", "isKeyable", "type", "func", "memoize", "resolver", "memoized", "args", "cache", "other", "tag", "require_murmurhash3_gc", "__commonJSMin", "exports", "module", "murmurhash3_32_gc", "key", "seed", "remainder", "bytes", "h1", "h1b", "c1", "c1b", "c2", "c2b", "k1", "i", "__name", "require_murmurhash2_gc", "__commonJSMin", "exports", "module", "murmurhash2_32_gc", "str", "seed", "l", "h", "k", "__name", "require_murmurhash_js", "__commonJSMin", "exports", "module", "murmur3", "murmur2", "require_token_type", "__commonJSMin", "exports", "module", "TokenType", "require_tokenizer", "__commonJSMin", "exports", "module", "TokenType", "Tokenizer", "__name", "exp", "literal", "tokens", "char", "code", "require_polish", "__commonJSMin", "exports", "module", "TokenType", "PolishNotation", "__name", "tokens", "queue", "stack", "token", "PolishGenerator", "polish", "index", "require_node", "__commonJSMin", "exports", "module", "TokenType", "ExpNode", "op", "left", "right", "literal", "exp", "lit", "__name", "make", "gen", "data", "nodeEvaluator", "tree", "literalEvaluator", "require_logical_expression_parser", "__commonJSMin", "exports", "module", "Tokenizer", "Polish", "Node", "parse", "__name", "exp", "literalChecker", "tokens", "polish", "gen", "tree", "src_exports", "__export", "addOptinChangedCallback", "addTemplate", "autoInit", "clear", "config", "src_default", "disableOptinChangedCallbacks", "getOptins", "getProductsForPurchasePost", "initialize", "isReady", "offers", "platform_default", "previewMode", "register", "resolveSettings", "setAuthUrl", "setBenefitMessages", "setEnvironment", "setLocale", "setMerchantId", "setPublicPath", "setTemplates", "setupCart", "setupProduct", "setupProducts", "store", "symbolObservablePonyfill", "root", "result", "Symbol", "__name", "root", "result", "symbolObservablePonyfill", "es_default", "randomString", "__name", "ActionTypes", "isPlainObject", "obj", "proto", "createStore", "reducer", "preloadedState", "enhancer", "_ref2", "currentReducer", "currentState", "currentListeners", "nextListeners", "isDispatching", "ensureCanMutateNextListeners", "getState", "subscribe", "listener", "isSubscribed", "index", "dispatch", "action", "listeners", "i", "replaceReducer", "nextReducer", "observable", "_ref", "outerSubscribe", "observer", "observeState", "unsubscribe", "es_default", "getUndefinedStateErrorMessage", "key", "action", "actionType", "actionDescription", "__name", "assertReducerShape", "reducers", "key", "reducer", "initialState", "ActionTypes", "__name", "combineReducers", "reducerKeys", "finalReducers", "i", "finalReducerKeys", "unexpectedKeyCache", "shapeAssertionError", "e", "state", "action", "warningMessage", "hasChanged", "nextState", "_i", "_key", "previousStateForKey", "nextStateForKey", "errorMessage", "getUndefinedStateErrorMessage", "bindActionCreator", "actionCreator", "dispatch", "bindActionCreators", "actionCreators", "boundActionCreators", "_defineProperty", "obj", "value", "ownKeys", "object", "enumerableOnly", "keys", "sym", "_objectSpread2", "target", "source", "compose", "_len", "funcs", "arg", "a", "b", "applyMiddleware", "middlewares", "createStore", "store", "_dispatch", "middlewareAPI", "chain", "middleware", "createThunkMiddleware", "extraArgument", "middleware", "__name", "_ref", "dispatch", "getState", "next", "action", "thunk", "es_default", "import_throttle_debounce", "ogAuthRegExp", "readAuthCookie", "__name", "_ogAuthRegExp", "it", "parseAuth", "authCookie", "parts", "iframeLoad", "auth_url", "resolve", "reject", "iframe", "isJsonResponse", "response", "_readStaticAuth", "_delayedReadStaticAuth", "ms", "res", "resolveAuth", "_readAuthCookie", "_iframeLoad", "auth", "OPTIN_PRODUCT", "OPTOUT_PRODUCT", "PRODUCT_CHANGE_FREQUENCY", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "SET_MERCHANT_ID", "REQUEST_OFFER", "RECEIVE_OFFER", "PRODUCT_HAS_CHANGED", "CREATED_SESSION_ID", "SET_AUTH_URL", "REQUEST_AUTH", "AUTHORIZE", "UNAUTHORIZED", "REQUEST_ORDERS", "RECEIVE_ORDERS", "CART_PRODUCT_KEY_HAS_CHANGED", "RECEIVE_ORDER_ITEMS", "FETCH_RESPONSE_ERROR", "SET_ENVIRONMENT_LOCAL", "SET_ENVIRONMENT_STAGING", "SET_ENVIRONMENT_DEV", "SET_ENVIRONMENT_PROD", "READY", "CONCLUDE_UPSELL", "REQUEST_CREATE_IU_ORDER", "CREATE_ONE_TIME", "REQUEST_CONVERT_ONE_TIME", "CONVERT_ONE_TIME", "CHECKOUT", "RECEIVE_FETCH", "SET_LOCALE", "SET_CONFIG", "SET_BENEFIT_MESSAGES", "SET_PREVIEW_STANDARD_OFFER", "SET_PREVIEW_UPSELL_OFFER", "SET_PREVIEW_PREPAID_OFFER", "ADD_TEMPLATE", "SET_TEMPLATES", "LOCAL_STORAGE_CHANGE", "LOCAL_STORAGE_CLEAR", "SET_FIRST_ORDER_PLACE_DATE", "SET_PRODUCT_TO_SUBSCRIBE", "RECEIVE_PRODUCT_PLANS", "SETUP_PRODUCT", "SETUP_CART", "RECEIVE_MERCHANT_SETTINGS", "SET_EXPERIMENT_VARIANT", "DEFAULT_OFFER_MODULE", "ENV_LOCAL", "ENV_DEV", "ENV_STAGING", "ENV_PROD", "STATIC_HOST", "STAGING_STATIC_HOST", "INCENTIVE_STANDARD_TYPES", "ELIGIBILITY_GROUPS", "CART_UPDATED_EVENT", "import_lodash", "memoizeKey", "__name", "args", "withFetchJson", "cb", "res", "withHost", "host", "extra", "path", "options", "withAuth", "auth", "withJsonBody", "toQuery", "params", "key", "val", "toProductId", "product", "it", "fetchOffer", "memoize", "merchantId", "sessionId", "module", "searchParams", "query", "fetchOrders", "status", "ordering", "fetchItems", "orderId", "createOneTime", "order", "quantity", "offer", "parseFrequency", "raw", "every", "every_period", "n", "isFrequencyValid", "compareFrequencies", "a", "b", "parseFrequenciesList", "value", "stringifyFrequency", "__name", "ref", "every", "period", "every_period", "convertOneTimeToSubscription", "withFetchJson", "withHost", "withAuth", "withJsonBody", "item", "frequency", "offer", "sessionId", "parsedFrequency", "parseFrequency", "api", "fetchOffer", "fetchOrders", "fetchItems", "createOneTime", "api_default", "script", "getMainJs", "platform_default", "defaultEqualityCheck", "a", "b", "__name", "areArgumentsShallowlyEqual", "equalityCheck", "prev", "next", "length", "defaultMemoize", "func", "lastArgs", "lastResult", "getDependencies", "funcs", "dependencies", "dep", "dependencyTypes", "createSelectorCreator", "memoize", "_len", "memoizeOptions", "_key", "_len2", "_key2", "recomputations", "resultFunc", "memoizedResultFunc", "selector", "params", "i", "createSelector", "import_lodash", "money", "__name", "val", "currency", "percentage", "DEFAULT_PAY_AS_YOU_GO_GROUP_NAME", "EXPERIMENT_SHOPIFY_APP_ID_PREFIX", "getPayAsYouGoSellingPlanGroup", "sellingPlanGroups", "isProductSpecificFrequencySellingPlanGroup", "isDefaultSellingPlanGroup", "isExperimentSellingPlanGroup", "getPayAsYouGoSellingPlanGroups", "group", "_a", "getPayAsYouGoSellingPlan", "sellingPlans", "plan", "sellingPlansToFrequencies", "sellingPlanGroup", "id", "sellingPlansToEveryPeriod", "options", "value", "textToFreq", "text", "period", "it", "every", "getPrepaidShipments", "sellingPlan", "shipments", "name", "getDefaultPrepaidOption", "memoize", "arraysEqual", "a", "b", "i", "__name", "resolveFrequency", "sellingPlans", "frequenciesEveryPeriod", "frequency", "ogFrequency", "stringifyFrequency", "platform_default", "mapFrequencyToSellingPlan", "isSameProduct", "optedinSelector", "state", "optedoutSelector", "autoshipSelector", "defaultFrequenciesSelector", "prepaidSellingPlansSelector", "_a", "prepaidShipmentsSelectedSelector", "makeOptedinSelector", "product", "createSelector", "optedin", "optedout", "autoshipByDefault", "entry", "makeSubscribedSelector", "makePrepaidSubscribedSelector", "makePrepaidShipmentsSelectedSelector", "prepaidShipmentsSelected", "makeOptedoutSelector", "makeProductFrequencyOptedInSelector", "productOptin", "makeProductPrepaidShipmentsOptedInSelector", "makeProductPrepaidShipmentOptionsSelector", "productId", "prepaidSellingPlans", "safeProductId", "numberShipments", "makeProductSpecificDefaultFrequencySelector", "makeProductFrequenciesSelector", "defaultFrequencies", "makeProductFrequencyOptionsSelector", "productFrequencies", "makeProductDefaultFrequencySelector", "oldFrequencies", "oldFrequenciesEveryPeriod", "oldFrequenciesText", "oldDefaultFrequency", "makeFrequencyForPrepaidShipmentsSelector", "prepaidShipments", "frequencies", "plan", "p", "makePrepaidSellingPlansSelector", "makeDiscountedProductPriceSelector", "prices", "incentives", "currency", "productPriceObj", "productPrice", "regularPrice", "subscriptionPrice", "productIncentives", "incentive", "findRelevantIncentive", "formatted_discount", "percentage", "money", "validIncentiveStandards", "INCENTIVE_STANDARD_TYPES", "kebabCase", "string", "getFallbackValue", "element", "key", "defaultValue", "templatesSelector", "isShopifyDiscountFunctionInUseSelector", "plans", "resolveLocaleMessage", "localeMap", "enUS", "browserLocale", "langPrefix", "partialMatch", "msg", "makeBenefitMessagesSelector", "benefitMap", "isPreview", "seenIds", "seenMessages", "list", "id", "onReady", "fn", "__name", "getMainJs", "STATIC_HOST", "STAGING_STATIC_HOST", "resolveEnvAndMerchant", "script", "url", "env", "ENV_STAGING", "ENV_PROD", "merchantId", "safeProductId", "product", "_a", "productId", "platform_default", "safeOgFrequency", "initialFrequency", "frequencies", "frequenciesEveryPeriod", "ix", "frequencyToSellingPlan", "ogFrequency", "frequencyConfig", "autoInitializeOffers", "offers", "clearCookie", "cookieId", "getCookieValue", "cookie", "isOgFrequency", "frequency", "getFirstSellingPlan", "hasShopifySellingPlans", "sellingPlans", "mapFrequencyToSellingPlan", "index", "it", "getOrCreateHidden", "parent", "name", "value", "input", "getMatchingProductIfExists", "state", "oldone", "rest", "acc", "val", "isSameProduct", "optinProduct", "__name", "product", "frequency", "offer", "OPTIN_PRODUCT", "optoutProduct", "OPTOUT_PRODUCT", "productHasChangedComponents", "newProduct", "PRODUCT_HAS_CHANGED", "productChangeFrequency", "PRODUCT_CHANGE_FREQUENCY", "productChangePrepaidShipments", "prepaidShipments", "dispatch", "getState", "makeFrequencyForPrepaidShipmentsSelector", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "concludeUpsell", "__name", "product", "CONCLUDE_UPSELL", "setMerchantId", "merchantId", "SET_MERCHANT_ID", "createSessionId", "CREATED_SESSION_ID", "requestAuth", "payload", "REQUEST_AUTH", "authorize", "sigfield", "ts", "sig", "AUTHORIZE", "unauthorized", "reason", "UNAUTHORIZED", "setAuthUrl", "url", "SET_AUTH_URL", "fetchDone", "initiator", "RECEIVE_FETCH", "fetchAuth", "authResolver", "u", "dispatch", "getState", "authUrl", "requestAction", "sig_field", "err", "requestOrders", "status", "ordering", "REQUEST_ORDERS", "receiveOrders", "response", "RECEIVE_ORDERS", "receiveItems", "RECEIVE_ORDER_ITEMS", "fetchOrders", "legoUrl", "auth", "api", "nextOrderId", "res", "setEnvironment", "env", "ENV_LOCAL", "SET_ENVIRONMENT_LOCAL", "ENV_DEV", "SET_ENVIRONMENT_DEV", "ENV_STAGING", "SET_ENVIRONMENT_STAGING", "ENV_PROD", "SET_ENVIRONMENT_PROD", "requestSessionId", "sessionId", "receiveOffer", "offer", "productId", "state", "frequencyConfig", "makeProductFrequenciesSelector", "prepaidSellingPlans", "makePrepaidSellingPlansSelector", "RECEIVE_OFFER", "fetchResponseError", "FETCH_RESPONSE_ERROR", "requestOffer", "module", "DEFAULT_OFFER_MODULE", "REQUEST_OFFER", "fetchOffer", "checkout", "CHECKOUT", "requestCreateOneTime", "order", "quantity", "offerId", "REQUEST_CREATE_IU_ORDER", "receiveCreateOneTime", "CREATE_ONE_TIME", "requestConvertOneTimeToSubscription", "item", "frequency", "REQUEST_CONVERT_ONE_TIME", "receiveConvertOneTime", "CONVERT_ONE_TIME", "createIu", "subscribed", "initialFrequency", "previewUpsellOffer", "frequencies", "frequenciesEveryPeriod", "safeOgFrequency", "setLocale", "SET_LOCALE", "setConfig", "SET_CONFIG", "setBenefitMessages", "SET_BENEFIT_MESSAGES", "addTemplate", "selector", "markup", "config", "ADD_TEMPLATE", "setTemplates", "templates", "SET_TEMPLATES", "setFirstOrderPlaceDate", "firstOrderPlaceDate", "SET_FIRST_ORDER_PLACE_DATE", "setProductToSubscribe", "productToSubscribe", "SET_PRODUCT_TO_SUBSCRIBE", "receiveMerchantSettings", "settings", "RECEIVE_MERCHANT_SETTINGS", "STORE_ROOT", "safeParseState", "__name", "serializedState", "isPreviewMode", "loadState", "serializeState", "state", "saveState", "listenLocalStorageChanges", "store", "ev", "key", "newValue", "LOCAL_STORAGE_CLEAR", "requestSessionId", "LOCAL_STORAGE_CHANGE", "import_throttle_debounce", "dispatchEvent", "__name", "name", "detail", "el", "dispatchOptinChangedEvent", "optedIn", "productId", "components", "conditionals", "type", "OPTIN_PRODUCT", "PRODUCT_CHANGE_FREQUENCY", "OPTOUT_PRODUCT", "dispatchMiddleware", "store", "next", "action", "state", "conditional", "expression", "offerEvents", "_store", "_a", "ev", "RECEIVE_OFFER", "localStorageMiddleware", "callToSave", "saveState", "LOCAL_STORAGE_CHANGE", "waitFor", "__name", "resolve", "reject", "yes", "no", "waitUntilOffersReady", "store", "waitForSetEnv", "resolveEnv", "waitForMerchantId", "resolveMerchantId", "waitForSessionId", "resolveSessionId", "merchantId", "sessionId", "createSessionId", "waitForReady", "_a", "READY", "listenLocalStorageChanges", "fetchAuth", "next", "action", "SET_ENVIRONMENT_LOCAL", "SET_ENVIRONMENT_DEV", "SET_ENVIRONMENT_STAGING", "SET_ENVIRONMENT_PROD", "SET_MERCHANT_ID", "CREATED_SESSION_ID", "offerRequestMiddleware", "store", "next", "action", "REQUEST_OFFER", "merchantId", "sessionId", "apiUrl", "productId", "safeProductId", "api_default", "DEFAULT_OFFER_MODULE", "response", "receiveOffer", "err", "fetchResponseError", "fetchDone", "__name", "import_murmurhash_js", "getVariantIx", "key", "variants", "variant", "b", "n", "murmur", "lower_bound", "i", "v", "upper_bound", "__name", "experimentsReducer", "state", "action", "_a", "RECEIVE_MERCHANT_SETTINGS", "SET_EXPERIMENT_VARIANT", "resolveShopifySetupProductWhenExperiment", "product", "experimentSettings", "sellingPlanGroups", "isExperimentSellingPlanGroup", "sellingPlanGroup", "app_id", "selling_plan_allocations", "it", "selling_plan_group_id", "getAssignedExperimentVariant", "sessionId", "experimentPublicId", "index", "experimentsMiddleware", "store", "waitForReady", "resolveReady", "waitFor", "next", "READY", "REQUEST_OFFER", "SETUP_PRODUCT", "newProduct", "makeStore", "reducer", "extraMiddlewares", "isPreviewMode", "composeEnhancers", "compose", "middlewares", "waitUntilOffersReady", "es_default", "experimentsMiddleware", "offerRequestMiddleware", "dispatchMiddleware", "offerEvents", "initial", "loadState", "localStorageMiddleware", "enhancer", "applyMiddleware", "it", "store", "createStore", "__name", "createIsMessageAllowed", "__name", "allowedOrigin", "ev", "createBroadcastMessage", "opener", "ogType", "data", "target", "offersLiveEditor", "og", "handleReady", "isMessageAllowed", "broadcastMessage", "options", "publicPath", "initializeClient", "storeInstance", "defaultMapDispatchToProps", "__name", "dispatch", "resolveStore", "_obj", "createRecalcProps", "mapStateToProps", "mapDispatchToProps", "obj", "getState", "stateProps", "dispatchProps", "connect", "baseElement", "recalcProps", "bindActionCreators", "name", "old", "value", "setStore", "_store", "getProductsForPurchasePost", "__name", "state", "productIds", "optin", "purchasePostObject", "parseFrequency", "getObjectStructuredProductPlans", "productPlans", "adaptedProductPlans", "productVariant", "productPlanOnArrayStructure", "frequencyAsKey", "arrayPrices", "newProductPlanStructure", "isCEPolyfill", "removeNodes", "__name", "container", "start", "end", "n", "marker", "nodeMarker", "markerRegex", "boundAttributeSuffix", "Template", "result", "element", "nodesToRemove", "stack", "walker", "lastPartIndex", "index", "partIndex", "strings", "length", "node", "attributes", "count", "i", "endsWith", "stringForPart", "name", "lastAttributeNameRegex", "attributeLookupName", "attributeValue", "statics", "data", "parent", "lastIndex", "insert", "s", "createMarker", "match", "n", "__name", "str", "suffix", "isTemplatePartActive", "part", "walkerNodeFilter", "removeNodesFromTemplate", "template", "nodesToRemove", "content", "parts", "walker", "partIndex", "nextActiveIndexInTemplateParts", "part", "nodeIndex", "removeCount", "nodesToRemoveInTemplate", "currentRemovingNode", "node", "n", "__name", "countNodes", "count", "startIndex", "i", "isTemplatePartActive", "insertNodeIntoTemplate", "refNode", "insertCount", "walkerIndex", "directives", "directive", "__name", "f", "args", "d", "isDirective", "o", "noChange", "nothing", "TemplateInstance", "template", "processor", "options", "values", "i", "part", "fragment", "isCEPolyfill", "stack", "parts", "walker", "partIndex", "nodeIndex", "node", "isTemplatePartActive", "__name", "policy", "s", "commentMarker", "marker", "TemplateResult", "strings", "values", "type", "processor", "l", "html", "isCommentBinding", "commentOpen", "attributeMatch", "lastAttributeNameRegex", "nodeMarker", "boundAttributeSuffix", "template", "value", "__name", "isPrimitive", "__name", "value", "isIterable", "AttributeCommitter", "element", "name", "strings", "AttributePart", "l", "parts", "v", "text", "i", "part", "t", "committer", "noChange", "isDirective", "directive", "NodePart", "options", "container", "createMarker", "ref", "TemplateResult", "nothing", "node", "valueAsString", "template", "TemplateInstance", "instance", "fragment", "itemParts", "partIndex", "itemPart", "item", "startNode", "removeNodes", "BooleanAttributePart", "PropertyCommitter", "PropertyPart", "eventOptionsSupported", "EventPart", "eventName", "eventContext", "e", "newListener", "oldListener", "shouldRemoveListener", "shouldAddListener", "getOptions", "event", "o", "templateFactory", "result", "templateCache", "templateCaches", "template", "key", "marker", "Template", "__name", "parts", "render", "__name", "result", "container", "options", "part", "removeNodes", "NodePart", "templateFactory", "DefaultTemplateProcessor", "element", "name", "strings", "options", "prefix", "PropertyCommitter", "EventPart", "BooleanAttributePart", "AttributeCommitter", "NodePart", "__name", "defaultTemplateProcessor", "html", "__name", "strings", "values", "TemplateResult", "defaultTemplateProcessor", "getTemplateCacheKey", "__name", "type", "scopeName", "compatibleShadyCSSVersion", "shadyTemplateFactory", "result", "cacheKey", "templateCache", "templateCaches", "template", "key", "marker", "element", "Template", "TEMPLATE_TYPES", "removeStylesFromLitTemplates", "templates", "content", "styles", "s", "removeNodesFromTemplate", "shadyRenderSet", "prepareTemplateStyles", "renderedDOM", "templateElement", "length", "condensedStyle", "i", "style", "insertNodeIntoTemplate", "removes", "render", "container", "options", "hasRendered", "parts", "needsScoping", "firstScopeRender", "renderContainer", "part", "TemplateInstance", "removeNodes", "prop", "_obj", "defaultConverter", "value", "type", "notEqual", "__name", "old", "defaultPropertyDeclaration", "STATE_HAS_UPDATED", "STATE_UPDATE_REQUESTED", "STATE_IS_REFLECTING_TO_ATTRIBUTE", "STATE_IS_REFLECTING_TO_PROPERTY", "finalized", "UpdatingElement", "attributes", "v", "p", "attr", "superProperties", "k", "name", "options", "key", "descriptor", "oldValue", "superCtor", "props", "propKeys", "attribute", "hasChanged", "converter", "fromAttribute", "res", "_v", "ctor", "attrValue", "propName", "shouldRequestUpdate", "result", "shouldUpdate", "changedProperties", "e", "_changedProperties", "_a", "ElementProto", "legacyMatches", "supportsAdoptingStyleSheets", "constructionToken", "CSSResult", "cssText", "safeToken", "__name", "unsafeCSS", "value", "textFromCSSResult", "css", "strings", "values", "acc", "v", "idx", "renderNotImplemented", "LitElement", "UpdatingElement", "userStyles", "addStyles", "__name", "styles", "set", "s", "v", "supportsAdoptingStyleSheets", "cssText", "css", "rule", "unsafeCSS", "changedProperties", "templateResult", "style", "render", "import_logical_expression_parser", "sanitizeFrequencyString", "__name", "value", "matchDwm", "buildProduct", "element", "resolveProduct", "__name", "element", "product", "buildProduct", "offer", "resolveOffer", "ref", "withOfferTemplate", "Base", "withProduct", "withChildOptions", "options", "isSelected", "it", "value", "sanitizeFrequencyString", "text", "descriptors_exports", "__export", "autoshipByDefault", "eligibilityGroups", "eligible", "hasPrepaidOptions", "hasUpcomingOrder", "hasUpsellGroup", "inStock", "optedout", "prepaidEligible", "prepaidSubscribed", "regularEligible", "subscribed", "subscriptionEligible", "upcomingOrderContainsProduct", "upsellEligible", "inStock", "__name", "state", "ownProps", "eligible", "autoshipByDefault", "subscriptionEligible", "eligibilityGroups", "productId", "safeProductId", "hasUpsellGroup", "groups", "it", "prepaidEligible", "ELIGIBILITY_GROUPS", "subscribed", "makeSubscribedSelector", "optedout", "makeOptedoutSelector", "prepaidSubscribed", "makePrepaidSubscribedSelector", "hasPrepaidOptions", "makeProductPrepaidShipmentOptionsSelector", "hasUpcomingOrder", "upcomingOrderContainsProduct", "upsellEligible", "_a", "regularEligible", "removeWhitespace", "__name", "str", "When", "withProduct", "LitElement", "html", "test", "expression", "key", "descriptors_exports", "changedProperties", "mapStateToProps", "state", "ConnectedWhen", "connect", "product", "value", "defaultFrequency", "isFrequencyValid", "subscribed", "auth", "withTemplate", "__name", "Base", "template", "markup", "tmpl", "selector", "val", "TemplateElement", "LitElement", "OptinStatus", "withProduct", "TemplateElement", "subscribed", "css", "changed", "html", "__name", "mapStateToProps", "state", "ownProps", "_a", "_b", "makeOptedinSelector", "makeProductFrequencyOptedInSelector", "makeProductSpecificDefaultFrequencySelector", "makeProductPrepaidShipmentsOptedInSelector", "makeProductDefaultFrequencySelector", "getFallbackValue", "makeProductFrequencyOptionsSelector", "templatesSelector", "makeProductFrequenciesSelector", "ConnectedOptinStatus", "connect", "OptinButton", "OptinStatus", "defaultFrequency", "changed", "platform_default", "buttonFreq", "frequencyToSellingPlan", "freq", "ev", "resolveProduct", "html", "__name", "ConnectedOptinButton", "connect", "mapStateToProps", "optinProduct", "OptoutButton", "OptinStatus", "ev", "html", "__name", "ConnectedOptoutButton", "connect", "mapStateToProps", "optoutProduct", "frequencyText", "__name", "frequency", "initial", "every", "period", "parseFrequency", "html", "FrequencyStatus", "withProduct", "TemplateElement", "subscribed", "defaultFrequency", "parseFrequenciesList", "css", "mapStateToProps", "state", "ownProps", "_a", "_b", "makeOptedinSelector", "makeProductFrequencyOptedInSelector", "makeProductSpecificDefaultFrequencySelector", "makeProductFrequencyOptionsSelector", "getFallbackValue", "makeProductDefaultFrequencySelector", "templatesSelector", "makeProductFrequenciesSelector", "ConnectedFrequencyStatus", "connect", "OptinSelect", "withChildOptions", "OptinStatus", "defaultFrequency", "css", "value", "_a", "childOptions", "options", "frequenciesText", "option", "ix", "frequencyText", "html", "__name", "ConnectedOptinSelect", "connect", "state", "ownProps", "mapStateToProps", "makeProductFrequencyOptionsSelector", "getFallbackValue", "productChangeFrequency", "optoutProduct", "UpsellButton", "withProduct", "TemplateElement", "css", "auth", "changed", "modal", "html", "__name", "mapStateToProps", "state", "ConnectedUpsellButton", "connect", "fetchOrders", "createIu", "concludeUpsell", "UpsellModal", "withProduct", "TemplateElement", "defaultFrequency", "auth", "html", "val", "freq", "__name", "mapStateToProps", "state", "ownProps", "_a", "makeOptedinSelector", "makeProductFrequencyOptedInSelector", "makeProductDefaultFrequencySelector", "getFallbackValue", "ConnectedUpsellModal", "connect", "concludeUpsell", "createIu", "OptinToggle", "OptinStatus", "css", "ev", "html", "__name", "ConnectedOptinToggle", "connect", "mapStateToProps", "optoutProduct", "optinProduct", "pluralize", "__name", "word", "count", "Text", "withOfferTemplate", "LitElement", "key", "i18n", "text", "html", "mapStateToProps", "state", "ConnectedText", "connect", "DiscountAmount", "value", "__name", "DiscountPercent", "ShippingDiscountPercent", "DISCOUNT_PERCENT", "DISCOUNT_AMOUNT", "TOTAL_PRICE", "SHIPPING_TOTAL", "SUB_TOTAL", "discountBuilder", "field", "object", "type", "available", "it", "isMatchingIncentive", "incentive", "incentiveValue", "incentiveClass", "discountBuilder", "__name", "preferredIncentiveStandards", "INCENTIVE_STANDARD_TYPES", "IncentiveText", "withProduct", "LitElement", "incentiveClass", "incentiveValue", "incentiveType", "incentivesOfType", "preferredIncentives", "incentive", "isMatchingIncentive", "html", "discountBuilder", "__name", "mapStateToProps", "state", "ownProps", "_a", "safeProductId", "ConnectedIncentiveText", "connect", "previousValues", "unsafeHTML", "directive", "value", "part", "NodePart", "previousValue", "isPrimitive", "template", "fragment", "BenefitMessages", "withProduct", "LitElement", "_a", "html", "msg", "unsafeHTML", "__name", "mapStateToProps", "state", "ownProps", "makeBenefitMessagesSelector", "ConnectedBenefitMessages", "connect", "SelectFrequency", "withChildOptions", "FrequencyStatus", "css", "val", "_a", "_b", "_c", "_d", "options", "isSelected", "result", "frequencyToSellingPlan", "_", "value", "defaultFrequency", "ix", "text", "frequenciesEveryPeriod", "frequenciesText", "frequencyText", "html", "__name", "ConnectedSelectFrequency", "connect", "mapStateToProps", "productChangeFrequency", "validParts", "formatDate", "__name", "date", "format", "it", "part", "value", "validParts", "dateInParts", "result", "FormattedDate", "LitElement", "html", "formatDate", "__name", "mapStateToProps", "state", "ConnectedNextUpcomingOrder", "connect", "import_lodash", "setPreviewStandardOffer", "__name", "isPreview", "productId", "offer", "dispatch", "SET_PREVIEW_STANDARD_OFFER", "UNAUTHORIZED", "setBenefitMessages", "receiveOffer", "mergeProductPlansToState", "state", "newProductPlans", "key", "value", "mergedArray", "uniqueArray", "item", "setPreviewUpsellOffer", "getState", "SET_PREVIEW_UPSELL_OFFER", "merchantId", "receiveOrders", "authorize", "unauthorized", "setPreviewPrepaid", "existingProductPlans", "SET_PREVIEW_PREPAID_OFFER", "RECEIVE_PRODUCT_PLANS", "getObjectStructuredProductPlans", "SET_CONFIG", "setPreview", "oldValue", "_getState", "LOCAL_STORAGE_CLEAR", "optinProduct", "memoizeKey", "__name", "args", "logOnce", "messageFn", "hasLogged", "logMulticurrencyWarning", "storeCurrency", "primaryCurrency", "logProductSpecificFrequencyListWarning", "productAndComponents", "memoize", "product", "components", "Offer", "TemplateElement", "auth", "preview", "it", "css", "template", "variationId", "locale", "event", "changed", "onReady", "DEFAULT_OFFER_MODULE", "newProductWithComponents", "oldProductWithComponents", "isSameProduct", "html", "storeFrequency", "freq", "attributeValue", "key", "attrName", "kebabCase", "attr", "mapStateToProps", "state", "ownProps", "_a", "makeProductDefaultFrequencySelector", "makeProductFrequencyOptedInSelector", "makeProductSpecificDefaultFrequencySelector", "getFallbackValue", "autoshipSelector", "makeOptedoutSelector", "optedinSelector", "makeOptedinSelector", "templatesSelector", "ConnectedOffer", "connect", "fetchOffer", "fetchOrders", "productHasChangedComponents", "optinProduct", "setFirstOrderPlaceDate", "setProductToSubscribe", "setPreview", "Modal", "LitElement", "css", "html", "__name", "previousValues", "ifDefined", "directive", "value", "part", "previousValue", "AttributePart", "name", "Select", "LitElement", "css", "html", "__name", "ev", "ifDefined", "option", "ACTIVATION_TYPES", "Tooltip", "LitElement", "css", "signal", "triggerRect", "content", "contentRect", "event", "triggerLabel", "html", "ifDefined", "__name", "PrepaidStatus", "withProduct", "LitElement", "getDefaultPrepaidOption", "value", "valueAsNumber", "html", "__name", "mapStateToProps", "state", "ownProps", "makeProductPrepaidShipmentOptionsSelector", "makeProductPrepaidShipmentsOptedInSelector", "makePrepaidShipmentsSelectedSelector", "ConnectedPrepaidStatus", "connect", "productChangePrepaidShipments", "PrepaidToggle", "PrepaidStatus", "css", "html", "displayOptions", "value", "e", "__name", "mapStateToProps", "state", "ownProps", "makeProductPrepaidShipmentOptionsSelector", "makeProductPrepaidShipmentsOptedInSelector", "makePrepaidShipmentsSelectedSelector", "ConnectedPrepaidToggle", "connect", "productChangePrepaidShipments", "PrepaidData", "PrepaidStatus", "css", "realProductId", "safeProductId", "plans", "targetShipments", "currentPlan", "plan", "discountRate", "subscriptionPrice", "prepaidShipments", "regularPrepaidPrice", "prepaidSavingsPerShipment", "prepaidSavingsTotal", "prepaidExtraSavingsPercentage", "value", "html", "__name", "mapStateToProps", "state", "ownProps", "makeProductPrepaidShipmentOptionsSelector", "makeProductPrepaidShipmentsOptedInSelector", "makePrepaidShipmentsSelectedSelector", "ConnectedPrepaidData", "connect", "PrepaidButton", "PrepaidStatus", "css", "ev", "html", "__name", "mapStateToProps", "state", "ownProps", "makeProductPrepaidShipmentOptionsSelector", "makeProductPrepaidShipmentsOptedInSelector", "makePrepaidShipmentsSelectedSelector", "ConnectedPrepaidButton", "connect", "productChangePrepaidShipments", "PrepaidSelect", "PrepaidStatus", "css", "html", "displayOptions", "value", "e", "__name", "mapStateToProps", "state", "ownProps", "makeProductPrepaidShipmentOptionsSelector", "makeProductPrepaidShipmentsOptedInSelector", "makePrepaidShipmentsSelectedSelector", "ConnectedPrepaidSelect", "connect", "productChangePrepaidShipments", "SubscriptionButton", "OptinButton", "ev", "payAsYouGoFrequency", "resolveProduct", "html", "__name", "ConnectedSubscriptionButton", "connect", "mapStateToProps", "optinProduct", "TestWizard", "LitElement", "css", "element", "state", "productAttribute", "locationAttribute", "result", "messages", "inStock", "autoshipEligible", "html", "ix", "message", "ev", "offer", "autoship", "groups", "productId", "receiveOffer", "receiveItems", "__name", "run_tests_default", "name", "TestWizard", "modal", "__name", "keys", "enable", "__name", "keysCounter", "currentkeys", "run_tests_default", "Price", "withProduct", "TemplateElement", "css", "_a", "_b", "realProductId", "safeProductId", "frequency", "plans", "currentPlan", "plan", "regularPrice", "discountRate", "subscriptionPrice", "value", "html", "__name", "mapStateToProps", "state", "ownProps", "makeProductDefaultFrequencySelector", "makeProductFrequencyOptedInSelector", "makeDiscountedProductPriceSelector", "Price_default", "connect", "makeApi", "store", "enable", "setStore", "ConnectedWhen", "ConnectedText", "ConnectedIncentiveText", "ConnectedBenefitMessages", "ConnectedOffer", "ConnectedSelectFrequency", "ConnectedOptoutButton", "ConnectedOptinToggle", "ConnectedOptinStatus", "ConnectedOptinButton", "ConnectedOptinSelect", "ConnectedUpsellButton", "ConnectedFrequencyStatus", "Modal", "Select", "Tooltip", "ConnectedUpsellModal", "ConnectedNextUpcomingOrder", "Price_default", "ConnectedPrepaidToggle", "ConnectedPrepaidData", "ConnectedPrepaidButton", "ConnectedPrepaidSelect", "ConnectedSubscriptionButton", "isReady", "offers", "e", "setEnvironment", "m", "setMerchantId", "authUrl", "setAuthUrl", "settings", "receiveMerchantSettings", "productIds", "getProductsForPurchasePost", "checkout", "fn", "set", "configuration", "setConfig", "locale", "setLocale", "messages", "setBenefitMessages", "tagName", "content", "configOption", "addTemplate", "templates", "setTemplates", "_publicPath", "merchantId", "env", "storeInstance", "platform_default", "products", "state", "sessionId", "product", "requestOffer", "RECEIVE_PRODUCT_PLANS", "merchantSettings", "_a", "h", "__name", "optedin", "__name", "state", "action", "LOCAL_STORAGE_CLEAR", "LOCAL_STORAGE_CHANGE", "OPTIN_PRODUCT", "PRODUCT_CHANGE_FREQUENCY", "prepaidShipments", "oldone", "rest", "getMatchingProductIfExists", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "payload", "newState", "OPTOUT_PRODUCT", "a", "isSameProduct", "PRODUCT_HAS_CHANGED", "product", "CONVERT_ONE_TIME", "CHECKOUT", "optedout", "nextUpcomingOrder", "type", "RECEIVE_ORDERS", "RECEIVE_ORDER_ITEMS", "it", "CREATE_ONE_TIME", "autoshipEligible", "RECEIVE_OFFER", "inStock", "REQUEST_OFFER", "eligibilityGroups", "mapIncentive", "incentive", "incentiveDisplay", "incentiveDisplayEnhanced", "i", "enhanced", "INCENTIVE_STANDARD_TYPES", "incentives", "obj", "uniqueProductId", "productId", "incentiveObj", "initial", "ongoing", "frequency", "safeProductId", "auth", "AUTHORIZE", "UNAUTHORIZED", "merchantId", "SET_MERCHANT_ID", "authUrl", "SET_AUTH_URL", "offer", "offerId", "sessionId", "CREATED_SESSION_ID", "productOffer", "key", "acc", "object", "firstOrderPlaceDate", "SET_FIRST_ORDER_PLACE_DATE", "productToSubscribe", "SET_PRODUCT_TO_SUBSCRIBE", "environment", "SET_ENVIRONMENT_LOCAL", "SET_ENVIRONMENT_STAGING", "ENV_STAGING", "SET_ENVIRONMENT_DEV", "ENV_DEV", "SET_ENVIRONMENT_PROD", "ENV_PROD", "locale", "SET_LOCALE", "config", "SET_CONFIG", "stringifyFrequency", "RECEIVE_MERCHANT_SETTINGS", "previewStandardOffer", "SET_PREVIEW_STANDARD_OFFER", "previewUpsellOffer", "SET_PREVIEW_UPSELL_OFFER", "autoshipByDefault", "__name", "state", "action", "RECEIVE_OFFER", "defaultFrequencies", "templates", "SET_TEMPLATES", "ADD_TEMPLATE", "productPlans", "RECEIVE_PRODUCT_PLANS", "getObjectStructuredProductPlans", "prepaidShipmentsSelected", "CART_PRODUCT_KEY_HAS_CHANGED", "preservedPrepaidShipments", "stateWithoutOldCartProductKey", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "price", "_action", "benefitMessages", "SET_BENEFIT_MESSAGES", "reducer_default", "combineReducers", "optedin", "optedout", "nextUpcomingOrder", "autoshipEligible", "inStock", "eligibilityGroups", "incentives", "frequency", "auth", "merchantId", "authUrl", "offer", "offerId", "experimentsReducer", "sessionId", "productOffer", "firstOrderPlaceDate", "productToSubscribe", "environment", "locale", "config", "previewStandardOffer", "previewUpsellOffer", "isPrepaidAllocation", "__name", "allocation", "_a", "_b", "option", "getPrepaidShipmentsNumberFromOptions", "options", "shipmentAmountArray", "getAllocationFrequency", "getAllocationRegularPrice", "currency", "money", "getAllocationSubscriptionPrice", "prepaidShipmentsPerBilling", "pricePerShipment", "getPrepaidPercentage", "getAllocationDiscountRate", "_c", "prepaidPercentageSavings", "percentage", "formatted_discount", "getAllocationNumberOfShipments", "addPrepaidPriceAndSavings", "productPlan", "payAsYouGoPlan", "prepaidSaving", "payAsYouGoAdjustment", "payAsYouGoPercentage", "mapSellingPlanToDiscount", "sellingPlans", "plan", "getPayAsYouGoSellingPlan", "sellingPlanAllocationsReducer", "acc", "cur", "getSellingPlans", "product", "allGroups", "group", "selling_plan", "config", "__name", "state", "action", "_a", "SETUP_PRODUCT", "product", "currency", "configToAdd", "productFrequencies", "acc", "variant", "reduceSellingPlansToFrequencies", "updatedProductFrequencies", "prepaidSellingPlans", "getPrepaidSellingPlans", "RECEIVE_OFFER", "offerEl", "defaultFrequency", "productId", "safeProductId", "currentProductFrequencies", "getUpdatedDefaultFrequency", "RECEIVE_MERCHANT_SETTINGS", "getFrequencies", "productSellingPlanGroups", "_b", "sellingPlanGroup", "getPayAsYouGoSellingPlanGroup", "frequencies", "sellingPlansToFrequencies", "frequenciesEveryPeriod", "sellingPlansToEveryPeriod", "frequenciesText", "isOgFrequency", "mapFrequencyToSellingPlan", "getFirstSellingPlan", "sellingPlanGroups", "sellingPlanGroupIdsForProduct", "allocation", "applicableSellingPlanGroups", "group", "offerElementDefaultFrequency", "sellingPlan", "prepaidSellingPlanGroups", "cur", "sellingPlanInfo", "sellingPlanObject", "getPrepaidShipments", "config_default", "overrideLineKey", "__name", "state", "productId", "newValue", "keys", "it", "acc", "cur", "getDefaultSellingPlan", "sellingPlans", "frequenciesEveryPeriod", "defaultFrequency", "isOgFrequency", "hasShopifySellingPlans", "sellingPlan", "mapFrequencyToSellingPlan", "getFirstSellingPlan", "mapExistingOptinsFromOfferResponse", "offerEl", "frequencyConfig", "reduceNewOptinsFromOfferResponse", "autoship", "autoship_by_default", "default_frequencies", "in_stock", "eligibility_groups", "existingOptins", "prepaidSellingPlans", "id", "_a", "getOptInDefaultFrequency", "ELIGIBILITY_GROUPS", "prepaidPlan", "getDefaultPrepaidOption", "PREPAID_PLACEHOLDER", "psdf", "frequency", "productOrVariantInStockReducer", "reduceProductCartLine", "safeProductId", "autoshipEligible", "action", "SETUP_CART", "cart", "SETUP_PRODUCT", "product", "applicableSellingPlanGroups", "getPayAsYouGoSellingPlanGroups", "ogSellingPlanIds", "group", "_b", "isAutoshipEligible", "SET_PREVIEW_STANDARD_OFFER", "inStock", "REQUEST_OFFER", "offer", "_action", "getOptedInItem", "cartItem", "prepaidShipments", "getPrepaidShipments", "item", "optedin", "RECEIVE_OFFER", "payload", "newOptins", "sellingPlanGroup", "getPayAsYouGoSellingPlanGroup", "getPrepaidSellingPlans", "frequencies", "sellingPlansToFrequencies", "sellingPlansToEveryPeriod", "curr", "prepaidSellingPlansForVariant", "numberShipments", "i", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "newState", "oldone", "rest", "getMatchingProductIfExists", "price", "productOffer", "productPlans", "currency", "getSellingPlans", "accumulator", "current", "sellingPlanAllocationsReducer", "reducer", "combineReducers", "auth", "authUrl", "autoshipByDefault", "config_default", "defaultFrequencies", "eligibilityGroups", "environment", "firstOrderPlaceDate", "incentives", "locale", "merchantId", "nextUpcomingOrder", "offerId", "experimentsReducer", "optedout", "previewStandardOffer", "previewUpsellOffer", "productToSubscribe", "sessionId", "templates", "prepaidShipmentsSelected", "benefitMessages", "shopifyReducer", "reducer_default", "import_lodash", "import_throttle_debounce", "updateTrackingInputs", "product_id", "name", "value", "store2FormElementSelector", "store1FormElementSelector", "cartAddFormElements", "cartAddFormElement", "parent", "input", "__name", "getTrackingKey", "addDefaultToSubTracking", "action", "store", "_a", "_b", "_c", "_d", "productId", "key", "location", "variation", "frequency", "getSubscribedFrequency", "inputValue", "OPTIN_PRODUCT", "shopifyTrackingMiddleware", "next", "OPTOUT_PRODUCT", "PRODUCT_CHANGE_FREQUENCY", "offerElement", "trackingEvent", "getTrackingEvent", "RECEIVE_OFFER", "_a", "_b", "SHOPIFY_ROOT", "CART_PAGE_URL", "CART_JS_URL", "CART_CHANGE_URL", "CART_UPDATE_URL", "PRODUCTS_URL", "OFFER_ATTRIBUTE_NAME", "DEFAULT_SHOPIFY_CART_AJAX_SECTIONS", "makeSyncProductId", "__name", "offer", "form", "id", "getCurrency", "windowCurrency", "getCart", "setupPdp", "store", "handle", "guessProductHandle", "product", "currency", "getProduct", "payload", "SETUP_PRODUCT", "err", "ref", "syncProductId", "e", "it", "acc", "cur", "memoize", "setupCart", "cart", "items", "cartPayload", "SETUP_CART", "productAsCartLine", "synchronizeCartOptin", "action", "offerElement", "selling_plan", "getSubscribedFrequency", "trackingEvent", "getTrackingEvent", "sectionsToUpdate", "key", "offerIx", "item", "qty", "productId", "safeProductId", "offerIdAttribute", "getOfferIdAttribute", "attributes", "changeRes", "el", "newCart", "newKey", "line", "CART_PRODUCT_KEY_HAS_CHANGED", "newCartPayload", "cartUpdateEvent", "CART_UPDATED_EVENT", "sections", "sectionElement", "sectionId", "sectionRawHtml", "product_id", "getTrackingKey", "location", "variation", "value", "REQUEST_OFFER", "OPTOUT_PRODUCT", "OPTIN_PRODUCT", "PRODUCT_CHANGE_FREQUENCY", "optin", "makeSubscribedSelector", "state", "isShopifyDiscountFunctionInUseSelector", "synchronizeSellingPlan", "productIdInput", "sellingPlanId", "getOrCreateHidden", "shopifyMiddleware", "next", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "RECEIVE_OFFER", "SHOPIFY_OG_AUTH_ENDPOINT", "SHOPIFY_OG_AUTH_BEGIN", "SHOPIFY_OG_AUTH_END", "parseIntegrationTempAuth", "__name", "raw", "id", "timestamp", "signature", "email", "authorizeShopifyCustomer", "store", "_a", "merchantId", "resolveEnvAndMerchant", "script", "getMainJs", "customer", "val", "getOrCreateAuthCookie", "sig_field", "ts", "sig", "authorize", "clearCookie", "fetchOGSignature", "data", "beginningIndex", "err", "ogAuthCookie", "getCookieValue", "customerId", "ogToday", "binarySignature", "value", "_a", "store", "makeStore", "platform_default", "shopifyReducer", "shopifyMiddleware", "reducer_default", "shopifyTrackingMiddleware", "offers", "makeApi", "isReady", "addOptinChangedCallback", "addTemplate", "clear", "config", "disableOptinChangedCallbacks", "getOptins", "getProductsForPurchasePost", "initialize", "previewMode", "register", "resolveSettings", "setAuthUrl", "setBenefitMessages", "setEnvironment", "setLocale", "setMerchantId", "setPublicPath", "setTemplates", "setupCart", "setupProduct", "setupProducts", "autoInit", "__name", "autoInitializeOffers", "src_default", "offers", "_a", "platform_default", "onReady", "authorizeShopifyCustomer"]
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {boolean} [noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds while the\n * throttled-function is being called. If noTrailing is false or unspecified, callback will be executed one final time\n * after the last throttled-function call. (After the throttled-function has not been called for `delay` milliseconds,\n * the internal counter is reset).\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the throttled-function is executed.\n * @param {boolean} [debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is false (at end),\n * schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nexport default function(delay, noTrailing, callback, debounceMode) {\n\t/*\n\t * After wrapper has stopped being called, this timeout ensures that\n\t * `callback` is executed at the proper times in `throttle` and `end`\n\t * debounce modes.\n\t */\n\tlet timeoutID;\n\tlet cancelled = false;\n\n\t// Keep track of the last time `callback` was executed.\n\tlet lastExec = 0;\n\n\t// Function to clear existing timeout\n\tfunction clearExistingTimeout() {\n\t\tif (timeoutID) {\n\t\t\tclearTimeout(timeoutID);\n\t\t}\n\t}\n\n\t// Function to cancel next exec\n\tfunction cancel() {\n\t\tclearExistingTimeout();\n\t\tcancelled = true;\n\t}\n\n\t// `noTrailing` defaults to falsy.\n\tif (typeof noTrailing !== 'boolean') {\n\t\tdebounceMode = callback;\n\t\tcallback = noTrailing;\n\t\tnoTrailing = undefined;\n\t}\n\n\t/*\n\t * The `wrapper` function encapsulates all of the throttling / debouncing\n\t * functionality and when executed will limit the rate at which `callback`\n\t * is executed.\n\t */\n\tfunction wrapper(...arguments_) {\n\t\tlet self = this;\n\t\tlet elapsed = Date.now() - lastExec;\n\n\t\tif (cancelled) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Execute `callback` and update the `lastExec` timestamp.\n\t\tfunction exec() {\n\t\t\tlastExec = Date.now();\n\t\t\tcallback.apply(self, arguments_);\n\t\t}\n\n\t\t/*\n\t\t * If `debounceMode` is true (at begin) this is used to clear the flag\n\t\t * to allow future `callback` executions.\n\t\t */\n\t\tfunction clear() {\n\t\t\ttimeoutID = undefined;\n\t\t}\n\n\t\tif (debounceMode && !timeoutID) {\n\t\t\t/*\n\t\t\t * Since `wrapper` is being called for the first time and\n\t\t\t * `debounceMode` is true (at begin), execute `callback`.\n\t\t\t */\n\t\t\texec();\n\t\t}\n\n\t\tclearExistingTimeout();\n\n\t\tif (debounceMode === undefined && elapsed > delay) {\n\t\t\t/*\n\t\t\t * In throttle mode, if `delay` time has been exceeded, execute\n\t\t\t * `callback`.\n\t\t\t */\n\t\t\texec();\n\t\t} else if (noTrailing !== true) {\n\t\t\t/*\n\t\t\t * In trailing throttle mode, since `delay` time has not been\n\t\t\t * exceeded, schedule `callback` to execute `delay` ms after most\n\t\t\t * recent execution.\n\t\t\t *\n\t\t\t * If `debounceMode` is true (at begin), schedule `clear` to execute\n\t\t\t * after `delay` ms.\n\t\t\t *\n\t\t\t * If `debounceMode` is false (at end), schedule `callback` to\n\t\t\t * execute after `delay` ms.\n\t\t\t */\n\t\t\ttimeoutID = setTimeout(\n\t\t\t\tdebounceMode ? clear : exec,\n\t\t\t\tdebounceMode === undefined ? delay - elapsed : delay\n\t\t\t);\n\t\t}\n\t}\n\n\twrapper.cancel = cancel;\n\n\t// Return the wrapper function.\n\treturn wrapper;\n}\n", "/* eslint-disable no-undefined */\n\nimport throttle from './throttle';\n\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {boolean} [atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n *\n * @returns {Function} A new, debounced function.\n */\nexport default function(delay, atBegin, callback) {\n\treturn callback === undefined\n\t\t? throttle(delay, atBegin, false)\n\t\t: throttle(delay, callback, atBegin !== false);\n}\n", "/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** `Object#toString` result references. */\nvar funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Checks if `value` is a host object in IE < 9.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a host object, else `false`.\n */\nfunction isHostObject(value) {\n // Many host objects are `Object` objects that can coerce to strings\n // despite having improperly defined `toString` methods.\n var result = false;\n if (value != null && typeof value.toString != 'function') {\n try {\n result = !!(value + '');\n } catch (e) {}\n }\n return result;\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n return this.has(key) && delete this.__data__[key];\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries ? entries.length : 0;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n return getMapData(this, key)['delete'](key);\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n getMapData(this, key).set(key, value);\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to process.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided, it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is used as the map cache key. The `func`\n * is invoked with the `this` binding of the memoized function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the\n * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `delete`, `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoized function.\n * @example\n *\n * var object = { 'a': 1, 'b': 2 };\n * var other = { 'c': 3, 'd': 4 };\n *\n * var values = _.memoize(_.values);\n * values(object);\n * // => [1, 2]\n *\n * values(other);\n * // => [3, 4]\n *\n * object.a = 2;\n * values(object);\n * // => [1, 2]\n *\n * // Modify the result cache.\n * values.cache.set(object, ['a', 'b']);\n * values(object);\n * // => ['a', 'b']\n *\n * // Replace `_.memoize.Cache`.\n * _.memoize.Cache = WeakMap;\n */\nfunction memoize(func, resolver) {\n if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result);\n return result;\n };\n memoized.cache = new (memoize.Cache || MapCache);\n return memoized;\n}\n\n// Assign cache to `_.memoize`.\nmemoize.Cache = MapCache;\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\nmodule.exports = memoize;\n", "/**\n * JS Implementation of MurmurHash3 (r136) (as of May 20, 2011)\n * \n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n * \n * @param {string} key ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash \n */\n\nfunction murmurhash3_32_gc(key, seed) {\n\tvar remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i;\n\t\n\tremainder = key.length & 3; // key.length % 4\n\tbytes = key.length - remainder;\n\th1 = seed;\n\tc1 = 0xcc9e2d51;\n\tc2 = 0x1b873593;\n\ti = 0;\n\t\n\twhile (i < bytes) {\n\t \tk1 = \n\t \t ((key.charCodeAt(i) & 0xff)) |\n\t \t ((key.charCodeAt(++i) & 0xff) << 8) |\n\t \t ((key.charCodeAt(++i) & 0xff) << 16) |\n\t \t ((key.charCodeAt(++i) & 0xff) << 24);\n\t\t++i;\n\t\t\n\t\tk1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;\n\t\tk1 = (k1 << 15) | (k1 >>> 17);\n\t\tk1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;\n\n\t\th1 ^= k1;\n h1 = (h1 << 13) | (h1 >>> 19);\n\t\th1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;\n\t\th1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));\n\t}\n\t\n\tk1 = 0;\n\t\n\tswitch (remainder) {\n\t\tcase 3: k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;\n\t\tcase 2: k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;\n\t\tcase 1: k1 ^= (key.charCodeAt(i) & 0xff);\n\t\t\n\t\tk1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;\n\t\tk1 = (k1 << 15) | (k1 >>> 17);\n\t\tk1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;\n\t\th1 ^= k1;\n\t}\n\t\n\th1 ^= key.length;\n\n\th1 ^= h1 >>> 16;\n\th1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;\n\th1 ^= h1 >>> 13;\n\th1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;\n\th1 ^= h1 >>> 16;\n\n\treturn h1 >>> 0;\n}\n\nif(typeof module !== \"undefined\") {\n module.exports = murmurhash3_32_gc\n}", "/**\n * JS Implementation of MurmurHash2\n * \n * @author <a href=\"mailto:gary.court@gmail.com\">Gary Court</a>\n * @see http://github.com/garycourt/murmurhash-js\n * @author <a href=\"mailto:aappleby@gmail.com\">Austin Appleby</a>\n * @see http://sites.google.com/site/murmurhash/\n * \n * @param {string} str ASCII only\n * @param {number} seed Positive integer only\n * @return {number} 32-bit positive integer hash\n */\n\nfunction murmurhash2_32_gc(str, seed) {\n var\n l = str.length,\n h = seed ^ l,\n i = 0,\n k;\n \n while (l >= 4) {\n \tk = \n \t ((str.charCodeAt(i) & 0xff)) |\n \t ((str.charCodeAt(++i) & 0xff) << 8) |\n \t ((str.charCodeAt(++i) & 0xff) << 16) |\n \t ((str.charCodeAt(++i) & 0xff) << 24);\n \n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n k ^= k >>> 24;\n k = (((k & 0xffff) * 0x5bd1e995) + ((((k >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n\n\th = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16)) ^ k;\n\n l -= 4;\n ++i;\n }\n \n switch (l) {\n case 3: h ^= (str.charCodeAt(i + 2) & 0xff) << 16;\n case 2: h ^= (str.charCodeAt(i + 1) & 0xff) << 8;\n case 1: h ^= (str.charCodeAt(i) & 0xff);\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n }\n\n h ^= h >>> 13;\n h = (((h & 0xffff) * 0x5bd1e995) + ((((h >>> 16) * 0x5bd1e995) & 0xffff) << 16));\n h ^= h >>> 15;\n\n return h >>> 0;\n}\n\nif(typeof module !== undefined) {\n module.exports = murmurhash2_32_gc\n}\n", "var murmur3 = require(\"./murmurhash3_gc.js\")\nvar murmur2 = require(\"./murmurhash2_gc.js\")\n\nmodule.exports = murmur3\nmodule.exports.murmur3 = murmur3\nmodule.exports.murmur2 = murmur2\n", "const TokenType = {\n PAR_OPEN: '('.charCodeAt(0),\n PAR_CLOSE: ')'.charCodeAt(0),\n OP_NOT: '!'.charCodeAt(0),\n BINARY_AND: '&'.charCodeAt(0),\n BINARY_OR: '|'.charCodeAt(0),\n LITERAL: 'LITERAL',\n END: 'END',\n LEAF: 'LEAF',\n ATOMIC: 'ATOMIC'\n};\n\nmodule.exports = TokenType;\n", "const TokenType = require('./token-type');\n\nconst Tokenizer = exp => {\n let literal = '';\n const tokens = [];\n for (const char of exp) {\n const code = char.charCodeAt(0);\n switch (code) {\n case TokenType.PAR_OPEN:\n case TokenType.PAR_CLOSE:\n case TokenType.OP_NOT:\n case TokenType.BINARY_AND:\n case TokenType.BINARY_OR:\n if (literal) {\n tokens.push({\n type: TokenType.LITERAL,\n value: literal\n });\n literal = '';\n }\n\n tokens.push({\n type: code,\n value: char\n });\n break;\n default:\n literal += char;\n }\n }\n\n if (literal)\n tokens.push({\n type: TokenType.LITERAL,\n value: literal\n });\n\n return tokens;\n};\n\nmodule.exports = Tokenizer;\n", "const TokenType = require('./token-type');\n\nconst PolishNotation = tokens => {\n const queue = [];\n const stack = [];\n tokens.forEach(token => {\n switch (token.type) {\n case TokenType.LITERAL:\n queue.unshift(token);\n break;\n case TokenType.BINARY_AND:\n case TokenType.BINARY_OR:\n case TokenType.OP_NOT:\n case TokenType.PAR_OPEN:\n stack.push(token);\n break;\n case TokenType.PAR_CLOSE:\n while (\n stack.length &&\n stack[stack.length - 1].type !== TokenType.PAR_OPEN\n ) {\n queue.unshift(stack.pop());\n }\n\n stack.pop();\n\n if (stack.length && stack[stack.length - 1].type === TokenType.OP_NOT) {\n queue.unshift(stack.pop());\n }\n break;\n default:\n break;\n }\n });\n\n const result = (stack.length && [...stack.reverse(), ...queue]) || queue;\n\n return result;\n};\n\n// \u6CE2\u5170\u5217\u8868\u751F\u6210\u5668\nconst PolishGenerator = function*(polish) {\n for (let index = 0; index < polish.length - 1; index++) {\n yield polish[index];\n }\n\n return polish[polish.length - 1];\n};\n\nmodule.exports = {\n PolishNotation,\n PolishGenerator\n};\n", "const TokenType = require('./token-type');\n\nclass ExpNode {\n constructor(op, left, right, literal) {\n this.op = op;\n this.left = left;\n this.right = right;\n this.literal = literal;\n }\n\n isLeaf() {\n return this.op === TokenType.LEAF;\n }\n\n isAtomic() {\n return (\n this.isLeaf() || (this.op === TokenType.OP_NOT && this.left.isLeaf())\n );\n }\n\n getLiteralValue() {\n return this.literal;\n }\n\n static CreateAnd(left, right) {\n return new ExpNode(TokenType.BINARY_AND, left, right);\n }\n\n static CreateNot(exp) {\n return new ExpNode(TokenType.OP_NOT, exp);\n }\n\n static CreateOr(left, right) {\n return new ExpNode(TokenType.BINARY_OR, left, right);\n }\n\n static CreateLiteral(lit) {\n return new ExpNode(TokenType.LEAF, null, null, lit);\n }\n}\n\n// \u62BD\u8C61\u8BED\u6CD5\u6811\u751F\u6210\nconst make = gen => {\n const data = gen.next().value;\n\n switch (data.type) {\n case TokenType.LITERAL:\n return ExpNode.CreateLiteral(data.value);\n case TokenType.OP_NOT:\n return ExpNode.CreateNot(make(gen));\n case TokenType.BINARY_AND: {\n const left = make(gen);\n const right = make(gen);\n return ExpNode.CreateAnd(left, right);\n }\n case TokenType.BINARY_OR: {\n const left = make(gen);\n const right = make(gen);\n return ExpNode.CreateOr(left, right);\n }\n }\n return null;\n};\n\n// \u8BED\u6CD5\u6811\u6C42\u503C\nconst nodeEvaluator = (tree, literalEvaluator) => {\n if (tree.isLeaf()) {\n return literalEvaluator(tree.getLiteralValue());\n }\n\n if (tree.op === TokenType.OP_NOT) {\n return !nodeEvaluator(tree.left, literalEvaluator);\n }\n\n if (tree.op === TokenType.BINARY_OR) {\n return (\n nodeEvaluator(tree.left, literalEvaluator) ||\n nodeEvaluator(tree.right, literalEvaluator)\n );\n }\n\n if (tree.op === TokenType.BINARY_AND) {\n return (\n nodeEvaluator(tree.left, literalEvaluator) &&\n nodeEvaluator(tree.right, literalEvaluator)\n );\n }\n};\n\nmodule.exports = {\n make,\n nodeEvaluator\n};\n", "const Tokenizer = require('./tokenizer');\nconst Polish = require('./polish');\nconst Node = require('./node');\n\nconst parse = (exp, literalChecker) => {\n const tokens = Tokenizer(exp);\n const polish = Polish.PolishNotation(tokens);\n const gen = Polish.PolishGenerator(polish);\n const tree = Node.make(gen);\n const result = Node.nodeEvaluator(tree, literalChecker);\n return result;\n};\n\nmodule.exports = { parse };\n", "import { makeStore } from './core/store';\nimport makeApi from './make-api';\nimport defaultReducer from './core/reducer';\nimport shopifyReducer from './shopify/shopifyReducer';\nimport shopifyMiddleware from './shopify/shopifyMiddleware';\nimport platform from './platform';\nimport { autoInitializeOffers, onReady } from './core/utils';\nimport { authorizeShopifyCustomer } from './shopify/shopifyBootstrap';\nimport shopifyTrackingMiddleware from './shopify/shopifyTrackingMiddleware';\n\nexport const store = makeStore(\n ...(platform?.shopify_selling_plans ? [shopifyReducer, shopifyMiddleware] : [defaultReducer]),\n platform.shopify && shopifyTrackingMiddleware\n);\n\nexport const offers = makeApi(store);\n\nexport const isReady = offers.isReady;\nexport const addOptinChangedCallback = offers.addOptinChangedCallback;\nexport const addTemplate = offers.addTemplate;\nexport const clear = offers.clear;\nexport const config = offers.config;\nexport const disableOptinChangedCallbacks = offers.disableOptinChangedCallbacks;\nexport const getOptins = offers.getOptins;\nexport const getProductsForPurchasePost = offers.getProductsForPurchasePost;\nexport const initialize = offers.initialize;\nexport const previewMode = offers.previewMode;\nexport const register = offers.register;\nexport const resolveSettings = offers.resolveSettings;\nexport const setAuthUrl = offers.setAuthUrl;\nexport const setBenefitMessages = offers.setBenefitMessages;\nexport const setEnvironment = offers.setEnvironment;\nexport const setLocale = offers.setLocale;\nexport const setMerchantId = offers.setMerchantId;\nexport const setPublicPath = offers.setPublicPath;\nexport const setTemplates = offers.setTemplates;\nexport const setupCart = offers.setupCart;\nexport const setupProduct = offers.setupProduct;\nexport const setupProducts = offers.setupProducts;\nexport const autoInit = () => autoInitializeOffers(offers);\n\nexport { platform };\nexport default offers.initialize;\n/*\n * Attempts to auto initialize the offer library reading the merchantId and env from\n * integration script i.e. <script src=\"http://static.ordergroove....\"/>.\n * Useful when local develop using http redirects\n */\nif (process.env.NODE_ENV === 'development') {\n console.info('%c Ordergroove Offers DEV MODE ', 'background: #222; color: #bada55');\n onReady(autoInit);\n}\n\nif (platform?.shopify_selling_plans) {\n onReady(() => authorizeShopifyCustomer(offers));\n}\n", "export default function symbolObservablePonyfill(root) {\n\tvar result;\n\tvar Symbol = root.Symbol;\n\n\tif (typeof Symbol === 'function') {\n\t\tif (Symbol.observable) {\n\t\t\tresult = Symbol.observable;\n\t\t} else {\n\t\t\tresult = Symbol('observable');\n\t\t\tSymbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n", "/* global window */\nimport ponyfill from './ponyfill.js';\n\nvar root;\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = ponyfill(root);\nexport default result;\n", "import $$observable from 'symbol-observable';\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nvar randomString = function randomString() {\n return Math.random().toString(36).substring(7).split('').join('.');\n};\n\nvar ActionTypes = {\n INIT: \"@@redux/INIT\" + randomString(),\n REPLACE: \"@@redux/REPLACE\" + randomString(),\n PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {\n return \"@@redux/PROBE_UNKNOWN_ACTION\" + randomString();\n }\n};\n\n/**\n * @param {any} obj The object to inspect.\n * @returns {boolean} True if the argument appears to be a plain object.\n */\nfunction isPlainObject(obj) {\n if (typeof obj !== 'object' || obj === null) return false;\n var proto = obj;\n\n while (Object.getPrototypeOf(proto) !== null) {\n proto = Object.getPrototypeOf(proto);\n }\n\n return Object.getPrototypeOf(obj) === proto;\n}\n\n/**\n * Creates a Redux store that holds the state tree.\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n\nfunction createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {\n throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.');\n }\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error('Expected the enhancer to be a function.');\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error('Expected the reducer to be a function.');\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n /**\n * This makes a shallow copy of currentListeners so we can use\n * nextListeners as a temporary list while dispatching.\n *\n * This prevents any bugs around consumers calling\n * subscribe/unsubscribe in the middle of a dispatch.\n */\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n\n\n function getState() {\n if (isDispatching) {\n throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');\n }\n\n return currentState;\n }\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n\n\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error('Expected the listener to be a function.');\n }\n\n if (isDispatching) {\n throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.');\n }\n\n var isSubscribed = true;\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n if (isDispatching) {\n throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribelistener for more details.');\n }\n\n isSubscribed = false;\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n currentListeners = null;\n };\n }\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing \u201Cwhat changed\u201D. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n\n\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error('Actions may not have an undefined \"type\" property. ' + 'Have you misspelled a constant?');\n }\n\n if (isDispatching) {\n throw new Error('Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n\n\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error('Expected the nextReducer to be a function.');\n }\n\n currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.\n // Any reducers that existed in both the new and old rootReducer\n // will receive the previous state. This effectively populates\n // the new state tree with any relevant data from the old one.\n\n dispatch({\n type: ActionTypes.REPLACE\n });\n }\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n\n\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object' || observer === null) {\n throw new TypeError('Expected the observer to be an object.');\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return {\n unsubscribe: unsubscribe\n };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n } // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n\n\n dispatch({\n type: ActionTypes.INIT\n });\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n\n/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nfunction warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n\n\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n } catch (e) {} // eslint-disable-line no-empty\n\n}\n\nfunction getUndefinedStateErrorMessage(key, action) {\n var actionType = action && action.type;\n var actionDescription = actionType && \"action \\\"\" + String(actionType) + \"\\\"\" || 'an action';\n return \"Given \" + actionDescription + \", reducer \\\"\" + key + \"\\\" returned undefined. \" + \"To ignore an action, you must explicitly return the previous state. \" + \"If you want this reducer to hold no value, you can return null instead of undefined.\";\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n return \"The \" + argumentName + \" has unexpected type of \\\"\" + {}.toString.call(inputState).match(/\\s([a-z|A-Z]+)/)[1] + \"\\\". Expected argument to be an object with the following \" + (\"keys: \\\"\" + reducerKeys.join('\", \"') + \"\\\"\");\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n if (action && action.type === ActionTypes.REPLACE) return;\n\n if (unexpectedKeys.length > 0) {\n return \"Unexpected \" + (unexpectedKeys.length > 1 ? 'keys' : 'key') + \" \" + (\"\\\"\" + unexpectedKeys.join('\", \"') + \"\\\" found in \" + argumentName + \". \") + \"Expected to find one of the known reducer keys instead: \" + (\"\\\"\" + reducerKeys.join('\", \"') + \"\\\". Unexpected keys will be ignored.\");\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, {\n type: ActionTypes.INIT\n });\n\n if (typeof initialState === 'undefined') {\n throw new Error(\"Reducer \\\"\" + key + \"\\\" returned undefined during initialization. \" + \"If the state passed to the reducer is undefined, you must \" + \"explicitly return the initial state. The initial state may \" + \"not be undefined. If you don't want to set a value for this reducer, \" + \"you can use null instead of undefined.\");\n }\n\n if (typeof reducer(undefined, {\n type: ActionTypes.PROBE_UNKNOWN_ACTION()\n }) === 'undefined') {\n throw new Error(\"Reducer \\\"\" + key + \"\\\" returned undefined when probed with a random type. \" + (\"Don't try to handle \" + ActionTypes.INIT + \" or other actions in \\\"redux/*\\\" \") + \"namespace. They are considered private. Instead, you must return the \" + \"current state for any unknown actions, unless it is undefined, \" + \"in which case you must return the initial state, regardless of the \" + \"action type. The initial state may not be undefined, but can be null.\");\n }\n });\n}\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\n\n\nfunction combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning(\"No reducer provided for key \\\"\" + key + \"\\\"\");\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n\n var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same\n // keys multiple times.\n\n var unexpectedKeyCache;\n\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError;\n\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination(state, action) {\n if (state === void 0) {\n state = {};\n }\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n\n if (typeof nextStateForKey === 'undefined') {\n var errorMessage = getUndefinedStateErrorMessage(_key, action);\n throw new Error(errorMessage);\n }\n\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n\n hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;\n return hasChanged ? nextState : state;\n };\n}\n\nfunction bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(this, arguments));\n };\n}\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass an action creator as the first argument,\n * and get a dispatch wrapped function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\n\n\nfunction bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n throw new Error(\"bindActionCreators expected an object or a function, instead received \" + (actionCreators === null ? 'null' : typeof actionCreators) + \". \" + \"Did you write \\\"import ActionCreators from\\\" instead of \\\"import * as ActionCreators from\\\"?\");\n }\n\n var boundActionCreators = {};\n\n for (var key in actionCreators) {\n var actionCreator = actionCreators[key];\n\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n\n return boundActionCreators;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n keys.push.apply(keys, Object.getOwnPropertySymbols(object));\n }\n\n if (enumerableOnly) keys = keys.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(source, true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(source).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\n/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\nfunction compose() {\n for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(void 0, arguments));\n };\n });\n}\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\n\nfunction applyMiddleware() {\n for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function () {\n var store = createStore.apply(void 0, arguments);\n\n var _dispatch = function dispatch() {\n throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');\n };\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch() {\n return _dispatch.apply(void 0, arguments);\n }\n };\n var chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(void 0, chain)(store.dispatch);\n return _objectSpread2({}, store, {\n dispatch: _dispatch\n });\n };\n };\n}\n\n/*\n * This is a dummy function to check if the function name has been altered by minification.\n * If the function has been minified and NODE_ENV !== 'production', warn the user.\n */\n\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \"production\". ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or setting mode to production in webpack (https://webpack.js.org/concepts/mode/) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { ActionTypes as __DO_NOT_USE__ActionTypes, applyMiddleware, bindActionCreators, combineReducers, compose, createStore };\n", "/** A function that accepts a potential \"extra argument\" value to be injected later,\r\n * and returns an instance of the thunk middleware that uses that value\r\n */\nfunction createThunkMiddleware(extraArgument) {\n // Standard Redux middleware definition pattern:\n // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware\n var middleware = function middleware(_ref) {\n var dispatch = _ref.dispatch,\n getState = _ref.getState;\n return function (next) {\n return function (action) {\n // The thunk middleware looks for any functions that were passed to `store.dispatch`.\n // If this \"action\" is really a function, call it and return the result.\n if (typeof action === 'function') {\n // Inject the store's `dispatch` and `getState` methods, as well as any \"extra arg\"\n return action(dispatch, getState, extraArgument);\n } // Otherwise, pass the action down the middleware chain as usual\n\n\n return next(action);\n };\n };\n };\n\n return middleware;\n}\n\nvar thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version\n// with whatever \"extra arg\" they want to inject into their thunks\n\nthunk.withExtraArgument = createThunkMiddleware;\nexport default thunk;", "import { throttle } from 'throttle-debounce';\nimport { requestSessionId } from './actions';\nimport { LOCAL_STORAGE_CHANGE, LOCAL_STORAGE_CLEAR } from './constants';\n\nexport const STORE_ROOT = 'OG_STATE';\n\nexport const safeParseState = serializedState => {\n try {\n if (serializedState === null) {\n return undefined;\n }\n return JSON.parse(serializedState);\n } catch (err) {\n return undefined;\n }\n};\nconst isPreviewMode = () => window.og && window.og.previewMode;\n\nexport const loadState = () => (isPreviewMode() ? {} : safeParseState(localStorage.getItem(STORE_ROOT)));\n\nexport const serializeState = state => {\n if (!state || !state.sessionId) {\n return false;\n }\n return JSON.stringify({\n sessionId: state.sessionId,\n optedin: state.optedin,\n optedout: state.optedout,\n productOffer: state.productOffer,\n firstOrderPlaceDate: state.firstOrderPlaceDate,\n productToSubscribe: state.productToSubscribe\n // uncomment this to see parameter saved to localStorage\n // inStock: state.inStock,\n // autoshipEligible: state.autoshipEligible,\n // productOffer: state.productOffer\n // frequency: { ...state.frequency }\n });\n};\n\nexport const saveState = state => {\n if (isPreviewMode()) return;\n if (state && state.sessionId) {\n document.cookie =\n 'og_session_id=' +\n encodeURIComponent(state.sessionId) +\n '; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT; SameSite=Lax';\n }\n\n const serializedState = serializeState(state);\n if (serializedState && localStorage.getItem(STORE_ROOT) !== serializedState) {\n localStorage.setItem(STORE_ROOT, serializedState);\n }\n};\n\nexport const listenLocalStorageChanges = store =>\n throttle(500, ev => {\n if (isPreviewMode()) return;\n const { key, newValue } = ev;\n if (key === STORE_ROOT && newValue === null) {\n store.dispatch({ type: LOCAL_STORAGE_CLEAR });\n setTimeout(() => store.dispatch(requestSessionId()), 0);\n } else if (key === STORE_ROOT) {\n store.dispatch({\n type: LOCAL_STORAGE_CHANGE,\n newValue: safeParseState(newValue)\n });\n }\n });\n\nexport const clearState = () => localStorage.removeItem(STORE_ROOT);\n", "export const ogAuthRegExp = /^og_auth=/;\n\n/**\n * Retrieve og_auth cookie from current document\n */\nexport const readAuthCookie = (_ogAuthRegExp = ogAuthRegExp) =>\n (document.cookie.split(/;\\s*/).find(it => it.match(_ogAuthRegExp)) || '').replace(ogAuthRegExp, '');\n\n/**\n * Converts a string authCookie representation into a hmac auth object\n * @param {*} authCookie\n */\nexport const parseAuth = authCookie => {\n // Called to set auth parameters if the config setting for HMAC auth is used\n if (typeof authCookie === 'object') return authCookie;\n const parts = String(authCookie || '').split('|');\n\n return parts.length === 3\n ? {\n sig_field: parts[0],\n ts: parseInt(parts[1], 10),\n sig: parts[2]\n }\n : null;\n};\n\n/**\n * Loads the auth url into and iframe and useful to detect cookies set by javascript\n * @param {*} auth_url\n */\nexport const iframeLoad = auth_url => {\n return new Promise((resolve, reject) => {\n const iframe = document.createElement('iframe');\n iframe.style.setProperty('display', 'none', 'important');\n document.body.appendChild(iframe);\n\n iframe.onload = resolve;\n iframe.onerror = reject;\n iframe.src = auth_url;\n });\n};\n\n/**\n * Detects if a fetch response is json\n * @see https://stackoverflow.com/questions/37121301/how-to-check-if-the-response-of-a-fetch-is-a-json-object-in-javascript\n * @param {} response\n */\nexport const isJsonResponse = response =>\n (response.headers.get('content-type') || '').indexOf('application/json') !== -1;\n\n/**\n * Reads auth from window.og_auth\n * @returns {AuthObject|null} Returns null if auth fails or the object containing sig_field,\n * ts and sig used to authorize with ordergroove\n */\nfunction _readStaticAuth() {\n if (typeof window.og_auth !== 'undefined') {\n return parseAuth(window.og_auth);\n }\n return null;\n}\n/**\n * Waits 100ms to read window.og_auth value\n * @param {int} ms\n * @returns {Promise<AuthObject>} Returns a promise of AuthObject\n */\nasync function _delayedReadStaticAuth(ms = 100) {\n return new Promise(res => {\n setTimeout(() => res(_readStaticAuth()), ms);\n });\n}\n\n/**\n * Given a merchant auth endpoint this function tries to resolve the current auth.\n * If og_auth is in cookie it returns it, otherwise it call the merchant auth endpoint detecting\n * if response is json or cookie set by repsonse header and return it.\n *\n * @param {*} auth_url Merchant auth url endpoint\n * @param {*} _readAuthCookie method to read cookie (for test purpose)\n * @param {*} _iframeLoad method to load an iframe (for test purpose)\n */\nexport async function resolveAuth(auth_url, _readAuthCookie = readAuthCookie, _iframeLoad = iframeLoad) {\n let auth;\n\n auth = parseAuth(_readStaticAuth()) || parseAuth(_readAuthCookie());\n\n if (auth) {\n return auth;\n }\n\n if (auth_url && typeof auth_url === 'string') {\n const response = await fetch(auth_url);\n // https://github.com/github/fetch/issues/386#issuecomment-243145797\n // detect if cookie was written by latest request\n if (response.status >= 200 && response.status < 300) {\n auth =\n _readAuthCookie() ||\n (await (isJsonResponse(response)\n ? response.json()\n : Promise.resolve(_iframeLoad(auth_url)).then(_readAuthCookie)));\n }\n } else if (!auth) {\n // If there is no auth_url and no auth at this point\n // lets wait for 100 ms to see if window.og_auth is set via js on DOM\n auth = await _delayedReadStaticAuth();\n }\n\n auth = parseAuth(auth);\n if (auth) return auth;\n throw new Error('Unauthorized');\n}\n\nexport default resolveAuth;\n", "export const OPTIN_PRODUCT = 'OPTIN_PRODUCT';\nexport const OPTOUT_PRODUCT = 'OPTOUT_PRODUCT';\nexport const PRODUCT_CHANGE_FREQUENCY = 'PRODUCT_CHANGE_FREQUENCY';\nexport const PRODUCT_CHANGE_PREPAID_SHIPMENTS = 'PRODUCT_CHANGE_PREPAID_SHIPMENTS';\nexport const SET_MERCHANT_ID = 'SET_MERCHANT_ID';\nexport const REQUEST_OFFER = 'REQUEST_OFFER';\nexport const RECEIVE_OFFER = 'RECEIVE_OFFER';\nexport const PRODUCT_HAS_CHANGED = 'PRODUCT_HAS_CHANGED';\nexport const CREATED_SESSION_ID = 'CREATED_SESSION_ID';\nexport const SET_AUTH_URL = 'SET_AUTH_URL';\nexport const REQUEST_AUTH = 'REQUEST_AUTH';\nexport const AUTHORIZE = 'AUTHORIZE';\nexport const UNAUTHORIZED = 'UNAUTHORIZED';\nexport const REQUEST_ORDERS = 'REQUEST_ORDERS';\nexport const RECEIVE_ORDERS = 'RECEIVE_ORDERS';\nexport const CART_PRODUCT_KEY_HAS_CHANGED = 'CART_PRODUCT_KEY_HAS_CHANGED';\n\nexport const RECEIVE_ORDER_ITEMS = 'RECEIVE_ORDER_ITEMS';\nexport const FETCH_RESPONSE_ERROR = 'FETCH_RESPONSE_ERROR';\nexport const SET_ENVIRONMENT_LOCAL = 'SET_ENVIRONMENT_LOCAL';\nexport const SET_ENVIRONMENT_STAGING = 'SET_ENVIRONMENT_STAGING';\nexport const SET_ENVIRONMENT_DEV = 'SET_ENVIRONMENT_DEV';\nexport const SET_ENVIRONMENT_PROD = 'SET_ENVIRONMENT_PROD';\nexport const READY = 'READY';\nexport const CONCLUDE_UPSELL = 'CONCLUDE_UPSELL';\nexport const REQUEST_CREATE_IU_ORDER = 'REQUEST_CREATE_IU_ORDER';\nexport const CREATE_ONE_TIME = 'CREATE_ONE_TIME';\nexport const REQUEST_CONVERT_ONE_TIME = 'REQUEST_CONVERT_ONE_TIME';\nexport const CONVERT_ONE_TIME = 'CONVERT_ONE_TIME';\nexport const NO_UPCOMING_ORDER_ERROR = 'NO_UPCOMING_ORDER_ERROR';\nexport const CHECKOUT = 'CHECKOUT';\nexport const RECEIVE_FETCH = 'RECEIVE_FETCH';\nexport const SET_LOCALE = 'SET_LOCALE';\nexport const SET_CONFIG = 'SET_CONFIG';\nexport const SET_BENEFIT_MESSAGES = 'SET_BENEFIT_MESSAGES';\nexport const SET_PREVIEW_STANDARD_OFFER = 'SET_PREVIEW_STANDARD_OFFER';\nexport const SET_PREVIEW_UPSELL_OFFER = 'SET_PREVIEW_UPSELL_OFFER';\nexport const SET_PREVIEW_PREPAID_OFFER = 'SET_PREVIEW_PREPAID_OFFER';\nexport const ADD_TEMPLATE = 'ADD_TEMPLATE';\nexport const SET_TEMPLATES = 'SET_TEMPLATES';\nexport const LOCAL_STORAGE_CHANGE = 'LOCAL_STORAGE_CHANGE';\nexport const LOCAL_STORAGE_CLEAR = 'LOCAL_STORAGE_CLEAR';\nexport const SET_FIRST_ORDER_PLACE_DATE = 'SET_FIRST_ORDER_PLACE_DATE';\nexport const SET_PRODUCT_TO_SUBSCRIBE = 'SET_PRODUCT_TO_SUBSCRIBE';\nexport const RECEIVE_PRODUCT_PLANS = 'RECEIVE_PRODUCT_PLANS';\nexport const SETUP_PRODUCT = 'SETUP_PRODUCT';\nexport const SETUP_CART = 'SETUP_CART';\nexport const RECEIVE_MERCHANT_SETTINGS = 'RECEIVE_MERCHANT_SETTINGS';\nexport const SET_EXPERIMENT_VARIANT = 'SET_EXPERIMENT_VARIANT';\nexport const DEFAULT_OFFER_MODULE = 'pdp';\nexport const ENV_LOCAL = 'local';\nexport const ENV_DEV = 'dev';\nexport const ENV_STAGING = 'staging';\nexport const ENV_PROD = 'prod';\nexport const STATIC_HOST = 'static.ordergroove.com';\nexport const STAGING_STATIC_HOST = 'staging.static.ordergroove.com';\n\nexport const INCENTIVE_STANDARD_TYPES = {\n PSI: 'PSI',\n // note: this is a \"pseudo-standard\" that we set in our own code\n // the API actually returns no criteria for program wide incentives\n PROGRAM_WIDE: 'PROGRAM_WIDE'\n};\n\nexport const ELIGIBILITY_GROUPS = {\n PREPAID: 'prepaid'\n};\n\n/**\n * @event\n * Events that fires once optin/optout occurs on a cart offer\n * @example\n * Merchant can subscribe to this event to perform extra UI updated after offer and price had change\n *\n * ```js\n * // Hooks OG cart updated to VueMinicart\n * 'VueMinicart' in window && document.addEventListener('og-cart-updated', () => window.VueMinicart.$store.dispatch('refreshCart'));\n * ```\n */\nexport const CART_UPDATED_EVENT = 'og-cart-updated';\n", "import memoize from 'lodash.memoize';\n\nconst memoizeKey = (...args) => JSON.stringify(args);\n\nexport const withFetchJson =\n cb =>\n (...args) =>\n fetch(...cb(...args)).then(res => res.json());\n\nexport const withHost = cb => {\n return (host, ...extra) => {\n if (!host) throw Error('host required');\n const [path, options = {}] = cb(...extra);\n const url = `${host.replace(/\\/+$/, '')}${path}`;\n return [url, options];\n };\n};\n\nexport const withAuth = cb => {\n return (auth, ...extra) => {\n if (!auth) throw Error('auth required');\n const [path, options = {}] = cb(...extra);\n return [\n path,\n {\n ...options,\n headers: {\n Authorization: JSON.stringify(auth),\n ...options.headers\n }\n }\n ];\n };\n};\n\nexport const withJsonBody = cb => {\n return (...extra) => {\n const [path, options = {}] = cb(...extra);\n return [\n path,\n {\n method: 'POST',\n ...options,\n body: JSON.stringify(options.body),\n headers: {\n 'Content-type': 'application/json',\n ...options.headers\n }\n }\n ];\n };\n};\n\nexport const toQuery = (params = []) =>\n (Array.isArray(params) ? params : Object.entries(params))\n .map(([key, val]) => [key, encodeURIComponent(val)].join('='))\n .join('&');\n\nexport const toProductId = product =>\n JSON.stringify(\n []\n .concat(product)\n .map(it => (typeof it === 'object' ? it.id : it))\n .filter(it => it)\n );\n\nexport const fetchOffer = memoize(\n withFetchJson(\n withHost((merchantId, sessionId, product, module = 'pdp', searchParams = {}) => {\n if (!merchantId) throw Error('merchantId required');\n if (!sessionId) throw Error('sessionId required');\n if (!product) throw Error('product required');\n\n const query = [\n ['session_id', sessionId],\n ['page_type', 1],\n ['p', toProductId(product)],\n ['module_view', JSON.stringify(['regular'])],\n ...Object.entries(searchParams)\n ];\n\n return [`/offer/${merchantId}/${module}?${toQuery(query)}`];\n })\n ),\n memoizeKey\n);\n\nexport const fetchOrders = memoize(\n withFetchJson(\n withHost(\n withAuth((status = 1, ordering = 'place') => [\n `/orders/?${toQuery([\n ['status', status],\n ['ordering', ordering],\n ['exclude_prepaid_orders', 'true']\n ])}`\n ])\n )\n ),\n memoizeKey\n);\n\nexport const fetchItems = memoize(\n withFetchJson(\n withHost(\n withAuth(orderId => {\n if (!orderId) throw Error('orderId required');\n return [`/items/?order=${orderId}`];\n })\n )\n ),\n memoizeKey\n);\n\nexport const createOneTime = withFetchJson(\n withHost(\n withAuth(\n withJsonBody((product, order, quantity, offer) => {\n if (!product) throw Error('product required');\n if (!order) throw Error('order required');\n if (!quantity) throw Error('quantity required');\n if (quantity <= 0) throw Error('quantity must be greater or equal than one');\n if (!offer) throw Error('offer required');\n return ['/items/iu/', { body: { product, order, quantity, offer } }];\n })\n )\n )\n);\n\nexport const parseFrequency = raw => {\n if (typeof raw === 'object') {\n return { ...raw };\n }\n\n const [every, every_period] = (raw || '').split(/_/).map(n => parseInt(n, 10));\n return every && every_period && { every, every_period };\n};\n\nexport const isFrequencyValid = it => it.match(/^\\d+_\\d$/);\nexport const compareFrequencies = (a, b) =>\n String.prototype.localeCompare.call(a && a.split('_').reverse().join('_'), b && b.split('_').reverse().join('_'));\n\nexport const parseFrequenciesList = value =>\n [...new Set(value && value.split(/\\s+/))].filter(isFrequencyValid).sort(compareFrequencies);\n\nexport const stringifyFrequencies = value => (value == null ? value : value.join(' '));\n\nexport const stringifyFrequency = ref => {\n if (typeof ref === 'object') {\n const { every, period, every_period } = ref;\n return `${every}_${period || every_period}`;\n }\n if (typeof ref === 'string') return ref;\n return '';\n};\n\nexport const convertOneTimeToSubscription = withFetchJson(\n withHost(\n withAuth(\n withJsonBody((item, frequency, offer, sessionId) => {\n if (!item) throw Error('item required');\n if (!frequency) throw Error('frequency required');\n const parsedFrequency = parseFrequency(frequency);\n if (!parsedFrequency) throw Error('invalid frequency');\n\n return [\n '/subscriptions/create_from_item/',\n { body: { item: item.public_id, offer, session_id: sessionId, ...parsedFrequency } }\n ];\n })\n )\n )\n);\n\nexport const api = { fetchOffer, fetchOrders, fetchItems, createOneTime, convertOneTimeToSubscription };\n\nexport default api;\n", "import { getMainJs } from './core/utils';\n\nconst script = getMainJs();\n\nexport default {\n shopify: typeof window.Shopify !== 'undefined',\n // detect in the frontend if we should use shopify selling plans or not\n shopify_selling_plans: typeof script?.dataset.shopifySellingPlans !== 'undefined'\n};\n", "function defaultEqualityCheck(a, b) {\n return a === b;\n}\n\nfunction areArgumentsShallowlyEqual(equalityCheck, prev, next) {\n if (prev === null || next === null || prev.length !== next.length) {\n return false;\n }\n\n // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible.\n var length = prev.length;\n for (var i = 0; i < length; i++) {\n if (!equalityCheck(prev[i], next[i])) {\n return false;\n }\n }\n\n return true;\n}\n\nexport function defaultMemoize(func) {\n var equalityCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultEqualityCheck;\n\n var lastArgs = null;\n var lastResult = null;\n // we reference arguments instead of spreading them for performance reasons\n return function () {\n if (!areArgumentsShallowlyEqual(equalityCheck, lastArgs, arguments)) {\n // apply arguments instead of spreading for performance.\n lastResult = func.apply(null, arguments);\n }\n\n lastArgs = arguments;\n return lastResult;\n };\n}\n\nfunction getDependencies(funcs) {\n var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs;\n\n if (!dependencies.every(function (dep) {\n return typeof dep === 'function';\n })) {\n var dependencyTypes = dependencies.map(function (dep) {\n return typeof dep;\n }).join(', ');\n throw new Error('Selector creators expect all input-selectors to be functions, ' + ('instead received the following types: [' + dependencyTypes + ']'));\n }\n\n return dependencies;\n}\n\nexport function createSelectorCreator(memoize) {\n for (var _len = arguments.length, memoizeOptions = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n memoizeOptions[_key - 1] = arguments[_key];\n }\n\n return function () {\n for (var _len2 = arguments.length, funcs = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n funcs[_key2] = arguments[_key2];\n }\n\n var recomputations = 0;\n var resultFunc = funcs.pop();\n var dependencies = getDependencies(funcs);\n\n var memoizedResultFunc = memoize.apply(undefined, [function () {\n recomputations++;\n // apply arguments instead of spreading for performance.\n return resultFunc.apply(null, arguments);\n }].concat(memoizeOptions));\n\n // If a selector is called with the exact same arguments we don't need to traverse our dependencies again.\n var selector = memoize(function () {\n var params = [];\n var length = dependencies.length;\n\n for (var i = 0; i < length; i++) {\n // apply arguments instead of spreading and mutate a local list of params for performance.\n params.push(dependencies[i].apply(null, arguments));\n }\n\n // apply arguments instead of spreading for performance.\n return memoizedResultFunc.apply(null, params);\n });\n\n selector.resultFunc = resultFunc;\n selector.dependencies = dependencies;\n selector.recomputations = function () {\n return recomputations;\n };\n selector.resetRecomputations = function () {\n return recomputations = 0;\n };\n return selector;\n };\n}\n\nexport var createSelector = createSelectorCreator(defaultMemoize);\n\nexport function createStructuredSelector(selectors) {\n var selectorCreator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : createSelector;\n\n if (typeof selectors !== 'object') {\n throw new Error('createStructuredSelector expects first argument to be an object ' + ('where each property is a selector, instead received a ' + typeof selectors));\n }\n var objectKeys = Object.keys(selectors);\n return selectorCreator(objectKeys.map(function (key) {\n return selectors[key];\n }), function () {\n for (var _len3 = arguments.length, values = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {\n values[_key3] = arguments[_key3];\n }\n\n return values.reduce(function (composition, value, index) {\n composition[objectKeys[index]] = value;\n return composition;\n }, {});\n });\n}", "import { createSelector } from 'reselect';\nimport memoize from 'lodash.memoize';\nimport { stringifyFrequency } from './api';\nimport platform from '../platform';\nimport { mapFrequencyToSellingPlan, safeProductId } from './utils';\nimport { Incentive, OfferElement, ProductFrequencyConfig, State } from './types/reducer';\nimport { money, percentage } from '../shopify/utils';\nimport { INCENTIVE_STANDARD_TYPES } from './constants';\n\nmemoize.Cache = Map;\n\ntype BaseProduct = {\n id: string;\n components?: string[];\n};\n\nfunction arraysEqual<T>(a: T[], b: T[]) {\n if (a === b) return true;\n if (a === null || b === null) return false;\n if (a.length !== b.length) return false;\n\n // If you don't care about the order of the elements inside\n // the array, you should sort both arrays here.\n // Please note that calling sort on an array will modify that array.\n // you might want to clone your array first.\n\n for (let i = 0; i < a.length; ++i) {\n if (a[i] !== b[i]) return false;\n }\n return true;\n}\n\nfunction resolveFrequency(sellingPlans: string[], frequenciesEveryPeriod: string[], frequency) {\n const ogFrequency = stringifyFrequency(frequency);\n if (!platform.shopify_selling_plans) return ogFrequency;\n return mapFrequencyToSellingPlan(sellingPlans, frequenciesEveryPeriod, ogFrequency);\n}\n\nexport const isSameProduct = <T extends BaseProduct, S extends BaseProduct>(a: T, b: S) => {\n if ((a as BaseProduct) === b) return true;\n if (typeof a === 'object' && typeof b === 'object' && a && b) {\n if (a.id === b.id) {\n if (!(Array.isArray(a.components) && Array.isArray(b.components))) {\n return true;\n }\n if (arraysEqual((a.components || []).sort(), (b.components || []).sort())) {\n return true;\n }\n }\n }\n return false;\n};\n\n/**\n * Returns a list of opted in products id from the state\n * @param {object} state\n */\nexport const optedinSelector = (state: State) => state.optedin || [];\n\nconst optedoutSelector = (state: State) => state.optedout || [];\n\nexport const autoshipSelector = (state: State) => state.autoshipByDefault || {};\n\nconst defaultFrequenciesSelector = (state: State) => state.defaultFrequencies || {};\n\nconst prepaidSellingPlansSelector = (state: State) => state?.config?.prepaidSellingPlans || [];\nconst prepaidShipmentsSelectedSelector = (state: State) => state?.prepaidShipmentsSelected || {};\n\n/**\n * Creates a function with state arguments that return the true when\n * productId is in the optedin array or not in optedout or autoship by default\n */\nexport const makeOptedinSelector = memoize(\n (product: BaseProduct) =>\n createSelector(optedinSelector, optedoutSelector, autoshipSelector, (optedin, optedout, autoshipByDefault) => {\n const entry = optedin.find(b => isSameProduct(product, b));\n if (entry) {\n return entry;\n }\n if (optedout.find(b => isSameProduct(product, b))) {\n return false;\n }\n if (product && autoshipByDefault[product.id]) {\n return { id: product.id };\n }\n return false;\n }),\n product => JSON.stringify(product)\n);\n/**\n * Creates a function with state arguments that return the true when\n * productId is in the optedin array\n */\nexport const makeSubscribedSelector = memoize(\n (product: BaseProduct) =>\n createSelector(optedinSelector, optedin => {\n const entry = optedin.find(b => isSameProduct(product, b));\n if (entry) {\n return entry;\n }\n return false;\n }),\n product => JSON.stringify(product)\n);\n\nexport const makePrepaidSubscribedSelector = memoize(\n (product: BaseProduct) =>\n createSelector(optedinSelector, optedin => optedin.some(b => isSameProduct(product, b) && b.prepaidShipments)),\n product => JSON.stringify(product)\n);\n\nexport const makePrepaidShipmentsSelectedSelector = memoize(\n (product: BaseProduct) =>\n createSelector(\n prepaidShipmentsSelectedSelector,\n prepaidShipmentsSelected => prepaidShipmentsSelected[product.id] || null\n ),\n product => JSON.stringify(product)\n);\n\n/**\n * Creates a function with state arguments that return the true when\n * productId is in the optedout array\n */\nexport const makeOptedoutSelector = memoize((product: BaseProduct) =>\n createSelector(optedoutSelector, optedout => optedout.find(b => isSameProduct(product, b)))\n);\n\nexport const makeProductFrequencyOptedInSelector = memoize(\n (product: BaseProduct) =>\n createSelector(\n makeOptedinSelector(product),\n productOptin => (productOptin && 'frequency' in productOptin && productOptin.frequency) || null\n ),\n product => JSON.stringify(product)\n);\n\nexport const makeProductPrepaidShipmentsOptedInSelector = memoize(\n (product: BaseProduct) =>\n createSelector(\n makeOptedinSelector(product),\n productOptin => (productOptin && 'prepaidShipments' in productOptin && productOptin.prepaidShipments) || null\n ),\n product => JSON.stringify(product)\n);\n\nexport const makeProductPrepaidShipmentOptionsSelector = memoize((productId: string) =>\n createSelector(prepaidSellingPlansSelector, prepaidSellingPlans => {\n const shipmentsList =\n prepaidSellingPlans[safeProductId(productId)]?.map(({ numberShipments }) => numberShipments) || [];\n return shipmentsList.sort((a, b) => a - b);\n })\n);\n\n/**\n * If the product has a product-specific default frequency configured in OG, return that frequency\n */\nexport const makeProductSpecificDefaultFrequencySelector = memoize((productId: string) =>\n createSelector(\n defaultFrequenciesSelector,\n makeProductFrequenciesSelector(productId),\n (defaultFrequencies, { frequencies: sellingPlans = [], frequenciesEveryPeriod = [] }) =>\n (defaultFrequencies[safeProductId(productId)] &&\n resolveFrequency(sellingPlans, frequenciesEveryPeriod, defaultFrequencies[safeProductId(productId)])) ||\n null\n )\n);\n\nexport const makeProductFrequencyOptionsSelector = memoize((productId: string) =>\n createSelector(makeProductFrequenciesSelector(productId), productFrequencies => productFrequencies.frequencies)\n);\n\n/**\n * returns the default frequency for the product from the config state\n * all products have a defaultFrequency stored in state, even if a specific frequency is not configured in OG's database\n * this takes more into account, e.g. whether the customer had opted into a specific frequency previously - see the config reducer for how this is calculated\n */\nexport const makeProductDefaultFrequencySelector = memoize((productId: string) =>\n createSelector(makeProductFrequenciesSelector(productId), productFrequencies => productFrequencies.defaultFrequency)\n);\n\n/**\n * Get the configured frequencies for the given product IDs\n * Using this selector should be preferred over accessing config values directly\n */\nexport const makeProductFrequenciesSelector = memoize((productId: string) =>\n createSelector(\n (state: State) => state?.config?.productFrequencies,\n (state: State) => state?.config?.frequencies,\n (state: State) => state?.config?.frequenciesEveryPeriod,\n (state: State) => state?.config?.frequenciesText,\n (state: State) => state?.config?.defaultFrequency,\n (\n productFrequencies,\n oldFrequencies,\n oldFrequenciesEveryPeriod,\n oldFrequenciesText,\n oldDefaultFrequency\n ): ProductFrequencyConfig => {\n if (productFrequencies) {\n // for Shopify, always use productFrequencies\n // this is necessary to handle cases where different product variants have different selling plans associated with them\n return productFrequencies[safeProductId(productId)] || {};\n } else {\n // productFrequencies are only populated for Shopify\n // fall back to the old \"global\" frequency values if it is not set\n // these would only be present if the merchant explicitly called `offers.config({ frequencies: [...] })`, so they generally won't be defined\n return {\n frequencies: oldFrequencies,\n frequenciesEveryPeriod: oldFrequenciesEveryPeriod,\n frequenciesText: oldFrequenciesText,\n defaultFrequency: oldDefaultFrequency\n };\n }\n }\n )\n);\n\n// this selector is only called when an action is dispatched, so we don't need to memoize\n// other selectors are called whenever the Redux state is updated\nexport const makeFrequencyForPrepaidShipmentsSelector = (product: BaseProduct, prepaidShipments: number) =>\n createSelector(\n prepaidSellingPlansSelector,\n makeProductFrequenciesSelector(product.id),\n (prepaidSellingPlans, { frequencies }) => {\n if (prepaidShipments) {\n const productId = safeProductId(product.id);\n const plan = prepaidSellingPlans[productId]?.find(p => p.numberShipments === prepaidShipments);\n return plan ? plan.sellingPlan : null;\n }\n return frequencies[0];\n }\n );\n\nexport const makePrepaidSellingPlansSelector = (product: string) =>\n createSelector(prepaidSellingPlansSelector, prepaidSellingPlans => {\n const productId = safeProductId(product);\n return prepaidSellingPlans[productId] || [];\n });\n\n/** Determine the discounted price of the product, based on the incentives returned from the Offers endpoint. This assumes a pay-as-you-go subscription. */\nexport const makeDiscountedProductPriceSelector = memoize((productId: string) =>\n createSelector(\n (state: State) => state.price || {},\n (state: State) => state.incentives || {},\n (state: State) => state.config.storeCurrency,\n (prices, incentives, currency) => {\n const productPriceObj = prices[safeProductId(productId)];\n if (productPriceObj === undefined || productPriceObj === null || !currency) return {};\n\n const productPrice = productPriceObj.value;\n let regularPrice = productPrice;\n let subscriptionPrice = productPrice;\n\n const productIncentives = incentives[safeProductId(productId)];\n const incentive = productIncentives?.initial.find(findRelevantIncentive);\n\n let formatted_discount = '';\n\n if (incentive) {\n if (incentive.type === 'Discount Percent') {\n // note: productPrice is in cents ($10 => 1000), so we round to the nearest whole number after applying the discount\n subscriptionPrice = Math.round((productPrice * (100 - incentive.value)) / 100);\n formatted_discount = percentage(incentive.value);\n } else if (incentive.type === 'Discount Amount' && currency === 'USD') {\n // for now, we only support USD for \"dollar-off\" discounts\n // productPrice is in cents, while the incentive value is in dollars, so we multiply by 100\n subscriptionPrice = Math.max(0, productPrice - Math.round(incentive.value * 100));\n }\n }\n return {\n regularPrice: money(regularPrice, currency),\n subscriptionPrice: money(subscriptionPrice, currency),\n discountRate: formatted_discount || money(regularPrice - subscriptionPrice, currency)\n };\n }\n )\n);\n\nconst validIncentiveStandards = [INCENTIVE_STANDARD_TYPES.PROGRAM_WIDE, INCENTIVE_STANDARD_TYPES.PSI];\n\nfunction findRelevantIncentive(incentive: Incentive) {\n return (\n incentive.object === 'item' &&\n (incentive.type === 'Discount Percent' || incentive.type === 'Discount Amount') &&\n // only attempt to determine a discount if the incentive is standardized, i.e. we have a criteria object\n incentive.criteria &&\n // note: the API should return either a PSI or a program-wide, not both\n incentive.criteria.node_type === 'PREMISE' &&\n validIncentiveStandards.includes(incentive.criteria.standard)\n );\n}\n\n/**\n * Convert a string from camel case to kebab case.\n */\nexport const kebabCase = (string: string) => {\n return string.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, '$1-$2').toLowerCase();\n};\n\nexport const getFallbackValue = (element: HTMLElement & { offer: OfferElement }, key: string, defaultValue?) =>\n (element && element.hasAttribute && element.hasAttribute(kebabCase(key)) && element[key]) ||\n (element.offer && typeof (element.offer[key] !== 'undefined') && element.offer[key]) ||\n defaultValue;\n\n/**\n * Returns a list of opted in products id from the state\n */\nexport const templatesSelector = (state: State) => ({ templates: state.templates || [] });\n\n/**\n * Returns true if no selling plan has price adjustments (except for prepaid, which still use price adjustments). This means that we are calculating the subscription discount using a Shopify Discount Function instead of that information being stored in the selling plan.\n * Generally, the Shopify Discount Function is used when the merchant is using standard flex incentives, i.e. the offer profile is standardized\n */\nexport const isShopifyDiscountFunctionInUseSelector = (state: State) => {\n const plans = Object.values(state.productPlans).flat();\n\n return plans.length > 0 && plans.every(plan => plan.hasPriceAdjustments === false || plan.prepaidShipments);\n};\n\n/**\n * Pick benefit message to be rendered in PDP. Preferences are:\n * 1. Message matching the browser's locale exactly (eg \"es-MX\")\n * 2. Message matching any locale with the same language prefix (eg \"es-ES\" for \"es-MX\")\n * 3. US English message (\"en-US\")\n * Returns null when none are present \u2014 the incentive is then skipped.\n */\nconst resolveLocaleMessage = (localeMap: Record<string, string>): string | null => {\n if (!localeMap || typeof localeMap !== 'object') return null;\n\n const enUS = 'en-US';\n const browserLocale = navigator?.language || enUS;\n const langPrefix = browserLocale.split('-')[0];\n\n const partialMatch = Object.keys(localeMap).find(key => key !== browserLocale && key.split('-')[0] === langPrefix);\n\n const msg = localeMap[browserLocale] || localeMap[partialMatch] || localeMap[enUS];\n return typeof msg === 'string' && msg.length > 0 ? msg : null;\n};\n\n/**\n * Walks the product's applicable incentives (initial first, then ongoing) and\n * returns the deduped list of messages \u2014 one per unique incentive id that\n * (a) was present in the offer response's `incentives_display_enhanced` and\n * (b) has a configured benefit message in the active locale. Returns { messages: [] }\n * when no qualifying incentive has a matching message.\n */\nexport const makeBenefitMessagesSelector = memoize(\n (product: BaseProduct) =>\n createSelector(\n (state: State) => (state.incentives || {})[safeProductId(product?.id)],\n (state: State) => state.benefitMessages || {},\n (productIncentives, benefitMap) => {\n if (!productIncentives) return { messages: [] as string[] };\n\n const isPreview = window?.og?.previewMode;\n const seenIds = new Set<string>();\n const seenMessages = new Set<string>();\n\n [productIncentives.initial, productIncentives.ongoing].forEach(list => {\n (list || []).forEach(incentive => {\n if (!isPreview && !incentive?.enhanced) return;\n const id = incentive.id;\n if (!id || seenIds.has(id)) return;\n seenIds.add(id);\n const msg = resolveLocaleMessage(benefitMap[id]);\n if (!msg) return;\n seenMessages.add(msg);\n });\n });\n\n return { messages: [...seenMessages] };\n }\n ),\n product => JSON.stringify(product)\n);\n", "import { ShopifySellingPlanGroupsEntity, ShopifySellingPlansEntity } from './types/shopify';\n\nexport const money = (val: number, currency: string) =>\n val === null\n ? ''\n : new Intl.NumberFormat(navigator.language, {\n style: 'currency',\n currency\n }).format(val / 100);\n\nexport const percentage = val => `${val}%`;\n\nexport const DEFAULT_PAY_AS_YOU_GO_GROUP_NAME = 'Subscribe and Save';\nconst EXPERIMENT_SHOPIFY_APP_ID_PREFIX = 'ordergroove-subscribe-and-save-';\n\n// returns the non-prepaid OG selling plan to use for displaying frequencies\nexport const getPayAsYouGoSellingPlanGroup = (sellingPlanGroups: ShopifySellingPlanGroupsEntity[] = []) => {\n // retrieve an OG Default or PSFL Selling Plan Group, preferring to return PSFL groups if they exist\n const productSpecificFrequencySellingPlanGroup = sellingPlanGroups.find(isProductSpecificFrequencySellingPlanGroup);\n\n return (\n productSpecificFrequencySellingPlanGroup ||\n sellingPlanGroups.find(isDefaultSellingPlanGroup) ||\n sellingPlanGroups.find(isExperimentSellingPlanGroup)\n );\n};\n\n// returns OG selling plan groups that are not prepaid\nexport const getPayAsYouGoSellingPlanGroups = (sellingPlanGroups: ShopifySellingPlanGroupsEntity[] = []) => {\n return sellingPlanGroups.filter(\n group =>\n isDefaultSellingPlanGroup(group) ||\n isProductSpecificFrequencySellingPlanGroup(group) ||\n isExperimentSellingPlanGroup(group)\n );\n};\n\nconst isDefaultSellingPlanGroup = (group: ShopifySellingPlanGroupsEntity) =>\n // we need to check name or app_id - the app_id is newer and not all selling plans have it\n // the default group name is only applied to the default selling plan group\n // flex incentives selling plan groups have a different name but the same subscribe-and-save app ID\n group.name === DEFAULT_PAY_AS_YOU_GO_GROUP_NAME || group.app_id === 'ordergroove-subscribe-and-save';\n\nexport const isProductSpecificFrequencySellingPlanGroup = (group: ShopifySellingPlanGroupsEntity) =>\n group.name.startsWith('og_psfl') || group.app_id === 'ordergroove-product-specific-frequency-list';\n\nexport const isExperimentSellingPlanGroup = (group: ShopifySellingPlanGroupsEntity) =>\n // @ts-expect-error 18047\n group.app_id?.startsWith(EXPERIMENT_SHOPIFY_APP_ID_PREFIX);\n\nexport const getPayAsYouGoSellingPlan = (sellingPlans: ShopifySellingPlansEntity[]) => {\n const group = getPayAsYouGoSellingPlanGroup(sellingPlans.map(plan => plan.group));\n return sellingPlans.find(plan => plan.group === group);\n};\n\nexport function sellingPlansToFrequencies(sellingPlanGroup: ShopifySellingPlanGroupsEntity) {\n return sellingPlanGroup?.selling_plans?.map(({ id }) => `${id}`);\n}\n\nexport function sellingPlansToEveryPeriod(sellingPlanGroup: ShopifySellingPlanGroupsEntity) {\n return sellingPlanGroup?.selling_plans\n ?.map(({ options }) => options || [])\n .flat()\n .map(({ value }) => textToFreq(value));\n}\n\nexport function textToFreq(text) {\n const period = ['day', 'week', 'month'].findIndex(it => text.toLowerCase().includes(it)) + 1;\n const every = (text.match(/(\\d+)/) || ['', 1])[1];\n if (every && period) {\n return `${every}_${period}`;\n }\n return null;\n}\n\nexport function getPrepaidShipments(sellingPlan) {\n const shipments = sellingPlan?.options.find(({ name }) => name === 'Shipment amount')?.value.split(' ')[0];\n return shipments ? Number(shipments) : undefined;\n}\n\nexport function getDefaultPrepaidOption<T>(options: T[]): T {\n // prefer the second plan by default, which has more prepaid shipments\n return options[1] || options[0];\n}\n", "import platform from '../platform';\nimport { ENV_PROD, ENV_STAGING, STAGING_STATIC_HOST, STATIC_HOST } from './constants';\nimport { isSameProduct } from './selectors';\nimport { ConfigState } from './types/reducer';\n\nexport function onReady(fn) {\n if (document.readyState === 'loading') {\n window.addEventListener('DOMContentLoaded', fn);\n } else {\n fn();\n }\n}\n\nexport function getMainJs(): HTMLScriptElement {\n return document.querySelector(\n [\n `script[src^=\"https://${STATIC_HOST}\"]`,\n `script[src^=\"https://${STAGING_STATIC_HOST}\"]`,\n `script[src^=\"http://${STATIC_HOST}\"]`,\n `script[src^=\"http://${STAGING_STATIC_HOST}\"]`\n ].join(',')\n ) as HTMLScriptElement;\n}\n/**\n *\n * @returns array of two elements [merchantId, env];\n */\nexport function resolveEnvAndMerchant() {\n const script = getMainJs();\n if (!script) return [];\n const url = new URL(script.src);\n const env = url.host.startsWith(ENV_STAGING) ? ENV_STAGING : ENV_PROD;\n const merchantId = url.pathname.split('/')[1];\n\n if (!env && !merchantId) return [];\n\n return [merchantId, env, script];\n}\n\nexport const safeProductId = product => {\n if (!product) return '';\n let productId = `${product.id || product}`;\n if (platform?.shopify_selling_plans) {\n // we can't avoid make offer request since we need to know the upsell group and autoship by default\n // cart offer contains <product>:<cart_id>, we care about product only\n productId = productId.split(':')[0];\n }\n return productId;\n};\n\ntype Frequencies = ConfigState['frequencies'];\ntype FrequenciesEveryPeriod = ConfigState['frequenciesEveryPeriod'];\n\n/**\n * Returns the OG frequency if platform is running on selling plans\n */\nexport const safeOgFrequency = (\n initialFrequency: string | null,\n frequencies: Frequencies,\n frequenciesEveryPeriod: FrequenciesEveryPeriod\n) => {\n if (platform.shopify_selling_plans) {\n const ix = frequencies?.indexOf(initialFrequency);\n if (ix >= 0 && frequenciesEveryPeriod[ix]) {\n return frequenciesEveryPeriod[ix];\n }\n }\n return initialFrequency;\n};\n\nexport const frequencyToSellingPlan = (\n ogFrequency: string,\n frequencyConfig: {\n frequencies: Frequencies;\n frequenciesEveryPeriod: FrequenciesEveryPeriod;\n }\n) => {\n // og frequency contains underscore\n if (!`${ogFrequency}`.includes('_')) return ogFrequency;\n const { frequencies, frequenciesEveryPeriod } = frequencyConfig;\n const ix = frequenciesEveryPeriod?.indexOf(ogFrequency);\n if (ix >= 0 && frequenciesEveryPeriod[ix]) {\n return frequencies[ix];\n }\n\n // if we can't find the OG frequency, but we have selling plans, return the first selling plan\n if (frequencies?.length > 0 && frequenciesEveryPeriod?.length > 0) {\n console.warn(`Unable to find selling plan match for frequency ${ogFrequency}; falling back to first selling plan`);\n return frequencies[0];\n }\n\n return ogFrequency;\n};\n\n/**\n * Attempts to auto initialize the offer library reading the merchantId and env from\n * integration script i.e. <script src=\"http://static.ordergroove....\"/>.\n * Useful when local develop using http redirects\n */\nexport function autoInitializeOffers(offers) {\n if (offers.isReady()) return;\n\n console.info('OG offers are auto initializing');\n\n const [merchantId, env] = resolveEnvAndMerchant();\n if (!env && !merchantId) return;\n const script = document.createElement('script');\n script.onload = () => console.info('OG pull initialization chunk for merchant', merchantId, env);\n script.onerror = () => offers.initialize(merchantId, env);\n script.src = `${window.location.protocol}//${\n env === ENV_PROD ? STATIC_HOST : STAGING_STATIC_HOST\n }/${merchantId}/main.js?initOnly=true`;\n\n document.head.appendChild(script);\n}\n\nexport const clearCookie = cookieId => {\n // clear existing OG auth cookie\n document.cookie = `${cookieId}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;\n};\n\nexport function getCookieValue(cookieId) {\n const cookie = document.cookie.match(`(^|;) ?${cookieId}=([^;]*)(;|$)`);\n return cookie ? cookie[2] : null;\n}\nexport const isOgFrequency = (frequency: string) => !!(frequency && frequency?.includes('_'));\n\nexport const getFirstSellingPlan = (frequencies: string[] = []) => frequencies?.[0] || null;\n\nexport const hasShopifySellingPlans = (sellingPlans = [], frequenciesEveryPeriod = []) =>\n !!(platform?.shopify_selling_plans && sellingPlans.length && frequenciesEveryPeriod.length);\n\nexport const mapFrequencyToSellingPlan = (\n sellingPlans: string[],\n frequenciesEveryPeriod: string[],\n frequency: string\n) => {\n if (sellingPlans.length !== frequenciesEveryPeriod.length) {\n return null;\n }\n\n const index = frequenciesEveryPeriod.findIndex(it => it === frequency);\n\n if (index >= 0) {\n return sellingPlans[index];\n }\n\n return null;\n};\n\nexport function getOrCreateHidden(parent, name, value) {\n let input = parent.querySelector(`[name=\"${name}\"]`);\n if (input && !value) {\n input.remove();\n return;\n }\n if (!input && value) {\n input = document.createElement('input');\n input.type = 'hidden';\n input.name = name;\n parent.appendChild(input);\n }\n if (input) {\n input.value = value;\n }\n}\n\n/**\n * Returns the first matching product if it exists, or an empty object if it doesn't.\n * @param state - the optedin/optedout state array to search\n * @param product - the product to search for\n * @returns {[any, any[]]} - a two item array where the first item is the matching product and the second is the remaining items from the original state.\n */\nexport function getMatchingProductIfExists(state, product) {\n const [[oldone], rest] = state.reduce(\n (acc, val) => acc[isSameProduct(product, val) ? 0 : 1].push(val) && acc,\n [[], []]\n );\n\n return [oldone || {}, rest || []];\n}\n", "import { resolveAuth } from '@ordergroove/auth';\nimport * as constants from './constants';\nimport { api } from './api';\nimport { safeOgFrequency } from './utils';\nimport {\n makeFrequencyForPrepaidShipmentsSelector,\n makePrepaidSellingPlansSelector,\n makeProductFrequenciesSelector\n} from './selectors';\n\nexport const optinProduct = (product, frequency, offer) => ({\n type: constants.OPTIN_PRODUCT,\n payload: { product, frequency, offer }\n});\n\nexport const optoutProduct = (product, offer) => ({\n type: constants.OPTOUT_PRODUCT,\n payload: { product, offer }\n});\n\nexport const productHasChangedComponents = (newProduct, product) => ({\n type: constants.PRODUCT_HAS_CHANGED,\n payload: { newProduct, product }\n});\n\nexport const productChangeFrequency = (product, frequency, offer) => ({\n type: constants.PRODUCT_CHANGE_FREQUENCY,\n payload: { product, frequency, offer }\n});\n\nexport const productChangePrepaidShipments = (product, prepaidShipments, offer) => (dispatch, getState) => {\n // this is a thunk so that we access the state for the selector\n const frequency = makeFrequencyForPrepaidShipmentsSelector(product, prepaidShipments)(getState());\n dispatch({\n type: constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS,\n payload: { product, prepaidShipments, offer, frequency }\n });\n};\n\nexport const cartProductKeyHasChanged = (oldCartProductKey, newCartProductKey) => ({\n type: constants.CART_PRODUCT_KEY_HAS_CHANGED,\n payload: { oldCartProductKey, newCartProductKey }\n});\n\nexport const concludeUpsell = product => ({\n type: constants.CONCLUDE_UPSELL,\n payload: { product }\n});\n\nexport const setMerchantId = merchantId => ({\n type: constants.SET_MERCHANT_ID,\n payload: merchantId\n});\n\nexport const createSessionId = merchantId => ({\n type: constants.CREATED_SESSION_ID,\n payload: `${merchantId}.${Math.floor(Math.random() * 999999)}.${Math.round(new Date().getTime() / 1000.0)}`\n});\n\nexport const requestAuth = payload => ({\n type: constants.REQUEST_AUTH,\n payload\n});\n\nexport const authorize = (merchantId, sigfield, ts, sig) => ({\n type: constants.AUTHORIZE,\n payload: { public_id: merchantId, sig_field: sigfield, ts, sig }\n});\n\nexport const unauthorized = reason => ({\n type: constants.UNAUTHORIZED,\n payload: reason\n});\n\nexport const setAuthUrl = url => ({\n type: constants.SET_AUTH_URL,\n payload: url\n});\n\nexport const fetchDone = initiator => ({\n type: constants.RECEIVE_FETCH,\n payload: initiator\n});\n\n/**\n *\n * @param {*} authResolver For mock purpose.\n */\nexport const fetchAuth = (authResolver = resolveAuth) =>\n function fetchAuthThunk(dispatch, getState) {\n if (window.og && window.og.previewMode)\n return dispatch(unauthorized({ message: 'Offers are running in preview mode' }));\n\n const { merchantId, authUrl } = getState();\n\n const requestAction = requestAuth(authUrl);\n dispatch(requestAction);\n\n return authResolver(authUrl)\n .then(\n ({ sig_field, ts, sig }) => dispatch(authorize(merchantId, sig_field, ts, sig)),\n err => dispatch(unauthorized(err))\n )\n .finally(() => dispatch(fetchDone(requestAction)));\n };\n\nexport const requestOrders = (status, ordering) => ({\n type: constants.REQUEST_ORDERS,\n payload: { status, ordering }\n});\n\nexport const receiveOrders = response => ({\n type: constants.RECEIVE_ORDERS,\n payload: response\n});\n\nexport const receiveItems = response => ({\n type: constants.RECEIVE_ORDER_ITEMS,\n payload: response\n});\n\n/**\n *\n * @param {*} authResolver For mock purpose.\n */\nexport const fetchOrders = (status = 1, ordering = 'place') =>\n function fetchOrdersThunk(dispatch, getState) {\n const {\n environment: { legoUrl },\n auth\n } = getState();\n\n if (!auth) return dispatch(unauthorized('No auth set.'));\n\n const requestAction = requestOrders(status, ordering);\n dispatch(requestAction);\n\n return api\n .fetchOrders(legoUrl, auth, status, ordering)\n .then(\n response => {\n if (response.results) {\n dispatch(receiveOrders(response));\n const nextOrderId = (response.results[0] || {}).public_id;\n if (nextOrderId) {\n return api.fetchItems(legoUrl, auth, nextOrderId).then(res => dispatch(receiveItems(res)));\n }\n }\n dispatch(unauthorized(response.detail));\n return null;\n },\n err => dispatch(unauthorized(err))\n )\n .finally(() => dispatch(fetchDone(requestAction)));\n };\n\nexport const setEnvironment = env => {\n switch (env) {\n case constants.ENV_LOCAL:\n return {\n type: constants.SET_ENVIRONMENT_LOCAL,\n payload: env\n };\n case constants.ENV_DEV:\n return {\n type: constants.SET_ENVIRONMENT_DEV,\n payload: env\n };\n case constants.ENV_STAGING:\n return {\n type: constants.SET_ENVIRONMENT_STAGING,\n payload: env\n };\n case constants.ENV_PROD:\n return {\n type: constants.SET_ENVIRONMENT_PROD,\n payload: env\n };\n default:\n throw new Error(`${env} is not a supported environment`);\n }\n};\n\n/**\n * dispatchs an createSessionId() if sessionId is not present\n */\nexport const requestSessionId = () => (dispatch, getState) => {\n const { merchantId, sessionId } = getState();\n if (!sessionId || (merchantId && !sessionId.startsWith(merchantId))) {\n dispatch(createSessionId(merchantId));\n }\n return sessionId;\n};\n\nexport const receiveOffer = (response, offer, productId) => (dispatch, getState) => {\n // this is a thunk so that we access the state for the selector\n const state = getState();\n const frequencyConfig = makeProductFrequenciesSelector(productId)(state);\n const prepaidSellingPlans = makePrepaidSellingPlansSelector(productId)(state);\n dispatch({\n type: constants.RECEIVE_OFFER,\n payload: { ...response, offer, frequencyConfig, prepaidSellingPlans }\n });\n};\n\nexport const fetchResponseError = err => ({\n type: constants.FETCH_RESPONSE_ERROR,\n payload: err\n});\n\nexport const requestOffer = (product, module = constants.DEFAULT_OFFER_MODULE, offer) => ({\n type: constants.REQUEST_OFFER,\n payload: { product, module, offer }\n});\n\nexport const fetchOffer = requestOffer;\n\nexport const checkout = () => ({\n type: constants.CHECKOUT\n});\n\nexport const requestCreateOneTime = (product, order, quantity, offerId) => ({\n type: constants.REQUEST_CREATE_IU_ORDER,\n payload: { product, order, quantity, offerId }\n});\n\nexport const receiveCreateOneTime = payload => ({\n type: constants.CREATE_ONE_TIME,\n payload\n});\n\nexport const requestConvertOneTimeToSubscription = (item, frequency) => ({\n type: constants.REQUEST_CONVERT_ONE_TIME,\n payload: { item, frequency }\n});\n\nexport const receiveConvertOneTime = (response, product) => ({\n type: constants.CONVERT_ONE_TIME,\n payload: { response, product }\n});\n\nexport const createIu = (product, order, quantity, subscribed = false, initialFrequency = null) =>\n function createIuThunk(dispatch, getState) {\n const state = getState();\n const {\n auth,\n environment: { legoUrl },\n previewUpsellOffer,\n offerId: offer,\n sessionId\n } = state;\n\n if (!auth) return dispatch(unauthorized('No auth set.'));\n\n const { frequencies, frequenciesEveryPeriod } = makeProductFrequenciesSelector(product.id)(state);\n const frequency = safeOgFrequency(initialFrequency, frequencies, frequenciesEveryPeriod);\n\n const requestAction = requestCreateOneTime(product, order, quantity, offer);\n\n dispatch(requestAction);\n\n return (\n previewUpsellOffer\n ? Promise.resolve({ legoUrl, product, order, quantity, offer })\n : api.createOneTime(legoUrl, auth, product.id, order, quantity, offer)\n )\n .then(\n item => {\n dispatch(receiveCreateOneTime(item));\n if (subscribed) {\n dispatch(requestConvertOneTimeToSubscription(item, frequency));\n return (\n previewUpsellOffer\n ? Promise.resolve({ item, frequency })\n : api.convertOneTimeToSubscription(legoUrl, auth, item, frequency, offer, sessionId)\n ).then(\n response => dispatch(receiveConvertOneTime(response, product)),\n err => dispatch(fetchResponseError(err))\n );\n }\n return item;\n },\n err => dispatch(fetchResponseError(err))\n )\n\n .finally(() => dispatch(fetchDone(requestAction)));\n };\n\nexport const setLocale = payload => ({\n type: constants.SET_LOCALE,\n payload\n});\n\nexport const setConfig = payload => ({\n type: constants.SET_CONFIG,\n payload\n});\n\nexport const setBenefitMessages = payload => ({\n type: constants.SET_BENEFIT_MESSAGES,\n payload\n});\n\nexport const addTemplate = (selector, markup, config) => ({\n type: constants.ADD_TEMPLATE,\n payload: { selector, markup, config }\n});\n\nexport const setTemplates = templates => ({\n type: constants.SET_TEMPLATES,\n payload: templates\n});\n\nexport const setFirstOrderPlaceDate = (product, firstOrderPlaceDate) => ({\n type: constants.SET_FIRST_ORDER_PLACE_DATE,\n payload: { product, firstOrderPlaceDate }\n});\n\nexport const setProductToSubscribe = (product, productToSubscribe) => ({\n type: constants.SET_PRODUCT_TO_SUBSCRIBE,\n payload: { product, productToSubscribe }\n});\n\n/**\n * @param {import('../core/types/api').MerchantSettings} settings\n */\nexport const receiveMerchantSettings = settings => ({\n type: constants.RECEIVE_MERCHANT_SETTINGS,\n payload: settings\n});\n", "import { throttle } from 'throttle-debounce';\nimport * as constants from './constants';\nimport { saveState } from './localStorage';\n\nexport const dispatchEvent = (name, detail, el = document) =>\n el.dispatchEvent(\n new CustomEvent(name, {\n detail\n })\n );\n\nexport const dispatchOptinChangedEvent =\n optedIn =>\n ({ payload: { product: { id: productId, components } = {} } = {} } = {}) =>\n setTimeout(\n () =>\n dispatchEvent('optin-changed', {\n productId,\n components,\n optedIn\n }),\n 0\n );\n\nexport const conditionals = [\n {\n expressions: [\n ({ type } = {}) => type === constants.OPTIN_PRODUCT,\n ({ type } = {}) => type === constants.PRODUCT_CHANGE_FREQUENCY\n ],\n fn: dispatchOptinChangedEvent(true)\n },\n {\n expressions: [({ type } = {}) => type === constants.OPTOUT_PRODUCT],\n fn: dispatchOptinChangedEvent(false)\n }\n];\n\nexport const dispatchMiddleware = store => next => action => {\n const state = store.getState();\n conditionals.forEach(conditional => {\n if (conditional.expressions.some(expression => expression(action, state))) conditional.fn(action);\n });\n\n next(action);\n};\n\n/**\n * Middleware that forwards sensitive actions to DOM events\n * events:\n * - og-receive-offer\n * - og-optout-product\n * - og-optin-product\n * - og-product-change-frequency\n * event.details contains the action payload\n * event.details corresponds to the offer DOM element if available or document\n *\n * If event.preventDefault() is called, the action being fired will not change the state.\n * @param {*} store\n * @returns\n */\nexport const offerEvents = _store => next => action => {\n let ev;\n /* eslint-disable no-fallthrough */\n switch (action.type) {\n // event: og-receive-offer\n case constants.RECEIVE_OFFER:\n // event: og-optout-product\n case constants.OPTOUT_PRODUCT:\n // event: og-optin-product\n case constants.OPTIN_PRODUCT:\n // event: og-product-change-frequency\n case constants.PRODUCT_CHANGE_FREQUENCY:\n ev = new CustomEvent(`og-${action.type.toLowerCase().replace(/_/g, '-')}`, {\n bubbles: true,\n cancelable: true,\n detail: action.payload\n });\n (action.payload?.offer || document).dispatchEvent(ev);\n break;\n default:\n }\n\n if (!ev?.defaultPrevented) next(action);\n};\n\nexport const localStorageMiddleware = store => next => action => {\n next(action);\n\n const callToSave = throttle(500, () => {\n saveState({\n ...store.getState()\n });\n });\n\n if (action.type !== constants.LOCAL_STORAGE_CHANGE) {\n callToSave();\n }\n};\n", "import { createSessionId, fetchAuth } from './actions';\nimport {\n CREATED_SESSION_ID,\n SET_ENVIRONMENT_LOCAL,\n SET_ENVIRONMENT_DEV,\n SET_ENVIRONMENT_PROD,\n SET_ENVIRONMENT_STAGING,\n SET_MERCHANT_ID,\n READY\n} from './constants';\nimport { listenLocalStorageChanges } from './localStorage';\n\nexport const waitFor = () => {\n let resolve, reject;\n return [\n new Promise((yes, no) => {\n resolve = yes;\n reject = no;\n }),\n resolve,\n reject\n ];\n};\n/**\n * Middleware that awaits offers being initialized and resumes the regular actions after.\n * @param {*} store\n * @returns\n */\nexport function waitUntilOffersReady(store) {\n const [waitForSetEnv, resolveEnv] = waitFor();\n const [waitForMerchantId, resolveMerchantId] = waitFor();\n const [waitForSessionId, resolveSessionId] = waitFor();\n\n waitForMerchantId.then(merchantId => {\n const { sessionId } = store.getState();\n if (!sessionId || (merchantId && !sessionId.startsWith(merchantId))) {\n store.dispatch(createSessionId(merchantId));\n } else {\n resolveSessionId(sessionId);\n }\n });\n\n const waitForReady = Promise.all([waitForMerchantId, waitForSetEnv, waitForSessionId]);\n\n waitForReady.then(() => {\n store.dispatch({ type: READY, payload: {} });\n window.addEventListener('storage', listenLocalStorageChanges(store));\n if (!store.getState().auth?.ts) {\n store.dispatch(fetchAuth());\n }\n });\n\n return next => async action => {\n if (\n SET_ENVIRONMENT_LOCAL === action.type ||\n SET_ENVIRONMENT_DEV === action.type ||\n SET_ENVIRONMENT_STAGING === action.type ||\n SET_ENVIRONMENT_PROD === action.type\n ) {\n resolveEnv(action.payload);\n } else if (SET_MERCHANT_ID === action.type) {\n resolveMerchantId(action.payload);\n } else if (CREATED_SESSION_ID === action.type) {\n resolveSessionId(action.payload);\n } else {\n await waitForReady;\n }\n next(action);\n };\n}\n", "import { fetchDone, fetchResponseError, receiveOffer } from './actions';\nimport api from './api';\nimport { DEFAULT_OFFER_MODULE, REQUEST_OFFER } from './constants';\nimport { safeProductId } from './utils';\n\nexport function offerRequestMiddleware(store) {\n return next => action => {\n if (action.type === REQUEST_OFFER) {\n const {\n merchantId,\n sessionId,\n environment: { apiUrl }\n } = store.getState();\n\n const productId = safeProductId(action.payload.product);\n if (productId)\n api\n .fetchOffer(\n apiUrl,\n merchantId,\n sessionId,\n productId,\n action.payload.module || DEFAULT_OFFER_MODULE,\n action.payload.searchParams\n )\n .then(\n response => store.dispatch(receiveOffer(response, action.payload.offer, productId)),\n err => store.dispatch(fetchResponseError(err))\n )\n .finally(() => store.dispatch(fetchDone(action)));\n }\n return next(action);\n };\n}\n", "import { READY, RECEIVE_MERCHANT_SETTINGS, REQUEST_OFFER, SET_EXPERIMENT_VARIANT, SETUP_PRODUCT } from './constants';\nimport murmur from 'murmurhash-js';\nimport { waitFor } from './waitUntilOffersReady';\nimport { isExperimentSellingPlanGroup } from '../shopify/utils';\n\n/**\n * Returns the index of a variant based on the provided key and variants.\n * The index is determined by the weighted distribution of the variants.\n *\n * @param {string} key - The key used to determine the variant index.\n * @param {object[]} variants - An array of objects containing the variant weights.\n * @return {number} The index of the selected variant.\n */\nfunction getVariantIx(key, variants) {\n const weights = variants.map(variant => variant.weight);\n if (weights.reduce((a, b) => a + b, 0) !== 100) {\n console.error('OG: Sum of weights for variants must be 100. Defaulting to last variant.');\n }\n const m = murmur.murmur3(key, 0);\n const n = m % 100;\n\n let lower_bound = 0;\n\n for (let i = 0; i < variants.length; i++) {\n const v = variants[i];\n const upper_bound = lower_bound + v.weight;\n\n // If a variant has a weight of 0, ignore it\n if (v.weight > 0 && n < upper_bound) {\n return i;\n }\n\n lower_bound = upper_bound;\n }\n return variants.length - 1;\n}\n\n/**\n * Reduces the state of experiments based on the provided action.\n *\n * @param {object} state - The current state of experiments.\n * @param {object} action - The action to be applied to the state.\n * @return {object} The updated state of experiments.\n */\nexport function experimentsReducer(state = {}, action) {\n switch (action.type) {\n case RECEIVE_MERCHANT_SETTINGS:\n return { ...state, ...action.payload.experiments };\n\n case SET_EXPERIMENT_VARIANT:\n return {\n ...state,\n currentVariant: action.payload.index,\n offerProfileId: action.payload.parameters?.offer_profile_public_id\n };\n default:\n return state;\n }\n}\n\n/**\n * Resolve the Shopify product setup when in an experiment.\n * @param {object} variant - The experiment variant assigned to the customer.\n * @param {object} product - The Shopify product object.\n * @param {object} experimentSettings - The experiment settings object containing the public ID and variants.\n * @return {object} The modified product object with OG selling plan groups filtered out.\n *\n * This function filters a Shopify product's selling plan groups to only include the group\n * associated with the assigned experiment variant, and updates the product's variants to\n * only include selling plan allocations from that group. It returns the modified product\n * object.\n */\nfunction resolveShopifySetupProductWhenExperiment(variant, product, experimentSettings) {\n // When an experiment is running, you may have multiple selling plan groups with the app_id \"ordergroove-subscribe-and-save-{experiment_variant_id}\"\n // We want offers to use only the selling plan group that matches the assigned experiment variant\n // Note: whether or not you have variant-specific selling plan groups depends on if the Shopify Discount Function is being used. If it is, then the selling plan groups do not contain price adjustments and there is only a single selling plan group (all variants use the same group).\n if (!variant) return;\n\n if (experimentSettings.variants.length === 0) return;\n\n const sellingPlanGroups = product.selling_plan_groups.filter(isExperimentSellingPlanGroup);\n\n if (sellingPlanGroups.length !== experimentSettings.variants.length) return;\n\n const sellingPlanGroup = sellingPlanGroups.find(({ app_id }) => app_id.endsWith(variant.public_id));\n\n if (!sellingPlanGroup) return;\n\n return {\n ...product,\n selling_plan_groups: [sellingPlanGroup],\n\n variants: product.variants.map(({ selling_plan_allocations, ...it }) => ({\n ...it,\n selling_plan_allocations: selling_plan_allocations.filter(\n ({ selling_plan_group_id }) => selling_plan_group_id === sellingPlanGroup.id\n )\n }))\n };\n}\n\n/**\n * Retrieves the assigned experiment variant based on the provided experiment settings and session ID.\n *\n * @param {object} experimentSettings - The experiment settings object containing the public ID and variants.\n * @param {string} sessionId - The unique session ID used to determine the variant assignment.\n * @return {object} An object containing the assigned variant and its index.\n */\nexport function getAssignedExperimentVariant(experimentSettings, sessionId) {\n const experimentPublicId = experimentSettings?.public_id;\n\n if (!experimentPublicId) {\n return null;\n }\n const variants = experimentSettings.variants;\n const index = getVariantIx(`${experimentPublicId}|${sessionId}`, variants);\n const variant = variants[index];\n\n return { ...variant, index };\n}\n\n/**\n * A middleware function that handles experiment-related actions.\n *\n *\n * @param {object} store - The Redux store object.\n * @return {function} A function that takes the next middleware function and an action as arguments.\n */\nexport function experimentsMiddleware(store) {\n const [waitForReady, resolveReady] = waitFor();\n\n let variant, experimentSettings;\n\n return next => async action => {\n if (action.type === READY) {\n resolveReady();\n } else if (action.type === RECEIVE_MERCHANT_SETTINGS) {\n await waitForReady;\n experimentSettings = action.payload.experiments;\n\n const { sessionId } = store.getState();\n\n variant = getAssignedExperimentVariant(experimentSettings, sessionId);\n\n if (variant) {\n store.dispatch({\n type: SET_EXPERIMENT_VARIANT,\n payload: variant\n });\n }\n } else if (action.type === REQUEST_OFFER) {\n await waitForReady;\n if (variant) {\n action.payload.searchParams = {\n ...action.payload.searchParams,\n variant: variant.public_id\n };\n }\n } else if (action.type === SETUP_PRODUCT) {\n await waitForReady;\n const newProduct = resolveShopifySetupProductWhenExperiment(variant, action.payload.product, experimentSettings);\n if (newProduct) {\n return next({\n type: SETUP_PRODUCT,\n payload: {\n ...action.payload,\n experiments: true,\n originalPayload: action.payload,\n product: newProduct\n }\n });\n }\n }\n\n return next(action);\n };\n}\n", "import { createStore, compose, applyMiddleware } from 'redux';\nimport thunk from 'redux-thunk';\n\nimport { loadState } from './localStorage';\nimport { dispatchMiddleware, localStorageMiddleware, offerEvents } from './middleware';\nimport { waitUntilOffersReady } from './waitUntilOffersReady';\nimport { offerRequestMiddleware } from './offerRequest';\nimport { experimentsMiddleware } from './experiments';\n\nexport function makeStore(reducer, ...extraMiddlewares) {\n if (window.og && window.og.store) return window.og.store;\n\n const isPreviewMode = window.og && window.og.previewMode;\n\n const composeEnhancers =\n typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__\n ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({\n name: 'Ordergroove Offers'\n })\n : compose;\n\n const middlewares = [\n waitUntilOffersReady,\n thunk,\n experimentsMiddleware,\n offerRequestMiddleware,\n dispatchMiddleware,\n offerEvents\n ];\n\n let initial = {};\n\n if (!isPreviewMode) {\n try {\n initial = loadState();\n middlewares.push(localStorageMiddleware);\n } catch (err) {\n // localStorage not available during preview in sandbox\n }\n }\n\n const enhancer = composeEnhancers(applyMiddleware(...middlewares, ...extraMiddlewares.filter(it => it)));\n const store = createStore(reducer, initial, enhancer);\n\n window.og = window.og || {};\n window.og.store = store;\n return store;\n}\n\nexport default makeStore;\n", "export const createIsMessageAllowed = allowedOrigin => ev => allowedOrigin.indexOf(ev.origin) >= 0;\nexport default createIsMessageAllowed;\n", "import { createIsMessageAllowed } from './core/createIsMessageAllowed';\n\nconst allowedOrigin = [\n 'https://rc3.ordergroove.com',\n 'https://rc3.stg.ordergroove.com',\n 'https://rc3-beta.stg.ordergroove.com',\n 'http://localhost:3000',\n 'http://localhost:3010',\n 'http://0.0.0.0:3010',\n window.location.origin\n];\n\nconst createBroadcastMessage = opener => (ogType, data) => {\n allowedOrigin.forEach(target => opener.postMessage({ ogType, ...data }, target));\n};\n\nexport function offersLiveEditor(opener = window.opener, og = window.og) {\n const handleReady = ev => {\n const isMessageAllowed = createIsMessageAllowed(allowedOrigin);\n const broadcastMessage = createBroadcastMessage(ev.source);\n const options = ev.data.options || {};\n\n if (isMessageAllowed(ev)) {\n if (ev.data.ogType === 'READY') {\n let publicPath = window.OG_CDN_PUBLIC_PATH || './';\n if (publicPath.startsWith('//')) publicPath = window.location.protocol + publicPath;\n if (!publicPath.endsWith('/')) publicPath += '/';\n\n import(`${publicPath}client.js`).then(({ initializeClient }) => {\n initializeClient({ isMessageAllowed, broadcastMessage, options, og });\n window.removeEventListener('message', handleReady);\n });\n }\n }\n };\n\n if (opener && opener !== window) {\n window.addEventListener('message', handleReady);\n createBroadcastMessage(opener)('READY');\n }\n}\n\nexport default offersLiveEditor;\n", "import { bindActionCreators } from 'redux';\n\nlet storeInstance = null;\n\nconst defaultMapDispatchToProps = dispatch => ({ dispatch });\n\nexport const resolveStore = _obj => {\n if (!storeInstance) throw new Error('Missing redux store.');\n return storeInstance;\n};\n\nexport const createRecalcProps = (mapStateToProps, mapDispatchToProps) => obj => {\n const { getState, dispatch } = resolveStore(obj);\n const stateProps = mapStateToProps ? mapStateToProps(getState(), obj) : {};\n const dispatchProps = mapDispatchToProps(dispatch, obj);\n\n Object.assign(obj, stateProps, dispatchProps);\n};\n\n/**\n * TODO this component can be coded as regular connect function. Instead of making the component\n * tied to stateChanged connect can accept mapStateToProps?, mapDispatchToProps?\n */\nexport const connect =\n (mapStateToProps, mapDispatchToProps = defaultMapDispatchToProps) =>\n baseElement => {\n const preparedDispatch =\n typeof mapDispatchToProps === 'function'\n ? mapDispatchToProps\n : dispatch => bindActionCreators(mapDispatchToProps, dispatch);\n\n const recalcProps = createRecalcProps(mapStateToProps, preparedDispatch);\n\n return class extends baseElement {\n get store() {\n return storeInstance;\n }\n\n connectedCallback() {\n if (super.connectedCallback) {\n super.connectedCallback();\n }\n\n this._storeUnsubscribe = resolveStore(this).subscribe(() => recalcProps(this));\n recalcProps(this);\n }\n\n attributeChangedCallback(name, old, value) {\n if (super.attributeChangedCallback) super.attributeChangedCallback(name, old, value);\n if (this._storeUnsubscribe && old !== value) recalcProps(this);\n }\n\n disconnectedCallback() {\n this._storeUnsubscribe();\n if (super.disconnectedCallback) {\n super.disconnectedCallback();\n }\n }\n };\n };\n/**\n * This api will change asap\n * @deprecated\n * @param {@} _store\n */\nexport const setStore = _store => {\n storeInstance = _store;\n};\n/**\n * Only for test purpose\n */\nexport const unsetStore = () => {\n storeInstance = undefined;\n};\n\nexport default connect;\n", "import { parseFrequency } from './api';\n\n/**\n * Convert the current redux state to purchase\n * post compatible json\n */\nexport const getProductsForPurchasePost = (state = {}, productIds = []) =>\n (state.optedin || [])\n .map(optin => {\n const purchasePostObject = {\n product: optin.id,\n subscription_info: {\n components: optin.components || []\n },\n tracking_override: {\n offer: ((state.productOffer || {})[optin.id] || [])[0],\n ...(state.sessionId && { session_id: state.sessionId }),\n ...parseFrequency(optin.frequency)\n }\n };\n if (state.firstOrderPlaceDate && state.firstOrderPlaceDate[optin.id]) {\n purchasePostObject.subscription_info.first_order_place_date = state.firstOrderPlaceDate[optin.id];\n }\n if (state.productToSubscribe && state.productToSubscribe[optin.id]) {\n purchasePostObject.tracking_override.product = state.productToSubscribe[optin.id];\n }\n return purchasePostObject;\n })\n .filter(optin => optin.tracking_override.offer)\n .filter(optin => (productIds.length ? productIds.includes(optin.product) : optin));\n\n/**\n * Convert the old redux state from productPlans that was array structured:\n * {\n * '1_2': ['$15.00', '10%', '$13.50'],\n * '2_2': ['$15.00', '10%', '$13.50']\n * }\n * to a object structured one that can hold more information with keys:\n * [\n * {\n * frequency: '1_2',\n * prepaidShipments: '3' or null,\n * regularPrice: '$15.00',\n * subscriptionPrice: '$13.50',\n * discountRate: '10%'\n * },\n * ]\n *\n * @returns {import('./types/reducer').ProductPlansState}\n */\nexport const getObjectStructuredProductPlans = (productPlans = {}) => {\n const adaptedProductPlans = {};\n\n Object.entries(productPlans).forEach(([productVariant, productPlanOnArrayStructure]) => {\n Object.entries(productPlanOnArrayStructure).forEach(([frequencyAsKey, arrayPrices]) => {\n let newProductPlanStructure = {};\n if (arrayPrices && !Array.isArray(arrayPrices)) {\n newProductPlanStructure = arrayPrices;\n } else {\n newProductPlanStructure = {\n frequency: frequencyAsKey,\n prepaidShipments: null,\n regularPrice: arrayPrices[0],\n subscriptionPrice: arrayPrices[2],\n discountRate: arrayPrices[1]\n };\n }\n\n if (adaptedProductPlans[productVariant]) {\n adaptedProductPlans[productVariant].push(newProductPlanStructure);\n } else {\n adaptedProductPlans[productVariant] = [newProductPlanStructure];\n }\n });\n });\n\n return adaptedProductPlans;\n};\n\nexport default { getProductsForPurchasePost, getObjectStructuredProductPlans };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\ninterface MaybePolyfilledCe extends CustomElementRegistry {\n readonly polyfillWrapFlushCallback?: object;\n}\n\n/**\n * True if the custom elements polyfill is in use.\n */\nexport const isCEPolyfill = typeof window !== 'undefined' &&\n window.customElements != null &&\n (window.customElements as MaybePolyfilledCe).polyfillWrapFlushCallback !==\n undefined;\n\n/**\n * Reparents nodes, starting from `start` (inclusive) to `end` (exclusive),\n * into another container (could be the same container), before `before`. If\n * `before` is null, it appends the nodes to the container.\n */\nexport const reparentNodes =\n (container: Node,\n start: Node|null,\n end: Node|null = null,\n before: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.insertBefore(start!, before);\n start = n;\n }\n };\n\n/**\n * Removes nodes, starting from `start` (inclusive) to `end` (exclusive), from\n * `container`.\n */\nexport const removeNodes =\n (container: Node, start: Node|null, end: Node|null = null): void => {\n while (start !== end) {\n const n = start!.nextSibling;\n container.removeChild(start!);\n start = n;\n }\n };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\n\n/**\n * An expression marker with embedded unique key to avoid collision with\n * possible text in templates.\n */\nexport const marker = `{{lit-${String(Math.random()).slice(2)}}}`;\n\n/**\n * An expression marker used text-positions, multi-binding attributes, and\n * attributes with markup-like text values.\n */\nexport const nodeMarker = `<!--${marker}-->`;\n\nexport const markerRegex = new RegExp(`${marker}|${nodeMarker}`);\n\n/**\n * Suffix appended to all bound attribute names.\n */\nexport const boundAttributeSuffix = '$lit$';\n\n/**\n * An updatable Template that tracks the location of dynamic parts.\n */\nexport class Template {\n readonly parts: TemplatePart[] = [];\n readonly element: HTMLTemplateElement;\n\n constructor(result: TemplateResult, element: HTMLTemplateElement) {\n this.element = element;\n\n const nodesToRemove: Node[] = [];\n const stack: Node[] = [];\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n element.content,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n // Keeps track of the last index associated with a part. We try to delete\n // unnecessary nodes, but we never want to associate two different parts\n // to the same index. They must have a constant node between.\n let lastPartIndex = 0;\n let index = -1;\n let partIndex = 0;\n const {strings, values: {length}} = result;\n while (partIndex < length) {\n const node = walker.nextNode() as Element | Comment | Text | null;\n if (node === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n continue;\n }\n index++;\n\n if (node.nodeType === 1 /* Node.ELEMENT_NODE */) {\n if ((node as Element).hasAttributes()) {\n const attributes = (node as Element).attributes;\n const {length} = attributes;\n // Per\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap,\n // attributes are not guaranteed to be returned in document order.\n // In particular, Edge/IE can return them out of order, so we cannot\n // assume a correspondence between part index and attribute index.\n let count = 0;\n for (let i = 0; i < length; i++) {\n if (endsWith(attributes[i].name, boundAttributeSuffix)) {\n count++;\n }\n }\n while (count-- > 0) {\n // Get the template literal section leading up to the first\n // expression in this attribute\n const stringForPart = strings[partIndex];\n // Find the attribute name\n const name = lastAttributeNameRegex.exec(stringForPart)![2];\n // Find the corresponding attribute\n // All bound attributes have had a suffix added in\n // TemplateResult#getHTML to opt out of special attribute\n // handling. To look up the attribute value we also need to add\n // the suffix.\n const attributeLookupName =\n name.toLowerCase() + boundAttributeSuffix;\n const attributeValue =\n (node as Element).getAttribute(attributeLookupName)!;\n (node as Element).removeAttribute(attributeLookupName);\n const statics = attributeValue.split(markerRegex);\n this.parts.push({type: 'attribute', index, name, strings: statics});\n partIndex += statics.length - 1;\n }\n }\n if ((node as Element).tagName === 'TEMPLATE') {\n stack.push(node);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n } else if (node.nodeType === 3 /* Node.TEXT_NODE */) {\n const data = (node as Text).data;\n if (data.indexOf(marker) >= 0) {\n const parent = node.parentNode!;\n const strings = data.split(markerRegex);\n const lastIndex = strings.length - 1;\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for node parts\n for (let i = 0; i < lastIndex; i++) {\n let insert: Node;\n let s = strings[i];\n if (s === '') {\n insert = createMarker();\n } else {\n const match = lastAttributeNameRegex.exec(s);\n if (match !== null && endsWith(match[2], boundAttributeSuffix)) {\n s = s.slice(0, match.index) + match[1] +\n match[2].slice(0, -boundAttributeSuffix.length) + match[3];\n }\n insert = document.createTextNode(s);\n }\n parent.insertBefore(insert, node);\n this.parts.push({type: 'node', index: ++index});\n }\n // If there's no text, we must insert a comment to mark our place.\n // Else, we can trust it will stick around after cloning.\n if (strings[lastIndex] === '') {\n parent.insertBefore(createMarker(), node);\n nodesToRemove.push(node);\n } else {\n (node as Text).data = strings[lastIndex];\n }\n // We have a part for each match found\n partIndex += lastIndex;\n }\n } else if (node.nodeType === 8 /* Node.COMMENT_NODE */) {\n if ((node as Comment).data === marker) {\n const parent = node.parentNode!;\n // Add a new marker node to be the startNode of the Part if any of\n // the following are true:\n // * We don't have a previousSibling\n // * The previousSibling is already the start of a previous part\n if (node.previousSibling === null || index === lastPartIndex) {\n index++;\n parent.insertBefore(createMarker(), node);\n }\n lastPartIndex = index;\n this.parts.push({type: 'node', index});\n // If we don't have a nextSibling, keep this node so we have an end.\n // Else, we can remove it to save future costs.\n if (node.nextSibling === null) {\n (node as Comment).data = '';\n } else {\n nodesToRemove.push(node);\n index--;\n }\n partIndex++;\n } else {\n let i = -1;\n while ((i = (node as Comment).data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n // TODO (justinfagnani): consider whether it's even worth it to\n // make bindings in comments work\n this.parts.push({type: 'node', index: -1});\n partIndex++;\n }\n }\n }\n }\n\n // Remove text binding nodes after the walk to not disturb the TreeWalker\n for (const n of nodesToRemove) {\n n.parentNode!.removeChild(n);\n }\n }\n}\n\nconst endsWith = (str: string, suffix: string): boolean => {\n const index = str.length - suffix.length;\n return index >= 0 && str.slice(index) === suffix;\n};\n\n/**\n * A placeholder for a dynamic expression in an HTML template.\n *\n * There are two built-in part types: AttributePart and NodePart. NodeParts\n * always represent a single dynamic expression, while AttributeParts may\n * represent as many expressions are contained in the attribute.\n *\n * A Template's parts are mutable, so parts can be replaced or modified\n * (possibly to implement different template semantics). The contract is that\n * parts can only be replaced, not removed, added or reordered, and parts must\n * always consume the correct number of values in their `update()` method.\n *\n * TODO(justinfagnani): That requirement is a little fragile. A\n * TemplateInstance could instead be more careful about which values it gives\n * to Part.update().\n */\nexport type TemplatePart = {\n readonly type: 'node'; index: number;\n}|{\n readonly type: 'attribute';\n index: number;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n};\n\nexport const isTemplatePartActive = (part: TemplatePart) => part.index !== -1;\n\n// Allows `document.createComment('')` to be renamed for a\n// small manual size-savings.\nexport const createMarker = () => document.createComment('');\n\n/**\n * This regex extracts the attribute name preceding an attribute-position\n * expression. It does this by matching the syntax allowed for attributes\n * against the string literal directly preceding the expression, assuming that\n * the expression is in an attribute-value position.\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\x09\\x0a\\x0c\\x0d\" are HTML space characters:\n * https://www.w3.org/TR/html5/infrastructure.html#space-characters\n *\n * \"\\0-\\x1F\\x7F-\\x9F\" are Unicode control characters, which includes every\n * space character except \" \".\n *\n * So an attribute is:\n * * The name: any character except a control character, space character, ('),\n * (\"), \">\", \"=\", or \"/\"\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nexport const lastAttributeNameRegex =\n // eslint-disable-next-line no-control-regex\n /([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\nconst walkerNodeFilter = 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */;\n\n/**\n * Removes the list of nodes from a Template safely. In addition to removing\n * nodes from the Template, the Template part indices are updated to match\n * the mutated Template DOM.\n *\n * As the template is walked the removal state is tracked and\n * part indices are adjusted as needed.\n *\n * div\n * div#1 (remove) <-- start removing (removing node is div#1)\n * div\n * div#2 (remove) <-- continue removing (removing node is still div#1)\n * div\n * div <-- stop removing since previous sibling is the removing node (div#1,\n * removed 4 nodes)\n */\nexport function removeNodesFromTemplate(\n template: Template, nodesToRemove: Set<Node>) {\n const {element: {content}, parts} = template;\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let part = parts[partIndex];\n let nodeIndex = -1;\n let removeCount = 0;\n const nodesToRemoveInTemplate = [];\n let currentRemovingNode: Node|null = null;\n while (walker.nextNode()) {\n nodeIndex++;\n const node = walker.currentNode as Element;\n // End removal if stepped past the removing node\n if (node.previousSibling === currentRemovingNode) {\n currentRemovingNode = null;\n }\n // A node to remove was found in the template\n if (nodesToRemove.has(node)) {\n nodesToRemoveInTemplate.push(node);\n // Track node we're removing\n if (currentRemovingNode === null) {\n currentRemovingNode = node;\n }\n }\n // When removing, increment count by which to adjust subsequent part indices\n if (currentRemovingNode !== null) {\n removeCount++;\n }\n while (part !== undefined && part.index === nodeIndex) {\n // If part is in a removed node deactivate it by setting index to -1 or\n // adjust the index as needed.\n part.index = currentRemovingNode !== null ? -1 : part.index - removeCount;\n // go to the next active part.\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n part = parts[partIndex];\n }\n }\n nodesToRemoveInTemplate.forEach((n) => n.parentNode!.removeChild(n));\n}\n\nconst countNodes = (node: Node) => {\n let count = (node.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */) ? 0 : 1;\n const walker = document.createTreeWalker(node, walkerNodeFilter, null, false);\n while (walker.nextNode()) {\n count++;\n }\n return count;\n};\n\nconst nextActiveIndexInTemplateParts =\n (parts: TemplatePart[], startIndex = -1) => {\n for (let i = startIndex + 1; i < parts.length; i++) {\n const part = parts[i];\n if (isTemplatePartActive(part)) {\n return i;\n }\n }\n return -1;\n };\n\n/**\n * Inserts the given node into the Template, optionally before the given\n * refNode. In addition to inserting the node into the Template, the Template\n * part indices are updated to match the mutated Template DOM.\n */\nexport function insertNodeIntoTemplate(\n template: Template, node: Node, refNode: Node|null = null) {\n const {element: {content}, parts} = template;\n // If there's no refNode, then put node at end of template.\n // No part indices need to be shifted in this case.\n if (refNode === null || refNode === undefined) {\n content.appendChild(node);\n return;\n }\n const walker =\n document.createTreeWalker(content, walkerNodeFilter, null, false);\n let partIndex = nextActiveIndexInTemplateParts(parts);\n let insertCount = 0;\n let walkerIndex = -1;\n while (walker.nextNode()) {\n walkerIndex++;\n const walkerNode = walker.currentNode as Element;\n if (walkerNode === refNode) {\n insertCount = countNodes(node);\n refNode.parentNode!.insertBefore(node, refNode);\n }\n while (partIndex !== -1 && parts[partIndex].index === walkerIndex) {\n // If we've inserted the node, simply adjust all subsequent parts\n if (insertCount > 0) {\n while (partIndex !== -1) {\n parts[partIndex].index += insertCount;\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n return;\n }\n partIndex = nextActiveIndexInTemplateParts(parts, partIndex);\n }\n }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\n\nconst directives = new WeakMap<object, true>();\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DirectiveFactory = (...args: any[]) => object;\n\nexport type DirectiveFn = (part: Part) => void;\n\n/**\n * Brands a function as a directive factory function so that lit-html will call\n * the function during template rendering, rather than passing as a value.\n *\n * A _directive_ is a function that takes a Part as an argument. It has the\n * signature: `(part: Part) => void`.\n *\n * A directive _factory_ is a function that takes arguments for data and\n * configuration and returns a directive. Users of directive usually refer to\n * the directive factory as the directive. For example, \"The repeat directive\".\n *\n * Usually a template author will invoke a directive factory in their template\n * with relevant arguments, which will then return a directive function.\n *\n * Here's an example of using the `repeat()` directive factory that takes an\n * array and a function to render an item:\n *\n * ```js\n * html`<ul><${repeat(items, (item) => html`<li>${item}</li>`)}</ul>`\n * ```\n *\n * When `repeat` is invoked, it returns a directive function that closes over\n * `items` and the template function. When the outer template is rendered, the\n * return directive function is called with the Part for the expression.\n * `repeat` then performs it's custom logic to render multiple items.\n *\n * @param f The directive factory function. Must be a function that returns a\n * function of the signature `(part: Part) => void`. The returned function will\n * be called with the part object.\n *\n * @example\n *\n * import {directive, html} from 'lit-html';\n *\n * const immutable = directive((v) => (part) => {\n * if (part.value !== v) {\n * part.setValue(v)\n * }\n * });\n */\nexport const directive = <F extends DirectiveFactory>(f: F): F =>\n ((...args: unknown[]) => {\n const d = f(...args);\n directives.set(d, true);\n return d;\n }) as F;\n\nexport const isDirective = (o: unknown): o is DirectiveFn => {\n return typeof o === 'function' && directives.has(o);\n};\n", "/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The Part interface represents a dynamic part of a template instance rendered\n * by lit-html.\n */\nexport interface Part {\n readonly value: unknown;\n\n /**\n * Sets the current part value, but does not write it to the DOM.\n * @param value The value that will be committed.\n */\n setValue(value: unknown): void;\n\n /**\n * Commits the current part value, causing it to actually be written to the\n * DOM.\n *\n * Directives are run at the start of `commit`, so that if they call\n * `part.setValue(...)` synchronously that value will be used in the current\n * commit, and there's no need to call `part.commit()` within the directive.\n * If directives set a part value asynchronously, then they must call\n * `part.commit()` manually.\n */\n commit(): void;\n}\n\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = {};\n\n/**\n * A sentinel value that signals a NodePart to fully clear its content.\n */\nexport const nothing = {};\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isCEPolyfill} from './dom.js';\nimport {Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {isTemplatePartActive, Template, TemplatePart} from './template.js';\n\n/**\n * An instance of a `Template` that can be attached to the DOM and updated\n * with new values.\n */\nexport class TemplateInstance {\n private readonly __parts: Array<Part|undefined> = [];\n readonly processor: TemplateProcessor;\n readonly options: RenderOptions;\n readonly template: Template;\n\n constructor(\n template: Template, processor: TemplateProcessor,\n options: RenderOptions) {\n this.template = template;\n this.processor = processor;\n this.options = options;\n }\n\n update(values: readonly unknown[]) {\n let i = 0;\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.setValue(values[i]);\n }\n i++;\n }\n for (const part of this.__parts) {\n if (part !== undefined) {\n part.commit();\n }\n }\n }\n\n _clone(): DocumentFragment {\n // There are a number of steps in the lifecycle of a template instance's\n // DOM fragment:\n // 1. Clone - create the instance fragment\n // 2. Adopt - adopt into the main document\n // 3. Process - find part markers and create parts\n // 4. Upgrade - upgrade custom elements\n // 5. Update - set node, attribute, property, etc., values\n // 6. Connect - connect to the document. Optional and outside of this\n // method.\n //\n // We have a few constraints on the ordering of these steps:\n // * We need to upgrade before updating, so that property values will pass\n // through any property setters.\n // * We would like to process before upgrading so that we're sure that the\n // cloned fragment is inert and not disturbed by self-modifying DOM.\n // * We want custom elements to upgrade even in disconnected fragments.\n //\n // Given these constraints, with full custom elements support we would\n // prefer the order: Clone, Process, Adopt, Upgrade, Update, Connect\n //\n // But Safari does not implement CustomElementRegistry#upgrade, so we\n // can not implement that order and still have upgrade-before-update and\n // upgrade disconnected fragments. So we instead sacrifice the\n // process-before-upgrade constraint, since in Custom Elements v1 elements\n // must not modify their light DOM in the constructor. We still have issues\n // when co-existing with CEv0 elements like Polymer 1, and with polyfills\n // that don't strictly adhere to the no-modification rule because shadow\n // DOM, which may be created in the constructor, is emulated by being placed\n // in the light DOM.\n //\n // The resulting order is on native is: Clone, Adopt, Upgrade, Process,\n // Update, Connect. document.importNode() performs Clone, Adopt, and Upgrade\n // in one step.\n //\n // The Custom Elements v1 polyfill supports upgrade(), so the order when\n // polyfilled is the more ideal: Clone, Process, Adopt, Upgrade, Update,\n // Connect.\n\n const fragment = isCEPolyfill ?\n this.template.element.content.cloneNode(true) as DocumentFragment :\n document.importNode(this.template.element.content, true);\n\n const stack: Node[] = [];\n const parts = this.template.parts;\n // Edge needs all 4 parameters present; IE11 needs 3rd parameter to be null\n const walker = document.createTreeWalker(\n fragment,\n 133 /* NodeFilter.SHOW_{ELEMENT|COMMENT|TEXT} */,\n null,\n false);\n let partIndex = 0;\n let nodeIndex = 0;\n let part: TemplatePart;\n let node = walker.nextNode();\n // Loop through all the nodes and parts of a template\n while (partIndex < parts.length) {\n part = parts[partIndex];\n if (!isTemplatePartActive(part)) {\n this.__parts.push(undefined);\n partIndex++;\n continue;\n }\n\n // Progress the tree walker until we find our next part's node.\n // Note that multiple parts may share the same node (attribute parts\n // on a single element), so this loop may not run at all.\n while (nodeIndex < part.index) {\n nodeIndex++;\n if (node!.nodeName === 'TEMPLATE') {\n stack.push(node!);\n walker.currentNode = (node as HTMLTemplateElement).content;\n }\n if ((node = walker.nextNode()) === null) {\n // We've exhausted the content inside a nested template element.\n // Because we still have parts (the outer for-loop), we know:\n // - There is a template in the stack\n // - The walker will find a nextNode outside the template\n walker.currentNode = stack.pop()!;\n node = walker.nextNode();\n }\n }\n\n // We've arrived at our part's node.\n if (part.type === 'node') {\n const part = this.processor.handleTextExpression(this.options);\n part.insertAfterNode(node!.previousSibling!);\n this.__parts.push(part);\n } else {\n this.__parts.push(...this.processor.handleAttributeExpressions(\n node as Element, part.name, part.strings, this.options));\n }\n partIndex++;\n }\n\n if (isCEPolyfill) {\n document.adoptNode(fragment);\n customElements.upgrade(fragment);\n }\n return fragment;\n }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * @module lit-html\n */\n\nimport {reparentNodes} from './dom.js';\nimport {TemplateProcessor} from './template-processor.js';\nimport {boundAttributeSuffix, lastAttributeNameRegex, marker, nodeMarker} from './template.js';\n\ndeclare const trustedTypes: typeof window.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = window.trustedTypes &&\n trustedTypes!.createPolicy('lit-html', {createHTML: (s) => s});\n\nconst commentMarker = ` ${marker} `;\n\n/**\n * The return type of `html`, which holds a Template and the values from\n * interpolated expressions.\n */\nexport class TemplateResult {\n readonly strings: TemplateStringsArray;\n readonly values: readonly unknown[];\n readonly type: string;\n readonly processor: TemplateProcessor;\n\n constructor(\n strings: TemplateStringsArray, values: readonly unknown[], type: string,\n processor: TemplateProcessor) {\n this.strings = strings;\n this.values = values;\n this.type = type;\n this.processor = processor;\n }\n\n /**\n * Returns a string of HTML used to create a `<template>` element.\n */\n getHTML(): string {\n const l = this.strings.length - 1;\n let html = '';\n let isCommentBinding = false;\n\n for (let i = 0; i < l; i++) {\n const s = this.strings[i];\n // For each binding we want to determine the kind of marker to insert\n // into the template source before it's parsed by the browser's HTML\n // parser. The marker type is based on whether the expression is in an\n // attribute, text, or comment position.\n // * For node-position bindings we insert a comment with the marker\n // sentinel as its text content, like <!--{{lit-guid}}-->.\n // * For attribute bindings we insert just the marker sentinel for the\n // first binding, so that we support unquoted attribute bindings.\n // Subsequent bindings can use a comment marker because multi-binding\n // attributes must be quoted.\n // * For comment bindings we insert just the marker sentinel so we don't\n // close the comment.\n //\n // The following code scans the template source, but is *not* an HTML\n // parser. We don't need to track the tree structure of the HTML, only\n // whether a binding is inside a comment, and if not, if it appears to be\n // the first binding in an attribute.\n const commentOpen = s.lastIndexOf('<!--');\n // We're in comment position if we have a comment open with no following\n // comment close. Because <-- can appear in an attribute value there can\n // be false positives.\n isCommentBinding = (commentOpen > -1 || isCommentBinding) &&\n s.indexOf('-->', commentOpen + 1) === -1;\n // Check to see if we have an attribute-like sequence preceding the\n // expression. This can match \"name=value\" like structures in text,\n // comments, and attribute values, so there can be false-positives.\n const attributeMatch = lastAttributeNameRegex.exec(s);\n if (attributeMatch === null) {\n // We're only in this branch if we don't have a attribute-like\n // preceding sequence. For comments, this guards against unusual\n // attribute values like <div foo=\"<!--${'bar'}\">. Cases like\n // <!-- foo=${'bar'}--> are handled correctly in the attribute branch\n // below.\n html += s + (isCommentBinding ? commentMarker : nodeMarker);\n } else {\n // For attributes we use just a marker sentinel, and also append a\n // $lit$ suffix to the name to opt-out of attribute-specific parsing\n // that IE and Edge do for style and certain SVG attributes.\n html += s.substr(0, attributeMatch.index) + attributeMatch[1] +\n attributeMatch[2] + boundAttributeSuffix + attributeMatch[3] +\n marker;\n }\n }\n html += this.strings[l];\n return html;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = document.createElement('template');\n let value = this.getHTML();\n if (policy !== undefined) {\n // this is secure because `this.strings` is a TemplateStringsArray.\n // TODO: validate this when\n // https://github.com/tc39/proposal-array-is-template-object is\n // implemented.\n value = policy.createHTML(value) as unknown as string;\n }\n template.innerHTML = value;\n return template;\n }\n}\n\n/**\n * A TemplateResult for SVG fragments.\n *\n * This class wraps HTML in an `<svg>` tag in order to parse its contents in the\n * SVG namespace, then modifies the template to remove the `<svg>` tag so that\n * clones only container the original fragment.\n */\nexport class SVGTemplateResult extends TemplateResult {\n getHTML(): string {\n return `<svg>${super.getHTML()}</svg>`;\n }\n\n getTemplateElement(): HTMLTemplateElement {\n const template = super.getTemplateElement();\n const content = template.content;\n const svgElement = content.firstChild!;\n content.removeChild(svgElement);\n reparentNodes(content, svgElement.firstChild);\n return template;\n }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isDirective} from './directive.js';\nimport {removeNodes} from './dom.js';\nimport {noChange, nothing, Part} from './part.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {createMarker} from './template.js';\n\n// https://tc39.github.io/ecma262/#sec-typeof-operator\nexport type Primitive = null|undefined|boolean|number|string|symbol|bigint;\nexport const isPrimitive = (value: unknown): value is Primitive => {\n return (\n value === null ||\n !(typeof value === 'object' || typeof value === 'function'));\n};\nexport const isIterable = (value: unknown): value is Iterable<unknown> => {\n return Array.isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n !!(value && (value as any)[Symbol.iterator]);\n};\n\n/**\n * Writes attribute values to the DOM for a group of AttributeParts bound to a\n * single attribute. The value is only set once even if there are multiple parts\n * for an attribute.\n */\nexport class AttributeCommitter {\n readonly element: Element;\n readonly name: string;\n readonly strings: ReadonlyArray<string>;\n readonly parts: ReadonlyArray<AttributePart>;\n dirty = true;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n this.element = element;\n this.name = name;\n this.strings = strings;\n this.parts = [];\n for (let i = 0; i < strings.length - 1; i++) {\n (this.parts as AttributePart[])[i] = this._createPart();\n }\n }\n\n /**\n * Creates a single part. Override this to create a differnt type of part.\n */\n protected _createPart(): AttributePart {\n return new AttributePart(this);\n }\n\n protected _getValue(): unknown {\n const strings = this.strings;\n const l = strings.length - 1;\n const parts = this.parts;\n\n // If we're assigning an attribute via syntax like:\n // attr=\"${foo}\" or attr=${foo}\n // but not\n // attr=\"${foo} ${bar}\" or attr=\"${foo} baz\"\n // then we don't want to coerce the attribute value into one long\n // string. Instead we want to just return the value itself directly,\n // so that sanitizeDOMValue can get the actual value rather than\n // String(value)\n // The exception is if v is an array, in which case we do want to smash\n // it together into a string without calling String() on the array.\n //\n // This also allows trusted values (when using TrustedTypes) being\n // assigned to DOM sinks without being stringified in the process.\n if (l === 1 && strings[0] === '' && strings[1] === '') {\n const v = parts[0].value;\n if (typeof v === 'symbol') {\n return String(v);\n }\n if (typeof v === 'string' || !isIterable(v)) {\n return v;\n }\n }\n let text = '';\n\n for (let i = 0; i < l; i++) {\n text += strings[i];\n const part = parts[i];\n if (part !== undefined) {\n const v = part.value;\n if (isPrimitive(v) || !isIterable(v)) {\n text += typeof v === 'string' ? v : String(v);\n } else {\n for (const t of v) {\n text += typeof t === 'string' ? t : String(t);\n }\n }\n }\n }\n\n text += strings[l];\n return text;\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n this.element.setAttribute(this.name, this._getValue() as string);\n }\n }\n}\n\n/**\n * A Part that controls all or part of an attribute value.\n */\nexport class AttributePart implements Part {\n readonly committer: AttributeCommitter;\n value: unknown = undefined;\n\n constructor(committer: AttributeCommitter) {\n this.committer = committer;\n }\n\n setValue(value: unknown): void {\n if (value !== noChange && (!isPrimitive(value) || value !== this.value)) {\n this.value = value;\n // If the value is a not a directive, dirty the committer so that it'll\n // call setAttribute. If the value is a directive, it'll dirty the\n // committer if it calls setValue().\n if (!isDirective(value)) {\n this.committer.dirty = true;\n }\n }\n }\n\n commit() {\n while (isDirective(this.value)) {\n const directive = this.value;\n this.value = noChange;\n directive(this);\n }\n if (this.value === noChange) {\n return;\n }\n this.committer.commit();\n }\n}\n\n/**\n * A Part that controls a location within a Node tree. Like a Range, NodePart\n * has start and end locations and can set and update the Nodes between those\n * locations.\n *\n * NodeParts support several value types: primitives, Nodes, TemplateResults,\n * as well as arrays and iterables of those types.\n */\nexport class NodePart implements Part {\n readonly options: RenderOptions;\n startNode!: Node;\n endNode!: Node;\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(options: RenderOptions) {\n this.options = options;\n }\n\n /**\n * Appends this part into a container.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendInto(container: Node) {\n this.startNode = container.appendChild(createMarker());\n this.endNode = container.appendChild(createMarker());\n }\n\n /**\n * Inserts this part after the `ref` node (between `ref` and `ref`'s next\n * sibling). Both `ref` and its next sibling must be static, unchanging nodes\n * such as those that appear in a literal section of a template.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterNode(ref: Node) {\n this.startNode = ref;\n this.endNode = ref.nextSibling!;\n }\n\n /**\n * Appends this part into a parent part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n appendIntoPart(part: NodePart) {\n part.__insert(this.startNode = createMarker());\n part.__insert(this.endNode = createMarker());\n }\n\n /**\n * Inserts this part after the `ref` part.\n *\n * This part must be empty, as its contents are not automatically moved.\n */\n insertAfterPart(ref: NodePart) {\n ref.__insert(this.startNode = createMarker());\n this.endNode = ref.endNode;\n ref.endNode = this.startNode;\n }\n\n setValue(value: unknown): void {\n this.__pendingValue = value;\n }\n\n commit() {\n if (this.startNode.parentNode === null) {\n return;\n }\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n const value = this.__pendingValue;\n if (value === noChange) {\n return;\n }\n if (isPrimitive(value)) {\n if (value !== this.value) {\n this.__commitText(value);\n }\n } else if (value instanceof TemplateResult) {\n this.__commitTemplateResult(value);\n } else if (value instanceof Node) {\n this.__commitNode(value);\n } else if (isIterable(value)) {\n this.__commitIterable(value);\n } else if (value === nothing) {\n this.value = nothing;\n this.clear();\n } else {\n // Fallback, will render the string representation\n this.__commitText(value);\n }\n }\n\n private __insert(node: Node) {\n this.endNode.parentNode!.insertBefore(node, this.endNode);\n }\n\n private __commitNode(value: Node): void {\n if (this.value === value) {\n return;\n }\n this.clear();\n this.__insert(value);\n this.value = value;\n }\n\n private __commitText(value: unknown): void {\n const node = this.startNode.nextSibling!;\n value = value == null ? '' : value;\n // If `value` isn't already a string, we explicitly convert it here in case\n // it can't be implicitly converted - i.e. it's a symbol.\n const valueAsString: string =\n typeof value === 'string' ? value : String(value);\n if (node === this.endNode.previousSibling &&\n node.nodeType === 3 /* Node.TEXT_NODE */) {\n // If we only have a single text node between the markers, we can just\n // set its value, rather than replacing it.\n // TODO(justinfagnani): Can we just check if this.value is primitive?\n (node as Text).data = valueAsString;\n } else {\n this.__commitNode(document.createTextNode(valueAsString));\n }\n this.value = value;\n }\n\n private __commitTemplateResult(value: TemplateResult): void {\n const template = this.options.templateFactory(value);\n if (this.value instanceof TemplateInstance &&\n this.value.template === template) {\n this.value.update(value.values);\n } else {\n // Make sure we propagate the template processor from the TemplateResult\n // so that we use its syntax extension, etc. The template factory comes\n // from the render function options so that it can control template\n // caching and preprocessing.\n const instance =\n new TemplateInstance(template, value.processor, this.options);\n const fragment = instance._clone();\n instance.update(value.values);\n this.__commitNode(fragment);\n this.value = instance;\n }\n }\n\n private __commitIterable(value: Iterable<unknown>): void {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n\n // If _value is an array, then the previous render was of an\n // iterable and _value will contain the NodeParts from the previous\n // render. If _value is not an array, clear this part and make a new\n // array for NodeParts.\n if (!Array.isArray(this.value)) {\n this.value = [];\n this.clear();\n }\n\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this.value as NodePart[];\n let partIndex = 0;\n let itemPart: NodePart|undefined;\n\n for (const item of value) {\n // Try to reuse an existing part\n itemPart = itemParts[partIndex];\n\n // If no existing part, create a new one\n if (itemPart === undefined) {\n itemPart = new NodePart(this.options);\n itemParts.push(itemPart);\n if (partIndex === 0) {\n itemPart.appendIntoPart(this);\n } else {\n itemPart.insertAfterPart(itemParts[partIndex - 1]);\n }\n }\n itemPart.setValue(item);\n itemPart.commit();\n partIndex++;\n }\n\n if (partIndex < itemParts.length) {\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n this.clear(itemPart && itemPart.endNode);\n }\n }\n\n clear(startNode: Node = this.startNode) {\n removeNodes(\n this.startNode.parentNode!, startNode.nextSibling!, this.endNode);\n }\n}\n\n/**\n * Implements a boolean attribute, roughly as defined in the HTML\n * specification.\n *\n * If the value is truthy, then the attribute is present with a value of\n * ''. If the value is falsey, the attribute is removed.\n */\nexport class BooleanAttributePart implements Part {\n readonly element: Element;\n readonly name: string;\n readonly strings: readonly string[];\n value: unknown = undefined;\n private __pendingValue: unknown = undefined;\n\n constructor(element: Element, name: string, strings: readonly string[]) {\n if (strings.length !== 2 || strings[0] !== '' || strings[1] !== '') {\n throw new Error(\n 'Boolean attributes can only contain a single expression');\n }\n this.element = element;\n this.name = name;\n this.strings = strings;\n }\n\n setValue(value: unknown): void {\n this.__pendingValue = value;\n }\n\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n const value = !!this.__pendingValue;\n if (this.value !== value) {\n if (value) {\n this.element.setAttribute(this.name, '');\n } else {\n this.element.removeAttribute(this.name);\n }\n this.value = value;\n }\n this.__pendingValue = noChange;\n }\n}\n\n/**\n * Sets attribute values for PropertyParts, so that the value is only set once\n * even if there are multiple parts for a property.\n *\n * If an expression controls the whole property value, then the value is simply\n * assigned to the property under control. If there are string literals or\n * multiple expressions, then the strings are expressions are interpolated into\n * a string first.\n */\nexport class PropertyCommitter extends AttributeCommitter {\n readonly single: boolean;\n\n constructor(element: Element, name: string, strings: ReadonlyArray<string>) {\n super(element, name, strings);\n this.single =\n (strings.length === 2 && strings[0] === '' && strings[1] === '');\n }\n\n protected _createPart(): PropertyPart {\n return new PropertyPart(this);\n }\n\n protected _getValue() {\n if (this.single) {\n return this.parts[0].value;\n }\n return super._getValue();\n }\n\n commit(): void {\n if (this.dirty) {\n this.dirty = false;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (this.element as any)[this.name] = this._getValue();\n }\n }\n}\n\nexport class PropertyPart extends AttributePart {}\n\n// Detect event listener options support. If the `capture` property is read\n// from the options object, then options are supported. If not, then the third\n// argument to add/removeEventListener is interpreted as the boolean capture\n// value so we should only pass the `capture` property.\nlet eventOptionsSupported = false;\n\n// Wrap into an IIFE because MS Edge <= v41 does not support having try/catch\n// blocks right into the body of a module\n(() => {\n try {\n const options = {\n get capture() {\n eventOptionsSupported = true;\n return false;\n }\n };\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.addEventListener('test', options as any, options);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n window.removeEventListener('test', options as any, options);\n } catch (_e) {\n // event options not supported\n }\n})();\n\ntype EventHandlerWithOptions =\n EventListenerOrEventListenerObject&Partial<AddEventListenerOptions>;\nexport class EventPart implements Part {\n readonly element: Element;\n readonly eventName: string;\n readonly eventContext?: EventTarget;\n value: undefined|EventHandlerWithOptions = undefined;\n private __options?: AddEventListenerOptions;\n private __pendingValue: undefined|EventHandlerWithOptions = undefined;\n private readonly __boundHandleEvent: (event: Event) => void;\n\n constructor(element: Element, eventName: string, eventContext?: EventTarget) {\n this.element = element;\n this.eventName = eventName;\n this.eventContext = eventContext;\n this.__boundHandleEvent = (e) => this.handleEvent(e);\n }\n\n setValue(value: undefined|EventHandlerWithOptions): void {\n this.__pendingValue = value;\n }\n\n commit() {\n while (isDirective(this.__pendingValue)) {\n const directive = this.__pendingValue;\n this.__pendingValue = noChange as EventHandlerWithOptions;\n directive(this);\n }\n if (this.__pendingValue === noChange) {\n return;\n }\n\n const newListener = this.__pendingValue;\n const oldListener = this.value;\n const shouldRemoveListener = newListener == null ||\n oldListener != null &&\n (newListener.capture !== oldListener.capture ||\n newListener.once !== oldListener.once ||\n newListener.passive !== oldListener.passive);\n const shouldAddListener =\n newListener != null && (oldListener == null || shouldRemoveListener);\n\n if (shouldRemoveListener) {\n this.element.removeEventListener(\n this.eventName, this.__boundHandleEvent, this.__options);\n }\n if (shouldAddListener) {\n this.__options = getOptions(newListener);\n this.element.addEventListener(\n this.eventName, this.__boundHandleEvent, this.__options);\n }\n this.value = newListener;\n this.__pendingValue = noChange as EventHandlerWithOptions;\n }\n\n handleEvent(event: Event) {\n if (typeof this.value === 'function') {\n this.value.call(this.eventContext || this.element, event);\n } else {\n (this.value as EventListenerObject).handleEvent(event);\n }\n }\n}\n\n// We copy options because of the inconsistent behavior of browsers when reading\n// the third argument of add/removeEventListener. IE11 doesn't support options\n// at all. Chrome 41 only reads `capture` if the argument is an object.\nconst getOptions = (o: AddEventListenerOptions|undefined) => o &&\n (eventOptionsSupported ?\n {capture: o.capture, passive: o.passive, once: o.once} :\n o.capture as AddEventListenerOptions);\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\n/**\n * A function type that creates a Template from a TemplateResult.\n *\n * This is a hook into the template-creation process for rendering that\n * requires some modification of templates before they're used, like ShadyCSS,\n * which must add classes to elements and remove styles.\n *\n * Templates should be cached as aggressively as possible, so that many\n * TemplateResults produced from the same expression only do the work of\n * creating the Template the first time.\n *\n * Templates are usually cached by TemplateResult.strings and\n * TemplateResult.type, but may be cached by other keys if this function\n * modifies the template.\n *\n * Note that currently TemplateFactories must not add, remove, or reorder\n * expressions, because there is no way to describe such a modification\n * to render() so that values are interpolated to the correct place in the\n * template instances.\n */\nexport type TemplateFactory = (result: TemplateResult) => Template;\n\n/**\n * The default TemplateFactory which caches Templates keyed on\n * result.type and result.strings.\n */\nexport function templateFactory(result: TemplateResult) {\n let templateCache = templateCaches.get(result.type);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(result.type, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n // If the TemplateStringsArray is new, generate a key from the strings\n // This key is shared between all templates with identical content\n const key = result.strings.join(marker);\n\n // Check if we already have a Template for this key\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n // If we have not seen this key before, create a new Template\n template = new Template(result, result.getTemplateElement());\n // Cache the Template for this key\n templateCache.keyString.set(key, template);\n }\n\n // Cache all future queries for this TemplateStringsArray\n templateCache.stringsArray.set(result.strings, template);\n return template;\n}\n\n/**\n * The first argument to JS template tags retain identity across multiple\n * calls to a tag for the same literal, so we can cache work done per literal\n * in a Map.\n *\n * Safari currently has a bug which occasionally breaks this behavior, so we\n * need to cache the Template at two levels. We first cache the\n * TemplateStringsArray, and if that fails, we cache a key constructed by\n * joining the strings array.\n */\nexport interface TemplateCache {\n readonly stringsArray: WeakMap<TemplateStringsArray, Template>;\n readonly keyString: Map<string, Template>;\n}\n\nexport const templateCaches = new Map<string, TemplateCache>();\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {removeNodes} from './dom.js';\nimport {NodePart} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {templateFactory} from './template-factory.js';\n\nexport const parts = new WeakMap<Node, NodePart>();\n\n/**\n * Renders a template result or other value to a container.\n *\n * To update a container with new values, reevaluate the template literal and\n * call `render` with the new result.\n *\n * @param result Any value renderable by NodePart - typically a TemplateResult\n * created by evaluating a template tag like `html` or `svg`.\n * @param container A DOM parent to render to. The entire contents are either\n * replaced, or efficiently updated if the same result type was previous\n * rendered there.\n * @param options RenderOptions for the entire render tree rendered to this\n * container. Render options must *not* change between renders to the same\n * container, as those changes will not effect previously rendered DOM.\n */\nexport const render =\n (result: unknown,\n container: Element|DocumentFragment,\n options?: Partial<RenderOptions>) => {\n let part = parts.get(container);\n if (part === undefined) {\n removeNodes(container, container.firstChild);\n parts.set(container, part = new NodePart({\n templateFactory,\n ...options,\n }));\n part.appendInto(container);\n }\n part.setValue(result);\n part.commit();\n };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {Part} from './part.js';\nimport {AttributeCommitter, BooleanAttributePart, EventPart, NodePart, PropertyCommitter} from './parts.js';\nimport {RenderOptions} from './render-options.js';\nimport {TemplateProcessor} from './template-processor.js';\n\n/**\n * Creates Parts when a template is instantiated.\n */\nexport class DefaultTemplateProcessor implements TemplateProcessor {\n /**\n * Create parts for an attribute-position binding, given the event, attribute\n * name, and string literals.\n *\n * @param element The element containing the binding\n * @param name The attribute name\n * @param strings The string literals. There are always at least two strings,\n * event for fully-controlled bindings with a single expression.\n */\n handleAttributeExpressions(\n element: Element, name: string, strings: string[],\n options: RenderOptions): ReadonlyArray<Part> {\n const prefix = name[0];\n if (prefix === '.') {\n const committer = new PropertyCommitter(element, name.slice(1), strings);\n return committer.parts;\n }\n if (prefix === '@') {\n return [new EventPart(element, name.slice(1), options.eventContext)];\n }\n if (prefix === '?') {\n return [new BooleanAttributePart(element, name.slice(1), strings)];\n }\n const committer = new AttributeCommitter(element, name, strings);\n return committer.parts;\n }\n /**\n * Create parts for a text-position binding.\n * @param templateFactory\n */\n handleTextExpression(options: RenderOptions) {\n return new NodePart(options);\n }\n}\n\nexport const defaultTemplateProcessor = new DefaultTemplateProcessor();\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n *\n * Main lit-html module.\n *\n * Main exports:\n *\n * - [[html]]\n * - [[svg]]\n * - [[render]]\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {defaultTemplateProcessor} from './lib/default-template-processor.js';\nimport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\n\nexport {DefaultTemplateProcessor, defaultTemplateProcessor} from './lib/default-template-processor.js';\nexport {directive, DirectiveFn, isDirective} from './lib/directive.js';\n// TODO(justinfagnani): remove line when we get NodePart moving methods\nexport {removeNodes, reparentNodes} from './lib/dom.js';\nexport {noChange, nothing, Part} from './lib/part.js';\nexport {AttributeCommitter, AttributePart, BooleanAttributePart, EventPart, isIterable, isPrimitive, NodePart, PropertyCommitter, PropertyPart} from './lib/parts.js';\nexport {RenderOptions} from './lib/render-options.js';\nexport {parts, render} from './lib/render.js';\nexport {templateCaches, templateFactory} from './lib/template-factory.js';\nexport {TemplateInstance} from './lib/template-instance.js';\nexport {TemplateProcessor} from './lib/template-processor.js';\nexport {SVGTemplateResult, TemplateResult} from './lib/template-result.js';\nexport {createMarker, isTemplatePartActive, Template} from './lib/template.js';\n\ndeclare global {\n interface Window {\n litHtmlVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n// TODO(justinfagnani): inject version number at build time\nif (typeof window !== 'undefined') {\n (window['litHtmlVersions'] || (window['litHtmlVersions'] = [])).push('1.3.0');\n}\n\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n */\nexport const html = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new TemplateResult(strings, values, 'html', defaultTemplateProcessor);\n\n/**\n * Interprets a template literal as an SVG template that can efficiently\n * render to and update a container.\n */\nexport const svg = (strings: TemplateStringsArray, ...values: unknown[]) =>\n new SVGTemplateResult(strings, values, 'svg', defaultTemplateProcessor);\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Module to add shady DOM/shady CSS polyfill support to lit-html template\n * rendering. See the [[render]] method for details.\n *\n * @packageDocumentation\n */\n\n/**\n * Do not remove this comment; it keeps typedoc from misplacing the module\n * docs.\n */\nimport {removeNodes} from './dom.js';\nimport {insertNodeIntoTemplate, removeNodesFromTemplate} from './modify-template.js';\nimport {RenderOptions} from './render-options.js';\nimport {parts, render as litRender} from './render.js';\nimport {templateCaches} from './template-factory.js';\nimport {TemplateInstance} from './template-instance.js';\nimport {TemplateResult} from './template-result.js';\nimport {marker, Template} from './template.js';\n\nexport {html, svg, TemplateResult} from '../lit-html.js';\n\n// Get a key to lookup in `templateCaches`.\nconst getTemplateCacheKey = (type: string, scopeName: string) =>\n `${type}--${scopeName}`;\n\nlet compatibleShadyCSSVersion = true;\n\nif (typeof window.ShadyCSS === 'undefined') {\n compatibleShadyCSSVersion = false;\n} else if (typeof window.ShadyCSS.prepareTemplateDom === 'undefined') {\n console.warn(\n `Incompatible ShadyCSS version detected. ` +\n `Please update to at least @webcomponents/webcomponentsjs@2.0.2 and ` +\n `@webcomponents/shadycss@1.3.1.`);\n compatibleShadyCSSVersion = false;\n}\n\n/**\n * Template factory which scopes template DOM using ShadyCSS.\n * @param scopeName {string}\n */\nexport const shadyTemplateFactory = (scopeName: string) =>\n (result: TemplateResult) => {\n const cacheKey = getTemplateCacheKey(result.type, scopeName);\n let templateCache = templateCaches.get(cacheKey);\n if (templateCache === undefined) {\n templateCache = {\n stringsArray: new WeakMap<TemplateStringsArray, Template>(),\n keyString: new Map<string, Template>()\n };\n templateCaches.set(cacheKey, templateCache);\n }\n\n let template = templateCache.stringsArray.get(result.strings);\n if (template !== undefined) {\n return template;\n }\n\n const key = result.strings.join(marker);\n template = templateCache.keyString.get(key);\n if (template === undefined) {\n const element = result.getTemplateElement();\n if (compatibleShadyCSSVersion) {\n window.ShadyCSS!.prepareTemplateDom(element, scopeName);\n }\n template = new Template(result, element);\n templateCache.keyString.set(key, template);\n }\n templateCache.stringsArray.set(result.strings, template);\n return template;\n };\n\nconst TEMPLATE_TYPES = ['html', 'svg'];\n\n/**\n * Removes all style elements from Templates for the given scopeName.\n */\nconst removeStylesFromLitTemplates = (scopeName: string) => {\n TEMPLATE_TYPES.forEach((type) => {\n const templates = templateCaches.get(getTemplateCacheKey(type, scopeName));\n if (templates !== undefined) {\n templates.keyString.forEach((template) => {\n const {element: {content}} = template;\n // IE 11 doesn't support the iterable param Set constructor\n const styles = new Set<Element>();\n Array.from(content.querySelectorAll('style')).forEach((s: Element) => {\n styles.add(s);\n });\n removeNodesFromTemplate(template, styles);\n });\n }\n });\n};\n\nconst shadyRenderSet = new Set<string>();\n\n/**\n * For the given scope name, ensures that ShadyCSS style scoping is performed.\n * This is done just once per scope name so the fragment and template cannot\n * be modified.\n * (1) extracts styles from the rendered fragment and hands them to ShadyCSS\n * to be scoped and appended to the document\n * (2) removes style elements from all lit-html Templates for this scope name.\n *\n * Note, <style> elements can only be placed into templates for the\n * initial rendering of the scope. If <style> elements are included in templates\n * dynamically rendered to the scope (after the first scope render), they will\n * not be scoped and the <style> will be left in the template and rendered\n * output.\n */\nconst prepareTemplateStyles =\n (scopeName: string, renderedDOM: DocumentFragment, template?: Template) => {\n shadyRenderSet.add(scopeName);\n // If `renderedDOM` is stamped from a Template, then we need to edit that\n // Template's underlying template element. Otherwise, we create one here\n // to give to ShadyCSS, which still requires one while scoping.\n const templateElement =\n !!template ? template.element : document.createElement('template');\n // Move styles out of rendered DOM and store.\n const styles = renderedDOM.querySelectorAll('style');\n const {length} = styles;\n // If there are no styles, skip unnecessary work\n if (length === 0) {\n // Ensure prepareTemplateStyles is called to support adding\n // styles via `prepareAdoptedCssText` since that requires that\n // `prepareTemplateStyles` is called.\n //\n // ShadyCSS will only update styles containing @apply in the template\n // given to `prepareTemplateStyles`. If no lit Template was given,\n // ShadyCSS will not be able to update uses of @apply in any relevant\n // template. However, this is not a problem because we only create the\n // template for the purpose of supporting `prepareAdoptedCssText`,\n // which doesn't support @apply at all.\n window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n return;\n }\n const condensedStyle = document.createElement('style');\n // Collect styles into a single style. This helps us make sure ShadyCSS\n // manipulations will not prevent us from being able to fix up template\n // part indices.\n // NOTE: collecting styles is inefficient for browsers but ShadyCSS\n // currently does this anyway. When it does not, this should be changed.\n for (let i = 0; i < length; i++) {\n const style = styles[i];\n style.parentNode!.removeChild(style);\n condensedStyle.textContent! += style.textContent;\n }\n // Remove styles from nested templates in this scope.\n removeStylesFromLitTemplates(scopeName);\n // And then put the condensed style into the \"root\" template passed in as\n // `template`.\n const content = templateElement.content;\n if (!!template) {\n insertNodeIntoTemplate(template, condensedStyle, content.firstChild);\n } else {\n content.insertBefore(condensedStyle, content.firstChild);\n }\n // Note, it's important that ShadyCSS gets the template that `lit-html`\n // will actually render so that it can update the style inside when\n // needed (e.g. @apply native Shadow DOM case).\n window.ShadyCSS!.prepareTemplateStyles(templateElement, scopeName);\n const style = content.querySelector('style');\n if (window.ShadyCSS!.nativeShadow && style !== null) {\n // When in native Shadow DOM, ensure the style created by ShadyCSS is\n // included in initially rendered output (`renderedDOM`).\n renderedDOM.insertBefore(style.cloneNode(true), renderedDOM.firstChild);\n } else if (!!template) {\n // When no style is left in the template, parts will be broken as a\n // result. To fix this, we put back the style node ShadyCSS removed\n // and then tell lit to remove that node from the template.\n // There can be no style in the template in 2 cases (1) when Shady DOM\n // is in use, ShadyCSS removes all styles, (2) when native Shadow DOM\n // is in use ShadyCSS removes the style if it contains no content.\n // NOTE, ShadyCSS creates its own style so we can safely add/remove\n // `condensedStyle` here.\n content.insertBefore(condensedStyle, content.firstChild);\n const removes = new Set<Node>();\n removes.add(condensedStyle);\n removeNodesFromTemplate(template, removes);\n }\n };\n\nexport interface ShadyRenderOptions extends Partial<RenderOptions> {\n scopeName: string;\n}\n\n/**\n * Extension to the standard `render` method which supports rendering\n * to ShadowRoots when the ShadyDOM (https://github.com/webcomponents/shadydom)\n * and ShadyCSS (https://github.com/webcomponents/shadycss) polyfills are used\n * or when the webcomponentsjs\n * (https://github.com/webcomponents/webcomponentsjs) polyfill is used.\n *\n * Adds a `scopeName` option which is used to scope element DOM and stylesheets\n * when native ShadowDOM is unavailable. The `scopeName` will be added to\n * the class attribute of all rendered DOM. In addition, any style elements will\n * be automatically re-written with this `scopeName` selector and moved out\n * of the rendered DOM and into the document `<head>`.\n *\n * It is common to use this render method in conjunction with a custom element\n * which renders a shadowRoot. When this is done, typically the element's\n * `localName` should be used as the `scopeName`.\n *\n * In addition to DOM scoping, ShadyCSS also supports a basic shim for css\n * custom properties (needed only on older browsers like IE11) and a shim for\n * a deprecated feature called `@apply` that supports applying a set of css\n * custom properties to a given location.\n *\n * Usage considerations:\n *\n * * Part values in `<style>` elements are only applied the first time a given\n * `scopeName` renders. Subsequent changes to parts in style elements will have\n * no effect. Because of this, parts in style elements should only be used for\n * values that will never change, for example parts that set scope-wide theme\n * values or parts which render shared style elements.\n *\n * * Note, due to a limitation of the ShadyDOM polyfill, rendering in a\n * custom element's `constructor` is not supported. Instead rendering should\n * either done asynchronously, for example at microtask timing (for example\n * `Promise.resolve()`), or be deferred until the first time the element's\n * `connectedCallback` runs.\n *\n * Usage considerations when using shimmed custom properties or `@apply`:\n *\n * * Whenever any dynamic changes are made which affect\n * css custom properties, `ShadyCSS.styleElement(element)` must be called\n * to update the element. There are two cases when this is needed:\n * (1) the element is connected to a new parent, (2) a class is added to the\n * element that causes it to match different custom properties.\n * To address the first case when rendering a custom element, `styleElement`\n * should be called in the element's `connectedCallback`.\n *\n * * Shimmed custom properties may only be defined either for an entire\n * shadowRoot (for example, in a `:host` rule) or via a rule that directly\n * matches an element with a shadowRoot. In other words, instead of flowing from\n * parent to child as do native css custom properties, shimmed custom properties\n * flow only from shadowRoots to nested shadowRoots.\n *\n * * When using `@apply` mixing css shorthand property names with\n * non-shorthand names (for example `border` and `border-width`) is not\n * supported.\n */\nexport const render =\n (result: unknown,\n container: Element|DocumentFragment|ShadowRoot,\n options: ShadyRenderOptions) => {\n if (!options || typeof options !== 'object' || !options.scopeName) {\n throw new Error('The `scopeName` option is required.');\n }\n const scopeName = options.scopeName;\n const hasRendered = parts.has(container);\n const needsScoping = compatibleShadyCSSVersion &&\n container.nodeType === 11 /* Node.DOCUMENT_FRAGMENT_NODE */ &&\n !!(container as ShadowRoot).host;\n // Handle first render to a scope specially...\n const firstScopeRender = needsScoping && !shadyRenderSet.has(scopeName);\n // On first scope render, render into a fragment; this cannot be a single\n // fragment that is reused since nested renders can occur synchronously.\n const renderContainer =\n firstScopeRender ? document.createDocumentFragment() : container;\n litRender(\n result,\n renderContainer,\n {templateFactory: shadyTemplateFactory(scopeName), ...options} as\n RenderOptions);\n // When performing first scope render,\n // (1) We've rendered into a fragment so that there's a chance to\n // `prepareTemplateStyles` before sub-elements hit the DOM\n // (which might cause them to render based on a common pattern of\n // rendering in a custom element's `connectedCallback`);\n // (2) Scope the template with ShadyCSS one time only for this scope.\n // (3) Render the fragment into the container and make sure the\n // container knows its `part` is the one we just rendered. This ensures\n // DOM will be re-used on subsequent renders.\n if (firstScopeRender) {\n const part = parts.get(renderContainer)!;\n parts.delete(renderContainer);\n // ShadyCSS might have style sheets (e.g. from `prepareAdoptedCssText`)\n // that should apply to `renderContainer` even if the rendered value is\n // not a TemplateInstance. However, it will only insert scoped styles\n // into the document if `prepareTemplateStyles` has already been called\n // for the given scope name.\n const template = part.value instanceof TemplateInstance ?\n part.value.template :\n undefined;\n prepareTemplateStyles(\n scopeName, renderContainer as DocumentFragment, template);\n removeNodes(container, container.firstChild);\n container.appendChild(renderContainer);\n parts.set(container, part);\n }\n // After elements have hit the DOM, update styling if this is the\n // initial render to this container.\n // This is needed whenever dynamic changes are made so it would be\n // safest to do every render; however, this would regress performance\n // so we leave it up to the user to call `ShadyCSS.styleElement`\n // for dynamic changes.\n if (!hasRendered && needsScoping) {\n window.ShadyCSS!.styleElement((container as ShadowRoot).host);\n }\n };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Use this module if you want to create your own base class extending\n * [[UpdatingElement]].\n * @packageDocumentation\n */\n\n/*\n * When using Closure Compiler, JSCompiler_renameProperty(property, object) is\n * replaced at compile time by the munged name for object[property]. We cannot\n * alias this function, so we have to use a small shim that has the same\n * behavior when not compiling.\n */\nwindow.JSCompiler_renameProperty =\n <P extends PropertyKey>(prop: P, _obj: unknown): P => prop;\n\ndeclare global {\n var JSCompiler_renameProperty: <P extends PropertyKey>(\n prop: P, _obj: unknown) => P;\n\n interface Window {\n JSCompiler_renameProperty: typeof JSCompiler_renameProperty;\n }\n}\n\n/**\n * Converts property values to and from attribute values.\n */\nexport interface ComplexAttributeConverter<Type = unknown, TypeHint = unknown> {\n /**\n * Function called to convert an attribute value to a property\n * value.\n */\n fromAttribute?(value: string|null, type?: TypeHint): Type;\n\n /**\n * Function called to convert a property value to an attribute\n * value.\n *\n * It returns unknown instead of string, to be compatible with\n * https://github.com/WICG/trusted-types (and similar efforts).\n */\n toAttribute?(value: Type, type?: TypeHint): unknown;\n}\n\ntype AttributeConverter<Type = unknown, TypeHint = unknown> =\n ComplexAttributeConverter<Type>|\n ((value: string|null, type?: TypeHint) => Type);\n\n/**\n * Defines options for a property accessor.\n */\nexport interface PropertyDeclaration<Type = unknown, TypeHint = unknown> {\n /**\n * Indicates how and whether the property becomes an observed attribute.\n * If the value is `false`, the property is not added to `observedAttributes`.\n * If true or absent, the lowercased property name is observed (e.g. `fooBar`\n * becomes `foobar`). If a string, the string value is observed (e.g\n * `attribute: 'foo-bar'`).\n */\n readonly attribute?: boolean|string;\n\n /**\n * Indicates the type of the property. This is used only as a hint for the\n * `converter` to determine how to convert the attribute\n * to/from a property.\n */\n readonly type?: TypeHint;\n\n /**\n * Indicates how to convert the attribute to/from a property. If this value\n * is a function, it is used to convert the attribute value a the property\n * value. If it's an object, it can have keys for `fromAttribute` and\n * `toAttribute`. If no `toAttribute` function is provided and\n * `reflect` is set to `true`, the property value is set directly to the\n * attribute. A default `converter` is used if none is provided; it supports\n * `Boolean`, `String`, `Number`, `Object`, and `Array`. Note,\n * when a property changes and the converter is used to update the attribute,\n * the property is never updated again as a result of the attribute changing,\n * and vice versa.\n */\n readonly converter?: AttributeConverter<Type, TypeHint>;\n\n /**\n * Indicates if the property should reflect to an attribute.\n * If `true`, when the property is set, the attribute is set using the\n * attribute name determined according to the rules for the `attribute`\n * property option and the value of the property converted using the rules\n * from the `converter` property option.\n */\n readonly reflect?: boolean;\n\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n\n /**\n * Indicates whether an accessor will be created for this property. By\n * default, an accessor will be generated for this property that requests an\n * update when set. If this flag is `true`, no accessor will be created, and\n * it will be the user's responsibility to call\n * `this.requestUpdate(propertyName, oldValue)` to request an update when\n * the property changes.\n */\n readonly noAccessor?: boolean;\n}\n\n/**\n * Map of properties to PropertyDeclaration options. For each property an\n * accessor is made, and the property is processed according to the\n * PropertyDeclaration options.\n */\nexport interface PropertyDeclarations {\n readonly [key: string]: PropertyDeclaration;\n}\n\ntype PropertyDeclarationMap = Map<PropertyKey, PropertyDeclaration>;\n\ntype AttributeMap = Map<string, PropertyKey>;\n\n/**\n * Map of changed properties with old values. Takes an optional generic\n * interface corresponding to the declared element properties.\n */\n// tslint:disable-next-line:no-any\nexport type PropertyValues<T = any> =\n keyof T extends PropertyKey ? Map<keyof T, unknown>: never;\n\nexport const defaultConverter: ComplexAttributeConverter = {\n\n toAttribute(value: unknown, type?: unknown): unknown {\n switch (type) {\n case Boolean:\n return value ? '' : null;\n case Object:\n case Array:\n // if the value is `null` or `undefined` pass this through\n // to allow removing/no change behavior.\n return value == null ? value : JSON.stringify(value);\n }\n return value;\n },\n\n fromAttribute(value: string|null, type?: unknown) {\n switch (type) {\n case Boolean:\n return value !== null;\n case Number:\n return value === null ? null : Number(value);\n case Object:\n case Array:\n return JSON.parse(value!);\n }\n return value;\n }\n\n};\n\nexport interface HasChanged {\n (value: unknown, old: unknown): boolean;\n}\n\n/**\n * Change function that returns true if `value` is different from `oldValue`.\n * This method is used as the default for a property's `hasChanged` function.\n */\nexport const notEqual: HasChanged = (value: unknown, old: unknown): boolean => {\n // This ensures (old==NaN, value==NaN) always returns false\n return old !== value && (old === old || value === value);\n};\n\nconst defaultPropertyDeclaration: PropertyDeclaration = {\n attribute: true,\n type: String,\n converter: defaultConverter,\n reflect: false,\n hasChanged: notEqual\n};\n\nconst STATE_HAS_UPDATED = 1;\nconst STATE_UPDATE_REQUESTED = 1 << 2;\nconst STATE_IS_REFLECTING_TO_ATTRIBUTE = 1 << 3;\nconst STATE_IS_REFLECTING_TO_PROPERTY = 1 << 4;\ntype UpdateState = typeof STATE_HAS_UPDATED|typeof STATE_UPDATE_REQUESTED|\n typeof STATE_IS_REFLECTING_TO_ATTRIBUTE|\n typeof STATE_IS_REFLECTING_TO_PROPERTY;\n\n/**\n * The Closure JS Compiler doesn't currently have good support for static\n * property semantics where \"this\" is dynamic (e.g.\n * https://github.com/google/closure-compiler/issues/3177 and others) so we use\n * this hack to bypass any rewriting by the compiler.\n */\nconst finalized = 'finalized';\n\n/**\n * Base element class which manages element properties and attributes. When\n * properties change, the `update` method is asynchronously called. This method\n * should be supplied by subclassers to render updates as desired.\n * @noInheritDoc\n */\nexport abstract class UpdatingElement extends HTMLElement {\n /*\n * Due to closure compiler ES6 compilation bugs, @nocollapse is required on\n * all static methods and properties with initializers. Reference:\n * - https://github.com/google/closure-compiler/issues/1776\n */\n\n /**\n * Maps attribute names to properties; for example `foobar` attribute to\n * `fooBar` property. Created lazily on user subclasses when finalizing the\n * class.\n */\n private static _attributeToPropertyMap: AttributeMap;\n\n /**\n * Marks class as having finished creating properties.\n */\n protected static[finalized] = true;\n\n /**\n * Memoized list of all class properties, including any superclass properties.\n * Created lazily on user subclasses when finalizing the class.\n */\n private static _classProperties?: PropertyDeclarationMap;\n\n /**\n * User-supplied object that maps property names to `PropertyDeclaration`\n * objects containing options for configuring the property.\n */\n static properties: PropertyDeclarations;\n\n /**\n * Returns a list of attributes corresponding to the registered properties.\n * @nocollapse\n */\n static get observedAttributes() {\n // note: piggy backing on this to ensure we're finalized.\n this.finalize();\n const attributes: string[] = [];\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n this._classProperties!.forEach((v, p) => {\n const attr = this._attributeNameForProperty(p, v);\n if (attr !== undefined) {\n this._attributeToPropertyMap.set(attr, p);\n attributes.push(attr);\n }\n });\n return attributes;\n }\n\n /**\n * Ensures the private `_classProperties` property metadata is created.\n * In addition to `finalize` this is also called in `createProperty` to\n * ensure the `@property` decorator can add property metadata.\n */\n /** @nocollapse */\n private static _ensureClassProperties() {\n // ensure private storage for property declarations.\n if (!this.hasOwnProperty(\n JSCompiler_renameProperty('_classProperties', this))) {\n this._classProperties = new Map();\n // NOTE: Workaround IE11 not supporting Map constructor argument.\n const superProperties: PropertyDeclarationMap =\n Object.getPrototypeOf(this)._classProperties;\n if (superProperties !== undefined) {\n superProperties.forEach(\n (v: PropertyDeclaration, k: PropertyKey) =>\n this._classProperties!.set(k, v));\n }\n }\n }\n\n /**\n * Creates a property accessor on the element prototype if one does not exist\n * and stores a PropertyDeclaration for the property with the given options.\n * The property setter calls the property's `hasChanged` property option\n * or uses a strict identity check to determine whether or not to request\n * an update.\n *\n * This method may be overridden to customize properties; however,\n * when doing so, it's important to call `super.createProperty` to ensure\n * the property is setup correctly. This method calls\n * `getPropertyDescriptor` internally to get a descriptor to install.\n * To customize what properties do when they are get or set, override\n * `getPropertyDescriptor`. To customize the options for a property,\n * implement `createProperty` like this:\n *\n * static createProperty(name, options) {\n * options = Object.assign(options, {myOption: true});\n * super.createProperty(name, options);\n * }\n *\n * @nocollapse\n */\n static createProperty(\n name: PropertyKey,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n // Note, since this can be called by the `@property` decorator which\n // is called before `finalize`, we ensure storage exists for property\n // metadata.\n this._ensureClassProperties();\n this._classProperties!.set(name, options);\n // Do not generate an accessor if the prototype already has one, since\n // it would be lost otherwise and that would never be the user's intention;\n // Instead, we expect users to call `requestUpdate` themselves from\n // user-defined accessors. Note that if the super has an accessor we will\n // still overwrite it\n if (options.noAccessor || this.prototype.hasOwnProperty(name)) {\n return;\n }\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n const descriptor = this.getPropertyDescriptor(name, key, options);\n if (descriptor !== undefined) {\n Object.defineProperty(this.prototype, name, descriptor);\n }\n }\n\n /**\n * Returns a property descriptor to be defined on the given named property.\n * If no descriptor is returned, the property will not become an accessor.\n * For example,\n *\n * class MyElement extends LitElement {\n * static getPropertyDescriptor(name, key, options) {\n * const defaultDescriptor =\n * super.getPropertyDescriptor(name, key, options);\n * const setter = defaultDescriptor.set;\n * return {\n * get: defaultDescriptor.get,\n * set(value) {\n * setter.call(this, value);\n * // custom action.\n * },\n * configurable: true,\n * enumerable: true\n * }\n * }\n * }\n *\n * @nocollapse\n */\n protected static getPropertyDescriptor(\n name: PropertyKey, key: string|symbol, options: PropertyDeclaration) {\n return {\n // tslint:disable-next-line:no-any no symbol in index\n get(): any {\n return (this as {[key: string]: unknown})[key as string];\n },\n set(this: UpdatingElement, value: unknown) {\n const oldValue =\n (this as {} as {[key: string]: unknown})[name as string];\n (this as {} as {[key: string]: unknown})[key as string] = value;\n (this as unknown as UpdatingElement)\n .requestUpdateInternal(name, oldValue, options);\n },\n configurable: true,\n enumerable: true\n };\n }\n\n /**\n * Returns the property options associated with the given property.\n * These options are defined with a PropertyDeclaration via the `properties`\n * object or the `@property` decorator and are registered in\n * `createProperty(...)`.\n *\n * Note, this method should be considered \"final\" and not overridden. To\n * customize the options for a given property, override `createProperty`.\n *\n * @nocollapse\n * @final\n */\n protected static getPropertyOptions(name: PropertyKey) {\n return this._classProperties && this._classProperties.get(name) ||\n defaultPropertyDeclaration;\n }\n\n /**\n * Creates property accessors for registered properties and ensures\n * any superclasses are also finalized.\n * @nocollapse\n */\n protected static finalize() {\n // finalize any superclasses\n const superCtor = Object.getPrototypeOf(this);\n if (!superCtor.hasOwnProperty(finalized)) {\n superCtor.finalize();\n }\n this[finalized] = true;\n this._ensureClassProperties();\n // initialize Map populated in observedAttributes\n this._attributeToPropertyMap = new Map();\n // make any properties\n // Note, only process \"own\" properties since this element will inherit\n // any properties defined on the superClass, and finalization ensures\n // the entire prototype chain is finalized.\n if (this.hasOwnProperty(JSCompiler_renameProperty('properties', this))) {\n const props = this.properties;\n // support symbols in properties (IE11 does not support this)\n const propKeys = [\n ...Object.getOwnPropertyNames(props),\n ...(typeof Object.getOwnPropertySymbols === 'function') ?\n Object.getOwnPropertySymbols(props) :\n []\n ];\n // This for/of is ok because propKeys is an array\n for (const p of propKeys) {\n // note, use of `any` is due to TypeSript lack of support for symbol in\n // index types\n // tslint:disable-next-line:no-any no symbol in index\n this.createProperty(p, (props as any)[p]);\n }\n }\n }\n\n /**\n * Returns the property name for the given attribute `name`.\n * @nocollapse\n */\n private static _attributeNameForProperty(\n name: PropertyKey, options: PropertyDeclaration) {\n const attribute = options.attribute;\n return attribute === false ?\n undefined :\n (typeof attribute === 'string' ?\n attribute :\n (typeof name === 'string' ? name.toLowerCase() : undefined));\n }\n\n /**\n * Returns true if a property should request an update.\n * Called when a property value is set and uses the `hasChanged`\n * option for the property if present or a strict identity check.\n * @nocollapse\n */\n private static _valueHasChanged(\n value: unknown, old: unknown, hasChanged: HasChanged = notEqual) {\n return hasChanged(value, old);\n }\n\n /**\n * Returns the property value for the given attribute value.\n * Called via the `attributeChangedCallback` and uses the property's\n * `converter` or `converter.fromAttribute` property option.\n * @nocollapse\n */\n private static _propertyValueFromAttribute(\n value: string|null, options: PropertyDeclaration) {\n const type = options.type;\n const converter = options.converter || defaultConverter;\n const fromAttribute =\n (typeof converter === 'function' ? converter : converter.fromAttribute);\n return fromAttribute ? fromAttribute(value, type) : value;\n }\n\n /**\n * Returns the attribute value for the given property value. If this\n * returns undefined, the property will *not* be reflected to an attribute.\n * If this returns null, the attribute will be removed, otherwise the\n * attribute will be set to the value.\n * This uses the property's `reflect` and `type.toAttribute` property options.\n * @nocollapse\n */\n private static _propertyValueToAttribute(\n value: unknown, options: PropertyDeclaration) {\n if (options.reflect === undefined) {\n return;\n }\n const type = options.type;\n const converter = options.converter;\n const toAttribute =\n converter && (converter as ComplexAttributeConverter).toAttribute ||\n defaultConverter.toAttribute;\n return toAttribute!(value, type);\n }\n\n private _updateState!: UpdateState;\n private _instanceProperties?: PropertyValues;\n // Initialize to an unresolved Promise so we can make sure the element has\n // connected before first update.\n private _updatePromise!: Promise<unknown>;\n private _enableUpdatingResolver: (() => void)|undefined;\n\n /**\n * Map with keys for any properties that have changed since the last\n * update cycle with previous values.\n */\n private _changedProperties!: PropertyValues;\n\n /**\n * Map with keys of properties that should be reflected when updated.\n */\n private _reflectingProperties?: Map<PropertyKey, PropertyDeclaration>;\n\n constructor() {\n super();\n this.initialize();\n }\n\n /**\n * Performs element initialization. By default captures any pre-set values for\n * registered properties.\n */\n protected initialize() {\n this._updateState = 0;\n this._updatePromise =\n new Promise((res) => this._enableUpdatingResolver = res);\n this._changedProperties = new Map();\n this._saveInstanceProperties();\n // ensures first update will be caught by an early access of\n // `updateComplete`\n this.requestUpdateInternal();\n }\n\n /**\n * Fixes any properties set on the instance before upgrade time.\n * Otherwise these would shadow the accessor and break these properties.\n * The properties are stored in a Map which is played back after the\n * constructor runs. Note, on very old versions of Safari (<=9) or Chrome\n * (<=41), properties created for native platform properties like (`id` or\n * `name`) may not have default values set in the element constructor. On\n * these browsers native properties appear on instances and therefore their\n * default value will overwrite any element default (e.g. if the element sets\n * this.id = 'id' in the constructor, the 'id' will become '' since this is\n * the native platform default).\n */\n private _saveInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n (this.constructor as typeof UpdatingElement)\n ._classProperties!.forEach((_v, p) => {\n if (this.hasOwnProperty(p)) {\n const value = this[p as keyof this];\n delete this[p as keyof this];\n if (!this._instanceProperties) {\n this._instanceProperties = new Map();\n }\n this._instanceProperties.set(p, value);\n }\n });\n }\n\n /**\n * Applies previously saved instance properties.\n */\n private _applyInstanceProperties() {\n // Use forEach so this works even if for/of loops are compiled to for loops\n // expecting arrays\n // tslint:disable-next-line:no-any\n this._instanceProperties!.forEach((v, p) => (this as any)[p] = v);\n this._instanceProperties = undefined;\n }\n\n connectedCallback() {\n // Ensure first connection completes an update. Updates cannot complete\n // before connection.\n this.enableUpdating();\n }\n\n protected enableUpdating() {\n if (this._enableUpdatingResolver !== undefined) {\n this._enableUpdatingResolver();\n this._enableUpdatingResolver = undefined;\n }\n }\n\n /**\n * Allows for `super.disconnectedCallback()` in extensions while\n * reserving the possibility of making non-breaking feature additions\n * when disconnecting at some point in the future.\n */\n disconnectedCallback() {\n }\n\n /**\n * Synchronizes property values when attributes change.\n */\n attributeChangedCallback(name: string, old: string|null, value: string|null) {\n if (old !== value) {\n this._attributeToProperty(name, value);\n }\n }\n\n private _propertyToAttribute(\n name: PropertyKey, value: unknown,\n options: PropertyDeclaration = defaultPropertyDeclaration) {\n const ctor = (this.constructor as typeof UpdatingElement);\n const attr = ctor._attributeNameForProperty(name, options);\n if (attr !== undefined) {\n const attrValue = ctor._propertyValueToAttribute(value, options);\n // an undefined value does not change the attribute.\n if (attrValue === undefined) {\n return;\n }\n // Track if the property is being reflected to avoid\n // setting the property again via `attributeChangedCallback`. Note:\n // 1. this takes advantage of the fact that the callback is synchronous.\n // 2. will behave incorrectly if multiple attributes are in the reaction\n // stack at time of calling. However, since we process attributes\n // in `update` this should not be possible (or an extreme corner case\n // that we'd like to discover).\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_ATTRIBUTE;\n if (attrValue == null) {\n this.removeAttribute(attr);\n } else {\n this.setAttribute(attr, attrValue as string);\n }\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_ATTRIBUTE;\n }\n }\n\n private _attributeToProperty(name: string, value: string|null) {\n // Use tracking info to avoid deserializing attribute value if it was\n // just set from a property setter.\n if (this._updateState & STATE_IS_REFLECTING_TO_ATTRIBUTE) {\n return;\n }\n const ctor = (this.constructor as typeof UpdatingElement);\n // Note, hint this as an `AttributeMap` so closure clearly understands\n // the type; it has issues with tracking types through statics\n // tslint:disable-next-line:no-unnecessary-type-assertion\n const propName = (ctor._attributeToPropertyMap as AttributeMap).get(name);\n if (propName !== undefined) {\n const options = ctor.getPropertyOptions(propName);\n // mark state reflecting\n this._updateState = this._updateState | STATE_IS_REFLECTING_TO_PROPERTY;\n this[propName as keyof this] =\n // tslint:disable-next-line:no-any\n ctor._propertyValueFromAttribute(value, options) as any;\n // mark state not reflecting\n this._updateState = this._updateState & ~STATE_IS_REFLECTING_TO_PROPERTY;\n }\n }\n\n /**\n * This protected version of `requestUpdate` does not access or return the\n * `updateComplete` promise. This promise can be overridden and is therefore\n * not free to access.\n */\n protected requestUpdateInternal(\n name?: PropertyKey, oldValue?: unknown, options?: PropertyDeclaration) {\n let shouldRequestUpdate = true;\n // If we have a property key, perform property update steps.\n if (name !== undefined) {\n const ctor = this.constructor as typeof UpdatingElement;\n options = options || ctor.getPropertyOptions(name);\n if (ctor._valueHasChanged(\n this[name as keyof this], oldValue, options.hasChanged)) {\n if (!this._changedProperties.has(name)) {\n this._changedProperties.set(name, oldValue);\n }\n // Add to reflecting properties set.\n // Note, it's important that every change has a chance to add the\n // property to `_reflectingProperties`. This ensures setting\n // attribute + property reflects correctly.\n if (options.reflect === true &&\n !(this._updateState & STATE_IS_REFLECTING_TO_PROPERTY)) {\n if (this._reflectingProperties === undefined) {\n this._reflectingProperties = new Map();\n }\n this._reflectingProperties.set(name, options);\n }\n } else {\n // Abort the request if the property should not be considered changed.\n shouldRequestUpdate = false;\n }\n }\n if (!this._hasRequestedUpdate && shouldRequestUpdate) {\n this._updatePromise = this._enqueueUpdate();\n }\n }\n\n /**\n * Requests an update which is processed asynchronously. This should\n * be called when an element should update based on some state not triggered\n * by setting a property. In this case, pass no arguments. It should also be\n * called when manually implementing a property setter. In this case, pass the\n * property `name` and `oldValue` to ensure that any configured property\n * options are honored. Returns the `updateComplete` Promise which is resolved\n * when the update completes.\n *\n * @param name {PropertyKey} (optional) name of requesting property\n * @param oldValue {any} (optional) old value of requesting property\n * @returns {Promise} A Promise that is resolved when the update completes.\n */\n requestUpdate(name?: PropertyKey, oldValue?: unknown) {\n this.requestUpdateInternal(name, oldValue);\n return this.updateComplete;\n }\n\n /**\n * Sets up the element to asynchronously update.\n */\n private async _enqueueUpdate() {\n this._updateState = this._updateState | STATE_UPDATE_REQUESTED;\n try {\n // Ensure any previous update has resolved before updating.\n // This `await` also ensures that property changes are batched.\n await this._updatePromise;\n } catch (e) {\n // Ignore any previous errors. We only care that the previous cycle is\n // done. Any error should have been handled in the previous update.\n }\n const result = this.performUpdate();\n // If `performUpdate` returns a Promise, we await it. This is done to\n // enable coordinating updates with a scheduler. Note, the result is\n // checked to avoid delaying an additional microtask unless we need to.\n if (result != null) {\n await result;\n }\n return !this._hasRequestedUpdate;\n }\n\n private get _hasRequestedUpdate() {\n return (this._updateState & STATE_UPDATE_REQUESTED);\n }\n\n protected get hasUpdated() {\n return (this._updateState & STATE_HAS_UPDATED);\n }\n\n /**\n * Performs an element update. Note, if an exception is thrown during the\n * update, `firstUpdated` and `updated` will not be called.\n *\n * You can override this method to change the timing of updates. If this\n * method is overridden, `super.performUpdate()` must be called.\n *\n * For instance, to schedule updates to occur just before the next frame:\n *\n * ```\n * protected async performUpdate(): Promise<unknown> {\n * await new Promise((resolve) => requestAnimationFrame(() => resolve()));\n * super.performUpdate();\n * }\n * ```\n */\n protected performUpdate(): void|Promise<unknown> {\n // Abort any update if one is not pending when this is called.\n // This can happen if `performUpdate` is called early to \"flush\"\n // the update.\n if (!this._hasRequestedUpdate) {\n return;\n }\n // Mixin instance properties once, if they exist.\n if (this._instanceProperties) {\n this._applyInstanceProperties();\n }\n let shouldUpdate = false;\n const changedProperties = this._changedProperties;\n try {\n shouldUpdate = this.shouldUpdate(changedProperties);\n if (shouldUpdate) {\n this.update(changedProperties);\n } else {\n this._markUpdated();\n }\n } catch (e) {\n // Prevent `firstUpdated` and `updated` from running when there's an\n // update exception.\n shouldUpdate = false;\n // Ensure element can accept additional updates after an exception.\n this._markUpdated();\n throw e;\n }\n if (shouldUpdate) {\n if (!(this._updateState & STATE_HAS_UPDATED)) {\n this._updateState = this._updateState | STATE_HAS_UPDATED;\n this.firstUpdated(changedProperties);\n }\n this.updated(changedProperties);\n }\n }\n\n private _markUpdated() {\n this._changedProperties = new Map();\n this._updateState = this._updateState & ~STATE_UPDATE_REQUESTED;\n }\n\n /**\n * Returns a Promise that resolves when the element has completed updating.\n * The Promise value is a boolean that is `true` if the element completed the\n * update without triggering another update. The Promise result is `false` if\n * a property was set inside `updated()`. If the Promise is rejected, an\n * exception was thrown during the update.\n *\n * To await additional asynchronous work, override the `_getUpdateComplete`\n * method. For example, it is sometimes useful to await a rendered element\n * before fulfilling this Promise. To do this, first await\n * `super._getUpdateComplete()`, then any subsequent state.\n *\n * @returns {Promise} The Promise returns a boolean that indicates if the\n * update resolved without triggering another update.\n */\n get updateComplete() {\n return this._getUpdateComplete();\n }\n\n /**\n * Override point for the `updateComplete` promise.\n *\n * It is not safe to override the `updateComplete` getter directly due to a\n * limitation in TypeScript which means it is not possible to call a\n * superclass getter (e.g. `super.updateComplete.then(...)`) when the target\n * language is ES5 (https://github.com/microsoft/TypeScript/issues/338).\n * This method should be overridden instead. For example:\n *\n * class MyElement extends LitElement {\n * async _getUpdateComplete() {\n * await super._getUpdateComplete();\n * await this._myChild.updateComplete;\n * }\n * }\n */\n protected _getUpdateComplete() {\n return this._updatePromise;\n }\n\n /**\n * Controls whether or not `update` should be called when the element requests\n * an update. By default, this method always returns `true`, but this can be\n * customized to control when to update.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected shouldUpdate(_changedProperties: PropertyValues): boolean {\n return true;\n }\n\n /**\n * Updates the element. This method reflects property values to attributes.\n * It can be overridden to render and keep updated element DOM.\n * Setting properties inside this method will *not* trigger\n * another update.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected update(_changedProperties: PropertyValues) {\n if (this._reflectingProperties !== undefined &&\n this._reflectingProperties.size > 0) {\n // Use forEach so this works even if for/of loops are compiled to for\n // loops expecting arrays\n this._reflectingProperties.forEach(\n (v, k) => this._propertyToAttribute(k, this[k as keyof this], v));\n this._reflectingProperties = undefined;\n }\n this._markUpdated();\n }\n\n /**\n * Invoked whenever the element is updated. Implement to perform\n * post-updating tasks via DOM APIs, for example, focusing an element.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected updated(_changedProperties: PropertyValues) {\n }\n\n /**\n * Invoked when the element is first updated. Implement to perform one time\n * work on the element after update.\n *\n * Setting properties inside this method will trigger the element to update\n * again after this update cycle completes.\n *\n * @param _changedProperties Map of changed properties with old values\n */\n protected firstUpdated(_changedProperties: PropertyValues) {\n }\n}\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/*\n * IMPORTANT: For compatibility with tsickle and the Closure JS compiler, all\n * property decorators (but not class decorators) in this file that have\n * an @ExportDecoratedItems annotation must be defined as a regular function,\n * not an arrow function.\n */\n\nimport {LitElement} from '../lit-element.js';\n\nimport {PropertyDeclaration, UpdatingElement} from './updating-element.js';\n\nexport type Constructor<T> = {\n // tslint:disable-next-line:no-any\n new (...args: any[]): T\n};\n\n// From the TC39 Decorators proposal\ninterface ClassDescriptor {\n kind: 'class';\n elements: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n}\n\n// From the TC39 Decorators proposal\ninterface ClassElement {\n kind: 'field'|'method';\n key: PropertyKey;\n placement: 'static'|'prototype'|'own';\n initializer?: Function;\n extras?: ClassElement[];\n finisher?: <T>(clazz: Constructor<T>) => undefined | Constructor<T>;\n descriptor?: PropertyDescriptor;\n}\n\nconst legacyCustomElement =\n (tagName: string, clazz: Constructor<HTMLElement>) => {\n window.customElements.define(tagName, clazz);\n // Cast as any because TS doesn't recognize the return type as being a\n // subtype of the decorated class when clazz is typed as\n // `Constructor<HTMLElement>` for some reason.\n // `Constructor<HTMLElement>` is helpful to make sure the decorator is\n // applied to elements however.\n // tslint:disable-next-line:no-any\n return clazz as any;\n };\n\nconst standardCustomElement =\n (tagName: string, descriptor: ClassDescriptor) => {\n const {kind, elements} = descriptor;\n return {\n kind,\n elements,\n // This callback is called once the class is otherwise fully defined\n finisher(clazz: Constructor<HTMLElement>) {\n window.customElements.define(tagName, clazz);\n }\n };\n };\n\n/**\n * Class decorator factory that defines the decorated class as a custom element.\n *\n * ```\n * @customElement('my-element')\n * class MyElement {\n * render() {\n * return html``;\n * }\n * }\n * ```\n * @category Decorator\n * @param tagName The name of the custom element to define.\n */\nexport const customElement = (tagName: string) =>\n (classOrDescriptor: Constructor<HTMLElement>|ClassDescriptor) =>\n (typeof classOrDescriptor === 'function') ?\n legacyCustomElement(tagName, classOrDescriptor) :\n standardCustomElement(tagName, classOrDescriptor);\n\nconst standardProperty =\n (options: PropertyDeclaration, element: ClassElement) => {\n // When decorating an accessor, pass it through and add property metadata.\n // Note, the `hasOwnProperty` check in `createProperty` ensures we don't\n // stomp over the user's accessor.\n if (element.kind === 'method' && element.descriptor &&\n !('value' in element.descriptor)) {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n } else {\n // createProperty() takes care of defining the property, but we still\n // must return some kind of descriptor, so return a descriptor for an\n // unused prototype field. The finisher calls createProperty().\n return {\n kind: 'field',\n key: Symbol(),\n placement: 'own',\n descriptor: {},\n // When @babel/plugin-proposal-decorators implements initializers,\n // do this instead of the initializer below. See:\n // https://github.com/babel/babel/issues/9260 extras: [\n // {\n // kind: 'initializer',\n // placement: 'own',\n // initializer: descriptor.initializer,\n // }\n // ],\n initializer(this: {[key: string]: unknown}) {\n if (typeof element.initializer === 'function') {\n this[element.key as string] = element.initializer.call(this);\n }\n },\n finisher(clazz: typeof UpdatingElement) {\n clazz.createProperty(element.key, options);\n }\n };\n }\n };\n\nconst legacyProperty =\n (options: PropertyDeclaration, proto: Object, name: PropertyKey) => {\n (proto.constructor as typeof UpdatingElement)\n .createProperty(name, options);\n };\n\n/**\n * A property decorator which creates a LitElement property which reflects a\n * corresponding attribute value. A [[`PropertyDeclaration`]] may optionally be\n * supplied to configure property features.\n *\n * This decorator should only be used for public fields. Private or protected\n * fields should use the [[`internalProperty`]] decorator.\n *\n * @example\n * ```ts\n * class MyElement {\n * @property({ type: Boolean })\n * clicked = false;\n * }\n * ```\n * @category Decorator\n * @ExportDecoratedItems\n */\nexport function property(options?: PropertyDeclaration) {\n // tslint:disable-next-line:no-any decorator\n return (protoOrDescriptor: Object|ClassElement, name?: PropertyKey): any =>\n (name !== undefined) ?\n legacyProperty(options!, protoOrDescriptor as Object, name) :\n standardProperty(options!, protoOrDescriptor as ClassElement);\n}\n\nexport interface InternalPropertyDeclaration<Type = unknown> {\n /**\n * A function that indicates if a property should be considered changed when\n * it is set. The function should take the `newValue` and `oldValue` and\n * return `true` if an update should be requested.\n */\n hasChanged?(value: Type, oldValue: Type): boolean;\n}\n\n/**\n * Declares a private or protected property that still triggers updates to the\n * element when it changes.\n *\n * Properties declared this way must not be used from HTML or HTML templating\n * systems, they're solely for properties internal to the element. These\n * properties may be renamed by optimization tools like closure compiler.\n * @category Decorator\n */\nexport function internalProperty(options?: InternalPropertyDeclaration) {\n return property({attribute: false, hasChanged: options?.hasChanged});\n}\n\n/**\n * A property decorator that converts a class property into a getter that\n * executes a querySelector on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n * @param cache An optional boolean which when true performs the DOM query only\n * once and caches the result.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n *\n * ```ts\n * class MyElement {\n * @query('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function query(selector: string, cache?: boolean) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n if (cache) {\n const key = typeof name === 'symbol' ? Symbol() : `__${name}`;\n descriptor.get = function(this: LitElement) {\n if ((this as unknown as\n {[key: string]: Element | null})[key as string] === undefined) {\n ((this as unknown as {[key: string]: Element | null})[key as string] =\n this.renderRoot.querySelector(selector));\n }\n return (\n this as unknown as {[key: string]: Element | null})[key as string];\n };\n }\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n// Note, in the future, we may extend this decorator to support the use case\n// where the queried element may need to do work to become ready to interact\n// with (e.g. load some implementation code). If so, we might elect to\n// add a second argument defining a function that can be run to make the\n// queried element loaded/updated/ready.\n/**\n * A property decorator that converts a class property into a getter that\n * returns a promise that resolves to the result of a querySelector on the\n * element's renderRoot done after the element's `updateComplete` promise\n * resolves. When the queried property may change with element state, this\n * decorator can be used instead of requiring users to await the\n * `updateComplete` before accessing the property.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector\n *\n * @example\n * ```ts\n * class MyElement {\n * @queryAsync('#first')\n * first;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n *\n * // external usage\n * async doSomethingWithFirst() {\n * (await aMyElement.first).doSomething();\n * }\n * ```\n * @category Decorator\n */\nexport function queryAsync(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n async get(this: LitElement) {\n await this.updateComplete;\n return this.renderRoot.querySelector(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\n/**\n * A property decorator that converts a class property into a getter\n * that executes a querySelectorAll on the element's renderRoot.\n *\n * @param selector A DOMString containing one or more selectors to match.\n *\n * See:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll\n *\n * @example\n * ```ts\n * class MyElement {\n * @queryAll('div')\n * divs;\n *\n * render() {\n * return html`\n * <div id=\"first\"></div>\n * <div id=\"second\"></div>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAll(selector: string) {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n return this.renderRoot.querySelectorAll(selector);\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n\nconst legacyQuery =\n (descriptor: PropertyDescriptor, proto: Object, name: PropertyKey) => {\n Object.defineProperty(proto, name, descriptor);\n };\n\nconst standardQuery = (descriptor: PropertyDescriptor, element: ClassElement) =>\n ({\n kind: 'method',\n placement: 'prototype',\n key: element.key,\n descriptor,\n });\n\nconst standardEventOptions =\n (options: AddEventListenerOptions, element: ClassElement) => {\n return {\n ...element,\n finisher(clazz: typeof UpdatingElement) {\n Object.assign(\n clazz.prototype[element.key as keyof UpdatingElement], options);\n }\n };\n };\n\nconst legacyEventOptions =\n // tslint:disable-next-line:no-any legacy decorator\n (options: AddEventListenerOptions, proto: any, name: PropertyKey) => {\n Object.assign(proto[name], options);\n };\n\n/**\n * Adds event listener options to a method used as an event listener in a\n * lit-html template.\n *\n * @param options An object that specifies event listener options as accepted by\n * `EventTarget#addEventListener` and `EventTarget#removeEventListener`.\n *\n * Current browsers support the `capture`, `passive`, and `once` options. See:\n * https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters\n *\n * @example\n * ```ts\n * class MyElement {\n * clicked = false;\n *\n * render() {\n * return html`\n * <div @click=${this._onClick}`>\n * <button></button>\n * </div>\n * `;\n * }\n *\n * @eventOptions({capture: true})\n * _onClick(e) {\n * this.clicked = true;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function eventOptions(options: AddEventListenerOptions) {\n // Return value typed as any to prevent TypeScript from complaining that\n // standard decorator function signature does not match TypeScript decorator\n // signature\n // TODO(kschaaf): unclear why it was only failing on this decorator and not\n // the others\n return ((protoOrDescriptor: Object|ClassElement, name?: string) =>\n (name !== undefined) ?\n legacyEventOptions(options, protoOrDescriptor as Object, name) :\n standardEventOptions(\n options, protoOrDescriptor as ClassElement)) as\n // tslint:disable-next-line:no-any decorator\n any;\n}\n\n// x-browser support for matches\n// tslint:disable-next-line:no-any\nconst ElementProto = Element.prototype as any;\nconst legacyMatches =\n ElementProto.msMatchesSelector || ElementProto.webkitMatchesSelector;\n\n/**\n * A property decorator that converts a class property into a getter that\n * returns the `assignedNodes` of the given named `slot`. Note, the type of\n * this property should be annotated as `NodeListOf<HTMLElement>`.\n *\n * @param slotName A string name of the slot.\n * @param flatten A boolean which when true flattens the assigned nodes,\n * meaning any assigned nodes that are slot elements are replaced with their\n * assigned nodes.\n * @param selector A string which filters the results to elements that match\n * the given css selector.\n *\n * * @example\n * ```ts\n * class MyElement {\n * @queryAssignedNodes('list', true, '.item')\n * listItems;\n *\n * render() {\n * return html`\n * <slot name=\"list\"></slot>\n * `;\n * }\n * }\n * ```\n * @category Decorator\n */\nexport function queryAssignedNodes(\n slotName = '', flatten = false, selector = '') {\n return (protoOrDescriptor: Object|ClassElement,\n // tslint:disable-next-line:no-any decorator\n name?: PropertyKey): any => {\n const descriptor = {\n get(this: LitElement) {\n const slotSelector =\n `slot${slotName ? `[name=${slotName}]` : ':not([name])'}`;\n const slot = this.renderRoot.querySelector(slotSelector);\n let nodes = slot && (slot as HTMLSlotElement).assignedNodes({flatten});\n if (nodes && selector) {\n nodes = nodes.filter(\n (node) => node.nodeType === Node.ELEMENT_NODE &&\n (node as Element).matches ?\n (node as Element).matches(selector) :\n legacyMatches.call(node as Element, selector));\n }\n return nodes;\n },\n enumerable: true,\n configurable: true,\n };\n return (name !== undefined) ?\n legacyQuery(descriptor, protoOrDescriptor as Object, name) :\n standardQuery(descriptor, protoOrDescriptor as ClassElement);\n };\n}\n", "/**\n@license\nCopyright (c) 2019 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at\nhttp://polymer.github.io/LICENSE.txt The complete set of authors may be found at\nhttp://polymer.github.io/AUTHORS.txt The complete set of contributors may be\nfound at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as\npart of the polymer project is also subject to an additional IP rights grant\nfound at http://polymer.github.io/PATENTS.txt\n*/\n\n/**\n * Whether the current browser supports `adoptedStyleSheets`.\n */\nexport const supportsAdoptingStyleSheets = (window.ShadowRoot) &&\n (window.ShadyCSS === undefined || window.ShadyCSS.nativeShadow) &&\n ('adoptedStyleSheets' in Document.prototype) &&\n ('replace' in CSSStyleSheet.prototype);\n\nconst constructionToken = Symbol();\n\nexport class CSSResult {\n _styleSheet?: CSSStyleSheet|null;\n\n readonly cssText: string;\n\n constructor(cssText: string, safeToken: symbol) {\n if (safeToken !== constructionToken) {\n throw new Error(\n 'CSSResult is not constructable. Use `unsafeCSS` or `css` instead.');\n }\n\n this.cssText = cssText;\n }\n\n // Note, this is a getter so that it's lazy. In practice, this means\n // stylesheets are not created until the first element instance is made.\n get styleSheet(): CSSStyleSheet|null {\n if (this._styleSheet === undefined) {\n // Note, if `supportsAdoptingStyleSheets` is true then we assume\n // CSSStyleSheet is constructable.\n if (supportsAdoptingStyleSheets) {\n this._styleSheet = new CSSStyleSheet();\n this._styleSheet.replaceSync(this.cssText);\n } else {\n this._styleSheet = null;\n }\n }\n return this._styleSheet;\n }\n\n toString(): string {\n return this.cssText;\n }\n}\n\n/**\n * Wrap a value for interpolation in a [[`css`]] tagged template literal.\n *\n * This is unsafe because untrusted CSS text can be used to phone home\n * or exfiltrate data to an attacker controlled site. Take care to only use\n * this with trusted input.\n */\nexport const unsafeCSS = (value: unknown) => {\n return new CSSResult(String(value), constructionToken);\n};\n\nconst textFromCSSResult = (value: CSSResult|number) => {\n if (value instanceof CSSResult) {\n return value.cssText;\n } else if (typeof value === 'number') {\n return value;\n } else {\n throw new Error(\n `Value passed to 'css' function must be a 'css' function result: ${\n value}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`);\n }\n};\n\n/**\n * Template tag which which can be used with LitElement's [[LitElement.styles |\n * `styles`]] property to set element styles. For security reasons, only literal\n * string values may be used. To incorporate non-literal values [[`unsafeCSS`]]\n * may be used inside a template string part.\n */\nexport const css =\n (strings: TemplateStringsArray, ...values: (CSSResult|number)[]) => {\n const cssText = values.reduce(\n (acc, v, idx) => acc + textFromCSSResult(v) + strings[idx + 1],\n strings[0]);\n return new CSSResult(cssText, constructionToken);\n };\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * The main LitElement module, which defines the [[`LitElement`]] base class and\n * related APIs.\n *\n * LitElement components can define a template and a set of observed\n * properties. Changing an observed property triggers a re-render of the\n * element.\n *\n * Import [[`LitElement`]] and [[`html`]] from this module to create a\n * component:\n *\n * ```js\n * import {LitElement, html} from 'lit-element';\n *\n * class MyElement extends LitElement {\n *\n * // Declare observed properties\n * static get properties() {\n * return {\n * adjective: {}\n * }\n * }\n *\n * constructor() {\n * this.adjective = 'awesome';\n * }\n *\n * // Define the element's template\n * render() {\n * return html`<p>your ${adjective} template here</p>`;\n * }\n * }\n *\n * customElements.define('my-element', MyElement);\n * ```\n *\n * `LitElement` extends [[`UpdatingElement`]] and adds lit-html templating.\n * The `UpdatingElement` class is provided for users that want to build\n * their own custom element base classes that don't use lit-html.\n *\n * @packageDocumentation\n */\nimport {render, ShadyRenderOptions} from 'lit-html/lib/shady-render.js';\n\nimport {PropertyValues, UpdatingElement} from './lib/updating-element.js';\n\nexport * from './lib/updating-element.js';\nexport * from './lib/decorators.js';\nexport {html, svg, TemplateResult, SVGTemplateResult} from 'lit-html/lit-html.js';\nimport {supportsAdoptingStyleSheets, CSSResult, unsafeCSS} from './lib/css-tag.js';\nexport * from './lib/css-tag.js';\n\ndeclare global {\n interface Window {\n litElementVersions: string[];\n }\n}\n\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for LitElement usage.\n// TODO(justinfagnani): inject version number at build time\n(window['litElementVersions'] || (window['litElementVersions'] = []))\n .push('2.4.0');\n\nexport type CSSResultOrNative = CSSResult|CSSStyleSheet;\n\nexport interface CSSResultArray extends\n Array<CSSResultOrNative|CSSResultArray> {}\n\n/**\n * Sentinal value used to avoid calling lit-html's render function when\n * subclasses do not implement `render`\n */\nconst renderNotImplemented = {};\n\n/**\n * Base element class that manages element properties and attributes, and\n * renders a lit-html template.\n *\n * To define a component, subclass `LitElement` and implement a\n * `render` method to provide the component's template. Define properties\n * using the [[`properties`]] property or the [[`property`]] decorator.\n */\nexport class LitElement extends UpdatingElement {\n /**\n * Ensure this class is marked as `finalized` as an optimization ensuring\n * it will not needlessly try to `finalize`.\n *\n * Note this property name is a string to prevent breaking Closure JS Compiler\n * optimizations. See updating-element.ts for more information.\n */\n protected static['finalized'] = true;\n\n /**\n * Reference to the underlying library method used to render the element's\n * DOM. By default, points to the `render` method from lit-html's shady-render\n * module.\n *\n * **Most users will never need to touch this property.**\n *\n * This property should not be confused with the `render` instance method,\n * which should be overridden to define a template for the element.\n *\n * Advanced users creating a new base class based on LitElement can override\n * this property to point to a custom render method with a signature that\n * matches [shady-render's `render`\n * method](https://lit-html.polymer-project.org/api/modules/shady_render.html#render).\n *\n * @nocollapse\n */\n static render:\n (result: unknown, container: Element|DocumentFragment,\n options: ShadyRenderOptions) => void = render;\n\n /**\n * Array of styles to apply to the element. The styles should be defined\n * using the [[`css`]] tag function or via constructible stylesheets.\n */\n static styles?: CSSResultOrNative|CSSResultArray;\n\n private static _styles: Array<CSSResultOrNative|CSSResult>|undefined;\n\n /**\n * Return the array of styles to apply to the element.\n * Override this method to integrate into a style management system.\n *\n * @nocollapse\n */\n static getStyles(): CSSResultOrNative|CSSResultArray|undefined {\n return this.styles;\n }\n\n /** @nocollapse */\n private static _getUniqueStyles() {\n // Only gather styles once per class\n if (this.hasOwnProperty(JSCompiler_renameProperty('_styles', this))) {\n return;\n }\n // Take care not to call `this.getStyles()` multiple times since this\n // generates new CSSResults each time.\n // TODO(sorvell): Since we do not cache CSSResults by input, any\n // shared styles will generate new stylesheet objects, which is wasteful.\n // This should be addressed when a browser ships constructable\n // stylesheets.\n const userStyles = this.getStyles();\n\n if (Array.isArray(userStyles)) {\n // De-duplicate styles preserving the _last_ instance in the set.\n // This is a performance optimization to avoid duplicated styles that can\n // occur especially when composing via subclassing.\n // The last item is kept to try to preserve the cascade order with the\n // assumption that it's most important that last added styles override\n // previous styles.\n const addStyles = (styles: CSSResultArray, set: Set<CSSResultOrNative>):\n Set<CSSResultOrNative> => styles.reduceRight(\n (set: Set<CSSResultOrNative>, s) =>\n // Note: On IE set.add() does not return the set\n Array.isArray(s) ? addStyles(s, set) : (set.add(s), set),\n set);\n // Array.from does not work on Set in IE, otherwise return\n // Array.from(addStyles(userStyles, new Set<CSSResult>())).reverse()\n const set = addStyles(userStyles, new Set<CSSResultOrNative>());\n const styles: CSSResultOrNative[] = [];\n set.forEach((v) => styles.unshift(v));\n this._styles = styles;\n } else {\n this._styles = userStyles === undefined ? [] : [userStyles];\n }\n\n // Ensure that there are no invalid CSSStyleSheet instances here. They are\n // invalid in two conditions.\n // (1) the sheet is non-constructible (`sheet` of a HTMLStyleElement), but\n // this is impossible to check except via .replaceSync or use\n // (2) the ShadyCSS polyfill is enabled (:. supportsAdoptingStyleSheets is\n // false)\n this._styles = this._styles.map((s) => {\n if (s instanceof CSSStyleSheet && !supportsAdoptingStyleSheets) {\n // Flatten the cssText from the passed constructible stylesheet (or\n // undetectable non-constructible stylesheet). The user might have\n // expected to update their stylesheets over time, but the alternative\n // is a crash.\n const cssText = Array.prototype.slice.call(s.cssRules)\n .reduce((css, rule) => css + rule.cssText, '');\n return unsafeCSS(cssText);\n }\n return s;\n });\n }\n\n private _needsShimAdoptedStyleSheets?: boolean;\n\n /**\n * Node or ShadowRoot into which element DOM should be rendered. Defaults\n * to an open shadowRoot.\n */\n readonly renderRoot!: Element|DocumentFragment;\n\n /**\n * Performs element initialization. By default this calls\n * [[`createRenderRoot`]] to create the element [[`renderRoot`]] node and\n * captures any pre-set values for registered properties.\n */\n protected initialize() {\n super.initialize();\n (this.constructor as typeof LitElement)._getUniqueStyles();\n (this as {\n renderRoot: Element|DocumentFragment;\n }).renderRoot = this.createRenderRoot();\n // Note, if renderRoot is not a shadowRoot, styles would/could apply to the\n // element's getRootNode(). While this could be done, we're choosing not to\n // support this now since it would require different logic around de-duping.\n if (window.ShadowRoot && this.renderRoot instanceof window.ShadowRoot) {\n this.adoptStyles();\n }\n }\n\n /**\n * Returns the node into which the element should render and by default\n * creates and returns an open shadowRoot. Implement to customize where the\n * element's DOM is rendered. For example, to render into the element's\n * childNodes, return `this`.\n * @returns {Element|DocumentFragment} Returns a node into which to render.\n */\n protected createRenderRoot(): Element|ShadowRoot {\n return this.attachShadow({mode: 'open'});\n }\n\n /**\n * Applies styling to the element shadowRoot using the [[`styles`]]\n * property. Styling will apply using `shadowRoot.adoptedStyleSheets` where\n * available and will fallback otherwise. When Shadow DOM is polyfilled,\n * ShadyCSS scopes styles and adds them to the document. When Shadow DOM\n * is available but `adoptedStyleSheets` is not, styles are appended to the\n * end of the `shadowRoot` to [mimic spec\n * behavior](https://wicg.github.io/construct-stylesheets/#using-constructed-stylesheets).\n */\n protected adoptStyles() {\n const styles = (this.constructor as typeof LitElement)._styles!;\n if (styles.length === 0) {\n return;\n }\n // There are three separate cases here based on Shadow DOM support.\n // (1) shadowRoot polyfilled: use ShadyCSS\n // (2) shadowRoot.adoptedStyleSheets available: use it\n // (3) shadowRoot.adoptedStyleSheets polyfilled: append styles after\n // rendering\n if (window.ShadyCSS !== undefined && !window.ShadyCSS.nativeShadow) {\n window.ShadyCSS.ScopingShim!.prepareAdoptedCssText(\n styles.map((s) => s.cssText), this.localName);\n } else if (supportsAdoptingStyleSheets) {\n (this.renderRoot as ShadowRoot).adoptedStyleSheets =\n styles.map((s) => s instanceof CSSStyleSheet ? s : s.styleSheet!);\n } else {\n // This must be done after rendering so the actual style insertion is done\n // in `update`.\n this._needsShimAdoptedStyleSheets = true;\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n // Note, first update/render handles styleElement so we only call this if\n // connected after first update.\n if (this.hasUpdated && window.ShadyCSS !== undefined) {\n window.ShadyCSS.styleElement(this);\n }\n }\n\n /**\n * Updates the element. This method reflects property values to attributes\n * and calls `render` to render DOM via lit-html. Setting properties inside\n * this method will *not* trigger another update.\n * @param _changedProperties Map of changed properties with old values\n */\n protected update(changedProperties: PropertyValues) {\n // Setting properties in `render` should not trigger an update. Since\n // updates are allowed after super.update, it's important to call `render`\n // before that.\n const templateResult = this.render();\n super.update(changedProperties);\n // If render is not implemented by the component, don't call lit-html render\n if (templateResult !== renderNotImplemented) {\n (this.constructor as typeof LitElement)\n .render(\n templateResult,\n this.renderRoot,\n {scopeName: this.localName, eventContext: this});\n }\n // When native Shadow DOM is used but adoptedStyles are not supported,\n // insert styling after rendering to ensure adoptedStyles have highest\n // priority.\n if (this._needsShimAdoptedStyleSheets) {\n this._needsShimAdoptedStyleSheets = false;\n (this.constructor as typeof LitElement)._styles!.forEach((s) => {\n const style = document.createElement('style');\n style.textContent = s.cssText;\n this.renderRoot.appendChild(style);\n });\n }\n }\n\n /**\n * Invoked on each update to perform rendering tasks. This method may return\n * any value renderable by lit-html's `NodePart` - typically a\n * `TemplateResult`. Setting properties inside this method will *not* trigger\n * the element to update.\n */\n protected render(): unknown {\n return renderNotImplemented;\n }\n}\n", "import { LitElement, html } from 'lit-element';\nimport expression from 'logical-expression-parser';\nimport { connect } from '../core/connect';\nimport { withProduct } from '../core/resolveProperties';\nimport * as descriptors from '../core/descriptors';\n\nexport const removeWhitespace = str => str.replace(/(\\r\\n|\\n|\\r|\\s)+/gm, '');\n\nexport class When extends withProduct(LitElement) {\n static get properties() {\n return {\n ...super.properties,\n state: { type: Object, attribute: false },\n test: { type: String }\n };\n }\n\n render() {\n if (!this.test) {\n return html``;\n }\n\n let test = removeWhitespace(this.test);\n // the parser returns incorrect result if you use an expression with &!, e.g. test1&!test2\n // it succeeds if you wrap !test2 in parentheses, e.g. test1&(!test2)\n // so we'll wrap all \"not\" expressions in parentheses\n test = test.replace(/(![a-zA-Z]+)/g, '($1)');\n const result = expression.parse(test, key => descriptors[key] && descriptors[key](this.state, this));\n\n if (result) {\n return html`\n <slot></slot>\n `;\n }\n return html``;\n }\n\n shouldUpdate(changedProperties) {\n return (\n changedProperties.size &&\n ((this.product && this.product.id in this.state.autoshipEligible && this.product.id in this.state.inStock) ||\n !this.product.id)\n );\n }\n}\n\nexport const mapStateToProps = state => ({\n state\n});\n\nexport const ConnectedWhen = connect(mapStateToProps)(When);\n\nexport default ConnectedWhen;\n", "import { LitElement } from 'lit-element';\n\nexport const sanitizeFrequencyString = value => {\n const matchDwm = String(value || '')\n .trim()\n .match(/(\\d+)\\s*([dwm])/);\n\n if (matchDwm) {\n return `${matchDwm[1]}_${{ d: 1, w: 2, m: 3 }[matchDwm[2]]}`;\n }\n return value;\n};\n\nexport const buildProduct = element =>\n element.hasAttribute('product') && {\n id: element.getAttribute('product'),\n ...(element.hasAttribute('product-components') && {\n components: JSON.parse(element.getAttribute('product-components'))\n })\n };\n\nexport const resolveFromParentElement = (element, key) => {\n let offer;\n let ref = element;\n while (ref) {\n if (ref instanceof LitElement && ref.tagName.startsWith('OG-') && ref.hasAttribute(key)) {\n return ref;\n }\n ref = ref.nodeType === 11 ? ref.host : ref.parentNode;\n }\n if (!offer) {\n console.warn(`No OG parent element found that has attribute [${key}]`, element);\n }\n return offer;\n};\n\nexport const resolveProduct = element => {\n let product = buildProduct(element);\n if (!product) {\n const offer = element.offer;\n if (offer) {\n product = buildProduct(offer);\n }\n }\n return product;\n};\n\nexport const resolveOffer = element => {\n let ref = element;\n while (ref) {\n if (ref.tagName === 'OG-OFFER') {\n return ref;\n }\n ref = ref.nodeType === 11 ? ref.host : ref.parentNode;\n }\n return undefined;\n};\n\nexport const withOfferTemplate = Base =>\n class extends Base {\n get offer() {\n return resolveOffer(this);\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.offersChangeTemplate = this.offersChangeTemplate.bind(this);\n if (this.offer) {\n this.offer.addEventListener('template-changed', this.offersChangeTemplate);\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n if (this.offer) {\n this.offer.removeEventListener('template-changed', this.offersChangeTemplate);\n }\n }\n\n offersChangeTemplate() {\n this._enqueueUpdate();\n }\n };\n\nexport const withProduct = Base =>\n class extends withOfferTemplate(Base) {\n get product() {\n return resolveProduct(this);\n }\n };\n\nexport const withChildOptions = Base =>\n class extends Base {\n get childOptions() {\n const options = [];\n let isSelected = null;\n\n this.querySelectorAll('option').forEach(it => {\n const value = sanitizeFrequencyString(it.value);\n const text = it.innerText.trim();\n options.push({ value, text });\n if (!isSelected && it.selected) {\n isSelected = value;\n }\n });\n return { options, isSelected };\n }\n };\n", "import { ELIGIBILITY_GROUPS } from './constants';\nimport {\n makeSubscribedSelector,\n makeOptedoutSelector,\n makePrepaidSubscribedSelector,\n makeProductPrepaidShipmentOptionsSelector\n} from './selectors';\nimport { safeProductId } from './utils';\n\nexport const inStock = (state, ownProps) => (state.inStock || {})[(ownProps.product || {}).id];\nexport const eligible = (state, ownProps) => (state.autoshipEligible || {})[(ownProps.product || {}).id] || false;\nexport const autoshipByDefault = (state, ownProps) =>\n (state.autoshipByDefault || {})[(ownProps.product || {}).id] || false;\n\nexport const subscriptionEligible = (state, ownProps) =>\n ((state.offerId && state.offerId !== '0') || false) && eligible(state, ownProps) && inStock(state, ownProps);\nexport const eligibilityGroups = (state, ownProps) => {\n const productId = safeProductId((ownProps.product || {}).id);\n return (state.eligibilityGroups || {})[productId] || null;\n};\n\nexport const hasUpsellGroup = (state, ownProps) => {\n const groups = eligibilityGroups(state, ownProps);\n return groups === null || !!groups.find(it => it === 'upsell' || it === 'impulse_upsell');\n};\n\nexport const prepaidEligible = (state, ownProps) => {\n const groups = eligibilityGroups(state, ownProps);\n return groups?.some(it => it === ELIGIBILITY_GROUPS.PREPAID) || false;\n};\n\nexport const subscribed = (state, ownProps) => makeSubscribedSelector(ownProps.product)(state);\nexport const optedout = (state, ownProps) => makeOptedoutSelector(ownProps.product)(state);\nexport const prepaidSubscribed = (state, ownProps) => makePrepaidSubscribedSelector(ownProps.product)(state);\nexport const hasPrepaidOptions = (state, ownProps) =>\n makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state).length > 0;\n\nexport const hasUpcomingOrder = state => !!(state.nextUpcomingOrder && state.nextUpcomingOrder.public_id);\n\nexport const upcomingOrderContainsProduct = (state, ownProps) =>\n ((state.nextUpcomingOrder && state.nextUpcomingOrder.products) || []).includes((ownProps.product || {}).id);\n\n/**\n * This conditions return true when an offer and product are eligible for impulse upsell\n *\n * @param {*} state\n * @param {*} ownProps\n */\nexport const upsellEligible = (state, ownProps) =>\n // don't show IU in cart offers\n !ownProps.offer?.isCart &&\n state.offerId &&\n state.offerId !== '0' &&\n state.auth &&\n inStock(state, ownProps) &&\n hasUpcomingOrder(state) &&\n hasUpsellGroup(state, ownProps);\n/**\n * Determinates when an offer is eligible for regular, when product in stock and eligible but not upsell\n *\n * Upgrade from 2.13, this replaces slot=\"standard-tempalate\" in og-offer\n * @param {*} state\n * @param {*} ownProps\n */\nexport const regularEligible = (state, ownProps) =>\n subscriptionEligible(state, ownProps) && !upsellEligible(state, ownProps);\n", "import { isFrequencyValid } from './api';\n/**\n * {\"id\": \"<id>\", \"components\": [\"<#1>\",\"<#2>\",...,\"<#n>\"] }\n * {\"id\": \"<id>\"}\n */\nexport const product = {\n type: Object,\n converter: {\n toAttribute(value) {\n return value == null ? value : JSON.stringify(value);\n },\n fromAttribute(value) {\n return value && value.match(/[{[]/) ? JSON.parse(value) : { id: value };\n }\n }\n};\nexport const defaultFrequency = {\n type: String,\n attribute: 'default-frequency',\n converter: {\n fromAttribute(value) {\n return value && isFrequencyValid(value) ? value : null;\n }\n }\n};\nexport const subscribed = { type: Boolean, attribute: true, reflect: true };\nexport const auth = { type: Object, attribute: false };\nexport default { product, defaultFrequency };\n", "import { LitElement } from 'lit-element';\n\nexport const withTemplate = Base =>\n class extends Base {\n applyTemplate(template) {\n this.template = template;\n // update innerHTML if change (performance)\n const markup = typeof template.markup === 'undefined' ? this.constructor.initialTemplate : template.markup;\n if (markup && this._templateMarkup !== markup) {\n this._templateMarkup = markup;\n this.innerHTML = markup;\n }\n }\n\n refreshTemplate() {\n if (this._templates && this._templates.length) {\n // if offer is using templates.\n const tmpl = this._templates.find(({ selector }) => {\n try {\n return this.matches(selector);\n } catch (e) {\n return false;\n }\n });\n this.applyTemplate(tmpl || {});\n }\n }\n\n set templates(val) {\n this._templates = val;\n this.refreshTemplate();\n }\n\n connectedCallback() {\n if (super.connectedCallback) {\n super.connectedCallback();\n }\n if (this.constructor.initialTemplate && !this.innerHTML.trim()) {\n this.innerHTML = this.constructor.initialTemplate;\n }\n }\n };\n\nexport const TemplateElement = withTemplate(LitElement);\n\nexport default { TemplateElement };\n", "import { html, css } from 'lit-element';\nimport {\n makeOptedinSelector,\n makeProductSpecificDefaultFrequencySelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makeProductFrequencyOptedInSelector,\n getFallbackValue,\n templatesSelector,\n makeProductFrequenciesSelector,\n makeProductDefaultFrequencySelector,\n makeProductFrequencyOptionsSelector\n} from '../core/selectors';\nimport { connect } from '../core/connect';\nimport { subscribed } from '../core/props';\nimport { withProduct } from '../core/resolveProperties';\nimport { TemplateElement } from '../core/base';\n\nexport class OptinStatus extends withProduct(TemplateElement) {\n static get properties() {\n return {\n subscribed,\n frequencyMatch: { type: Boolean, reflect: true, attribute: 'frequency-match' },\n productDefaultFrequency: { type: String },\n defaultFrequency: { type: String },\n frequencies: { type: Array }\n };\n }\n\n static get styles() {\n return css`\n :host {\n cursor: default;\n display: inline-block;\n }\n\n :host[hidden] {\n display: none;\n }\n\n .btn {\n position: relative;\n width: var(--og-radio-width, 1.4em);\n height: var(--og-radio-height, 1.4em);\n margin: var(--og-radio-margin, 0);\n padding: 0;\n border: 1px solid var(--og-primary-color, var(--og-border-color, black));\n background: #fff;\n border-radius: 100%;\n vertical-align: middle;\n color: var(--og-primary-color, var(--og-btn-color, black));\n }\n\n .radio {\n text-indent: -9999px;\n flex-shrink: 0;\n }\n\n .checkbox {\n border-radius: 3px;\n }\n\n .radio,\n .checkbox {\n border-color: var(--og-checkbox-border-color, black);\n }\n\n .checkbox.active::after,\n .radio.active::after {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n background: var(--og-checkbox-border-color, black);\n }\n\n .radio.active::after {\n content: ' ';\n border-radius: 100%;\n border: 2px solid #fff;\n }\n\n .checkbox.active::after {\n border: none;\n border-radius: 0;\n background: #fff;\n content: '\\\\2714';\n line-height: 1;\n text-align: center;\n overflow: visible;\n }\n `;\n }\n\n constructor() {\n super();\n this.addEventListener('click', this.handleClick.bind(this));\n }\n\n updated(changed) {\n if (changed.has('subscribed')) {\n this.frequencyMatch = this.frequency === this.defaultFrequency;\n }\n }\n\n handleClick() {}\n\n render() {\n if (this.subscribed && !this.defaultFrequency)\n return html`\n <slot name=\"subscribed\"></slot>\n <slot name=\"frequency-mismatch\"></slot>\n `;\n\n if (this.subscribed && this.defaultFrequency === this.frequency)\n return html`\n <slot name=\"subscribed\"></slot>\n <slot name=\"frequency-match\"></slot>\n `;\n\n if (this.subscribed && this.defaultFrequency !== this.frequency)\n return html`\n <slot name=\"subscribed\"></slot>\n <slot name=\"frequency-mismatch\"></slot>\n `;\n\n return html`\n <slot name=\"not-subscribed\"></slot>\n `;\n }\n}\n\nexport const mapStateToProps = (state, ownProps = {}) => ({\n subscribed: makeOptedinSelector(ownProps.product)(state),\n frequency: makeProductFrequencyOptedInSelector(ownProps.product)(state),\n productDefaultFrequency: makeProductSpecificDefaultFrequencySelector((ownProps.product || {}).id)(state),\n prepaidShipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n defaultFrequency:\n makeProductDefaultFrequencySelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'defaultFrequency'),\n frequencies:\n // it's unclear whether the getFallbackValue result is ever used here, but leaving for backwards compatibility\n makeProductFrequencyOptionsSelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'frequencies'),\n ...templatesSelector(state, ownProps),\n productFrequencies: makeProductFrequenciesSelector(ownProps.product)(state)\n});\n\nexport const ConnectedOptinStatus = connect(mapStateToProps)(OptinStatus);\n\nexport default ConnectedOptinStatus;\n", "import { html } from 'lit-element';\nimport { optinProduct } from '../core/actions';\nimport { OptinStatus, mapStateToProps } from './OptinStatus';\nimport { connect } from '../core/connect';\nimport { defaultFrequency } from '../core/props';\nimport { resolveProduct } from '../core/resolveProperties';\nimport { frequencyToSellingPlan } from '../core/utils';\nimport platform from '../platform';\n\nexport class OptinButton extends OptinStatus {\n static get properties() {\n return {\n ...super.properties,\n frequency: { type: String, reflect: true },\n defaultFrequency,\n optinButtonLabel: { type: String }\n };\n }\n\n updated(changed) {\n if (changed.has('subscribed') || changed.has('frequencies')) {\n if (platform.shopify_selling_plans && this.store) {\n let buttonFreq = this.getAttribute('default-frequency');\n buttonFreq = frequencyToSellingPlan(buttonFreq, this.productFrequencies);\n this.sellingPlanFreq = buttonFreq;\n }\n this.frequencyMatch = this.frequency === this.optinFrequency;\n }\n }\n\n get optinFrequency() {\n let freq;\n\n // use the attribute since this.defaultFrequency comes from mapStateToProps and contains more logic\n if (this.sellingPlanFreq) {\n freq = this.sellingPlanFreq;\n } else if (this.hasAttribute('default-frequency')) {\n freq = this.getAttribute('default-frequency');\n } else {\n freq = this.offer ? this.offer.defaultFrequency : this.defaultFrequency;\n }\n if (platform.shopify_selling_plans && this.store) {\n freq = frequencyToSellingPlan(freq, this.productFrequencies);\n }\n\n return freq;\n }\n\n handleClick(ev) {\n this.optinProduct(resolveProduct(this), this.optinFrequency, this.offer);\n ev.preventDefault();\n }\n\n render() {\n return html`\n <slot name=\"default\">\n <button\n aria-labelledby=\"ogOfferOptInLabel\"\n role=\"radio\"\n aria-checked=\"${!!this.subscribed}\"\n class=\"btn radio ${this.subscribed ? 'active' : ''}\"\n ></button>\n <label id=\"ogOfferOptInLabel\">\n <slot>\n <slot name=\"label\"><og-text key=\"offerOptInLabel\"></og-text></slot>\n </slot>\n </label>\n </slot>\n `;\n }\n}\n\nexport const ConnectedOptinButton = connect(mapStateToProps, { optinProduct })(OptinButton);\n\nexport default ConnectedOptinButton;\n", "import { html } from 'lit-element';\nimport { optoutProduct } from '../core/actions';\nimport { OptinStatus, mapStateToProps } from './OptinStatus';\nimport { connect } from '../core/connect';\n\nexport class OptoutButton extends OptinStatus {\n static get properties() {\n return {\n ...super.properties,\n label: { type: String }\n };\n }\n\n handleClick(ev) {\n this.optoutProduct(this.product, this.offer);\n ev.preventDefault();\n }\n\n render() {\n return html`\n <slot name=\"default\">\n <button\n aria-labelledby=\"ogOfferOptOutLabel\"\n role=\"radio\"\n aria-checked=\"${!this.subscribed}\"\n class=\"btn radio ${this.subscribed ? '' : 'active'}\"\n ></button>\n <label id=\"ogOfferOptOutLabel\">\n <slot>\n <og-text key=\"offerOptOutLabel\"></og-text>\n </slot>\n </label>\n </slot>\n `;\n }\n}\n\nexport const ConnectedOptoutButton = connect(mapStateToProps, { optoutProduct })(OptoutButton);\n\nexport default ConnectedOptoutButton;\n", "import { html, css } from 'lit-element';\nimport {\n makeProductFrequencyOptedInSelector,\n makeOptedinSelector,\n getFallbackValue,\n templatesSelector,\n makeProductSpecificDefaultFrequencySelector,\n makeProductFrequenciesSelector,\n makeProductFrequencyOptionsSelector,\n makeProductDefaultFrequencySelector\n} from '../core/selectors';\nimport { connect } from '../core/connect';\nimport { subscribed, defaultFrequency } from '../core/props';\nimport { parseFrequency, parseFrequenciesList } from '../core/api';\nimport { withProduct } from '../core/resolveProperties';\nimport { TemplateElement } from '../core/base';\n\nexport const frequencyText = (frequency, initial) => {\n const { every, every_period: period } = parseFrequency(frequency);\n return every && period\n ? html`\n ${every}\n <og-text key=\"frequencyPeriods\" variant=\"${period}\" pluralize=\"${every}\"></og-text>\n ${initial && initial === frequency\n ? html`\n <og-text key=\"defaultFrequencyCopy\"></og-text>\n `\n : ''}\n `\n : frequency;\n};\n\nexport class FrequencyStatus extends withProduct(TemplateElement) {\n static get properties() {\n return {\n ...super.properties,\n disabled: { type: Boolean },\n subscribed,\n frequency: { type: String },\n defaultFrequency,\n productDefaultFrequency: { type: String },\n config: { type: Object },\n frequencies: {\n converter: {\n fromAttribute: parseFrequenciesList\n }\n }\n };\n }\n\n static get styles() {\n return css`\n :host[hidden] {\n display: none;\n }\n :host {\n display: inline-block;\n }\n `;\n }\n\n constructor() {\n super();\n this.frequencies = [];\n }\n\n render() {\n const frequency = this.frequency || this.defaultFrequency;\n return html`\n <span>\n ${(this.subscribed &&\n html`\n <slot name=\"subscribed\">${frequencyText(frequency)}</slot>\n `) ||\n ''}\n ${(!this.subscribed &&\n html`\n <slot name=\"not-subscribed\"></slot>\n `) ||\n ''}\n ${(this.subscribed &&\n this.defaultFrequency &&\n this.defaultFrequency !== this.frequency &&\n html`\n <slot name=\"frequency-mismatch\"></slot>\n `) ||\n ''}\n </span>\n `;\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => ({\n subscribed: makeOptedinSelector(ownProps.product)(state),\n frequency: makeProductFrequencyOptedInSelector(ownProps.product)(state),\n productDefaultFrequency: makeProductSpecificDefaultFrequencySelector((ownProps.product || {}).id)(state),\n frequencies:\n // it's unclear whether the getFallbackValue result is ever used here, but leaving for backwards compatibility\n makeProductFrequencyOptionsSelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'frequencies'),\n defaultFrequency:\n makeProductDefaultFrequencySelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'defaultFrequency'),\n ...templatesSelector(state, ownProps),\n productFrequencies: makeProductFrequenciesSelector(ownProps.product)(state)\n});\n\nexport const ConnectedFrequencyStatus = connect(mapStateToProps)(FrequencyStatus);\n\nexport default ConnectedFrequencyStatus;\n", "import { html, css } from 'lit-element';\nimport { productChangeFrequency, optoutProduct } from '../core/actions';\nimport { withChildOptions } from '../core/resolveProperties';\nimport { OptinStatus, mapStateToProps as mapStateToPropsOptinStatus } from './OptinStatus';\nimport { mapStateToProps, frequencyText } from './FrequencyStatus';\nimport { connect } from '../core/connect';\nimport { defaultFrequency } from '../core/props';\nimport { getFallbackValue, makeProductFrequencyOptionsSelector } from '../core/selectors';\n\nexport class OptinSelect extends withChildOptions(OptinStatus) {\n static get properties() {\n return {\n ...super.properties,\n frequencies: { type: Array, attribute: false },\n frequency: { type: String },\n defaultFrequency,\n /* The label used for the underlying select. */\n selectLabel: { type: String, attribute: 'select-label' }\n };\n }\n\n static get styles() {\n return css`\n :host {\n display: inline-block;\n cursor: pointer;\n background-color: var(--og-select-bg-color, #fff);\n border: var(--og-select-border, 1px solid #aaa);\n border-radius: var(--og-select-border-radius, 0.5em);\n border-width: var(--og-select-border-width, 1px);\n box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);\n }\n `;\n }\n\n get currentFrequency() {\n if (!this.subscribed) {\n return 'optedOut';\n }\n\n return this.frequency || this.productDefaultFrequency || this.defaultFrequency;\n }\n\n onOptinChange(value) {\n if (value === 'optedOut') {\n this.optoutProduct(this.product, this.offer);\n } else {\n this.productChangeFrequency(this.product, value, this.offer);\n }\n }\n\n render() {\n const { options: childOptions } = this.childOptions;\n let options;\n if (this.frequencies?.length) {\n const { frequenciesText } = this.productFrequencies;\n options = [\n ...([childOptions.find(option => option.value === 'optedOut')] || []),\n ...this.frequencies.map((value, ix) => ({\n value,\n text:\n frequenciesText && ix in frequenciesText ? frequenciesText[ix] : frequencyText(value, this.defaultFrequency)\n }))\n ];\n } else {\n options = childOptions;\n }\n\n return html`\n <og-select\n .options=\"${options}\"\n .selected=\"${this.currentFrequency}\"\n .onChange=\"${({ target: { value } }) => this.onOptinChange(value)}\"\n .ariaLabel=\"${this.selectLabel}\"\n ></og-select>\n `;\n }\n}\n\nexport const ConnectedOptinSelect = connect(\n (state, ownProps) => ({\n ...mapStateToPropsOptinStatus(state, ownProps),\n ...mapStateToProps(state, ownProps),\n frequencies:\n // it's unclear whether the getFallbackValue result is ever used here, but leaving for backwards compatibility\n makeProductFrequencyOptionsSelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'frequencies')\n }),\n { productChangeFrequency, optoutProduct }\n)(OptinSelect);\n\nexport default ConnectedOptinSelect;\n", "import { html, css } from 'lit-element';\nimport { fetchOrders, createIu, concludeUpsell } from '../core/actions';\nimport { connect } from '../core/connect';\nimport { auth } from '../core/props';\nimport { withProduct } from '../core/resolveProperties';\nimport { TemplateElement } from '../core/base';\n\nexport class UpsellButton extends withProduct(TemplateElement) {\n static get styles() {\n return css`\n :host[hidden] {\n display: none;\n }\n :host {\n display: inline-block;\n }\n `;\n }\n\n static get properties() {\n return {\n ...super.properties,\n upcomingOrderDate: {\n type: String,\n attribute: false\n },\n auth,\n isPreview: { type: Boolean, attribute: false },\n target: { type: String },\n // If set, creates the IU item immediately instead of opening a modal\n skipModal: { type: Boolean, attribute: 'skip-modal' }\n };\n }\n\n constructor() {\n super();\n this.fetchOrders = () => 0;\n this.createIu = () => 0;\n this.concludeUpsell = () => 0;\n this.addEventListener('click', this.handleClick.bind(this));\n }\n\n updated(changed) {\n if (changed.has('auth') && this.auth && !this.upcomingOrderDate && !this.isPreview) {\n this.fetchOrders();\n }\n }\n\n handleClick() {\n let modal;\n if (this.skipModal) {\n this.createIu(this.product, this.nextUpcomingOrder.public_id, 1, false, null);\n this.concludeUpsell(this.product);\n } else if (!this.target && this.offer) {\n // TODO remove offer shadowRoot built in code.\n modal = this.offer.querySelector('og-upsell-modal');\n if (!modal) {\n modal = this.offer.shadowRoot.querySelector('og-upsell-modal');\n }\n } else if (this.target) {\n modal = document.querySelector(this.target);\n } else {\n throw Error('You must specify a target attribute or place this element as child of og-offer');\n }\n if (modal) {\n modal.setAttribute('show', true);\n }\n }\n\n render() {\n return html`\n <slot>\n <og-next-upcoming-order></og-next-upcoming-order>\n </slot>\n `;\n }\n}\n\nexport const mapStateToProps = state => ({\n isPreview: state.previewUpsellOffer,\n nextUpcomingOrder: state.previewUpsellOffer ? { public_id: 'preview-order-id' } : state.nextUpcomingOrder\n});\n\nexport const ConnectedUpsellButton = connect(mapStateToProps, { fetchOrders, createIu, concludeUpsell })(UpsellButton);\n\nexport default UpsellButton;\n", "import { html } from 'lit-element';\nimport { concludeUpsell, createIu } from '../core/actions';\nimport { connect } from '../core/connect';\nimport { auth, defaultFrequency } from '../core/props';\nimport {\n makeOptedinSelector,\n makeProductFrequencyOptedInSelector,\n getFallbackValue,\n makeProductDefaultFrequencySelector\n} from '../core/selectors';\nimport { withProduct } from '../core/resolveProperties';\nimport { TemplateElement } from '../core/base';\n\nexport class UpsellModal extends withProduct(TemplateElement) {\n static get properties() {\n return {\n ...super.properties,\n defaultFrequency,\n auth,\n subscribed: { type: Boolean, attribute: false },\n frequency: { type: String, attribute: false },\n nextUpcomingOrder: { type: Object, attribute: false },\n show: { type: Boolean, attribute: 'show' },\n offerId: { type: String }\n };\n }\n\n constructor() {\n super();\n this.createIu = () => 0;\n this.concludeUpsell = () => 0;\n }\n\n render() {\n return html`\n <og-modal ?show=${this.show} @close=${() => this.close()} @confirm=${() => this.confirm()}>\n <div slot=\"content\">\n <slot>\n <slot name=\"content\">\n <og-text key=\"upsellModalContent\"></og-text>\n </slot>\n <slot name=\"offer\">\n <br />\n\n <og-optout-button>\n <slot name=\"opt-out-label\">\n <og-text key=\"upsellModalOptOutLabel\" slot=\"label\"></og-text>\n </slot>\n </og-optout-button>\n <br />\n <og-optin-button default-frequency=${this.defaultFrequency}>\n <slot name=\"opt-in-label\">\n <og-text key=\"upsellModalOptInLabel\" slot=\"label\"></og-text>\n </slot>\n </og-optin-button>\n <br />\n <slot name=\"every-label\">\n <og-text key=\"offerEveryLabel\"></og-text>\n </slot>\n <og-select-frequency default-frequency=${this.defaultFrequency}></og-select-frequency>\n </slot>\n </slot>\n </div>\n <span slot=\"confirm\">\n <slot name=\"confirm\"><og-text key=\"upsellModalConfirmLabel\"></og-text></slot>\n </span>\n <span slot=\"cancel\">\n <slot name=\"cancel\">\n <og-text key=\"upsellModalCancelLabel\"></og-text>\n </slot>\n </span>\n </og-modal>\n `;\n }\n\n set defaultFrequency(val) {\n this._defaultFrequency = val;\n }\n\n get defaultFrequency() {\n const freq = this.querySelector('og-select-frequency');\n if (freq) {\n return freq.defaultFrequency;\n }\n\n return this._defaultFrequency;\n }\n\n confirm() {\n this.createIu(\n this.product,\n this.nextUpcomingOrder.public_id,\n 1,\n this.subscribed,\n this.frequency || this.defaultFrequency\n );\n this.close();\n }\n\n close() {\n this.concludeUpsell();\n this.removeAttribute('show');\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => ({\n auth: state.auth,\n offerId: state.offerId,\n subscribed: makeOptedinSelector(ownProps.product)(state),\n frequency: makeProductFrequencyOptedInSelector(ownProps.product)(state),\n defaultFrequency:\n makeProductDefaultFrequencySelector(ownProps.product?.id)(state) || getFallbackValue(ownProps, 'defaultFrequency'),\n nextUpcomingOrder: state.previewUpsellOffer ? { public_id: 'preview-order-id' } : state.nextUpcomingOrder,\n isPreview: state.previewUpsellOffer\n});\n\nexport const ConnectedUpsellModal = connect(mapStateToProps, {\n concludeUpsell,\n createIu\n})(UpsellModal);\n\nexport default UpsellModal;\n", "import { html, css } from 'lit-element';\n\nimport { optinProduct, optoutProduct } from '../core/actions';\nimport { OptinStatus, mapStateToProps } from './OptinStatus';\nimport { connect } from '../core/connect';\n\nexport class OptinToggle extends OptinStatus {\n static get properties() {\n return {\n ...super.properties,\n frequency: { type: String }\n };\n }\n\n static get styles() {\n return css`\n :host {\n cursor: default;\n display: inline-block;\n }\n\n .btn {\n position: relative;\n width: var(--og-radio-width, 1.4em);\n height: var(--og-radio-height, 1.4em);\n margin: var(--og-radio-margin, 0);\n padding: 0;\n border: 1px solid var(--og-checkbox-border-color, black);\n background: #fff;\n vertical-align: middle;\n color: var(--og-primary-color, black);\n display: inline-flex;\n justify-content: center;\n align-items: center;\n border-radius: 3px;\n }\n\n .btn.active {\n background: var(--og-checkbox-border-color, black);\n }\n\n .btn.active:after {\n content: '\u2713';\n color: #fff;\n transform: scale(1.6);\n margin-left: 2px;\n }\n `;\n }\n\n handleClick(ev) {\n if (this.subscribed) {\n this.optoutProduct(this.product, this.offer);\n } else {\n this.optinProduct(\n this.product,\n this.frequency || this.productDefaultFrequency || this.defaultFrequency,\n this.offer\n );\n }\n ev.preventDefault();\n }\n\n render() {\n return html`\n <slot name=\"default\">\n <button id=\"action-trigger\" class=\"btn checkbox ${this.subscribed ? 'active' : ''}\"></button>\n <label for=\"action-trigger\">\n <slot>\n <slot name=\"label\"><og-text key=\"offerOptInLabel\"></og-text></slot>\n </slot>\n </label>\n </slot>\n `;\n }\n}\n\nexport const ConnectedOptinToggle = connect(mapStateToProps, { optoutProduct, optinProduct })(OptinToggle);\n\nexport default ConnectedOptinToggle;\n", "import { LitElement, html } from 'lit-element';\nimport { connect } from '../core/connect';\nimport { withOfferTemplate } from '../core/resolveProperties';\n\nexport const pluralize = (word, count) => `${word}${parseInt(count, 10) > 1 ? 's' : ''}`;\n\nexport class Text extends withOfferTemplate(LitElement) {\n static get properties() {\n return {\n pluralize: { type: Number },\n variant: { type: Number },\n i18n: { type: Object, attribute: false },\n locale: { type: Object, attribute: false },\n key: {\n type: String\n }\n };\n }\n\n createRenderRoot() {\n return this;\n }\n\n connectedCallback() {\n super.connectedCallback();\n this._textOverride = this.innerText.trim();\n }\n\n getText() {\n return this._textOverride ? this._textOverride : this.getPluralizedText(this.getVariantText(this.key));\n }\n\n getVariantText(key) {\n const i18n = {\n ...this.i18n,\n ...(this.offer && this.offer.locale)\n };\n const text = typeof i18n[key] !== 'undefined' ? i18n[key] : '';\n if (typeof this.variant === 'undefined') {\n return text;\n }\n\n return text[this.variant];\n }\n\n getPluralizedText(text) {\n if (typeof this.pluralize === 'undefined') {\n return text;\n }\n\n return text ? pluralize(text, this.pluralize) : text;\n }\n\n render() {\n return html`\n ${this.getText()}\n `;\n }\n}\n\nexport const mapStateToProps = state => ({\n i18n: state.locale || {}\n});\n\nexport const ConnectedText = connect(mapStateToProps)(Text);\n\nexport default ConnectedText;\n", "import { LitElement, html } from 'lit-element';\nimport { connect } from '../core/connect';\nimport { withProduct } from '../core/resolveProperties';\nimport { safeProductId } from '../core/utils';\nimport { INCENTIVE_STANDARD_TYPES } from '../core/constants';\n\nexport class DiscountAmount {\n constructor(value) {\n this.value = value;\n this.className = 'DiscountAmount';\n }\n\n toString() {\n return `${this.value}`;\n }\n}\n\nclass DiscountPercent extends DiscountAmount {\n constructor(value) {\n super(value);\n this.className = 'DiscountPercent';\n }\n\n toString() {\n return `${super.toString()}%`;\n }\n}\n\nclass ShippingDiscountPercent extends DiscountPercent {\n constructor(value) {\n super(value);\n this.className = 'ShippingDiscountPercent';\n }\n\n toString() {\n return this.value === 100 ? 'free shipping' : super.toString();\n }\n}\n\nconst DISCOUNT_PERCENT = 'Discount Percent';\nconst DISCOUNT_AMOUNT = 'Discount Amount';\nconst TOTAL_PRICE = 'total_price';\nconst SHIPPING_TOTAL = 'shipping_total';\nconst SUB_TOTAL = 'sub_total';\n\nconst discountBuilder = ({ field, object, type, value }) => {\n const supportedDiscounts = [\n [new DiscountPercent(value), { field: TOTAL_PRICE, object: 'item', type: DISCOUNT_PERCENT }],\n [new DiscountAmount(value), { field: TOTAL_PRICE, object: 'item', type: DISCOUNT_AMOUNT }],\n [new ShippingDiscountPercent(value), { field: SHIPPING_TOTAL, object: 'order', type: DISCOUNT_PERCENT }],\n [new DiscountAmount(value), { field: SHIPPING_TOTAL, object: 'order', type: DISCOUNT_AMOUNT }],\n [new DiscountPercent(value), { field: SUB_TOTAL, object: 'order', type: DISCOUNT_PERCENT }],\n [new DiscountAmount(value), { field: SUB_TOTAL, object: 'order', type: DISCOUNT_AMOUNT }]\n ];\n\n const available = supportedDiscounts.find(([, it]) => it.field === field && it.object === object && it.type === type);\n return available && available[0];\n};\n\nexport const getTransformedDiscounts = discounts => {\n return discounts.map(discount => discountBuilder(discount)).filter(discount => discount !== undefined);\n};\n\nfunction isMatchingIncentive(incentive, { incentiveValue, incentiveClass }) {\n if (discountBuilder(incentive).className !== incentiveClass) {\n return false;\n }\n\n if (incentiveValue && incentiveValue.toString() !== incentive.value.toString()) {\n return false;\n }\n\n return true;\n}\n\nexport function replaceText(acc, curr) {\n return acc.replace(this.textToReplace, discountBuilder(curr));\n}\n\nconst preferredIncentiveStandards = [INCENTIVE_STANDARD_TYPES.PSI, INCENTIVE_STANDARD_TYPES.PROGRAM_WIDE];\n\nexport class IncentiveText extends withProduct(LitElement) {\n static get properties() {\n return {\n ...super.properties,\n incentives: { type: Object, attribute: false },\n from: { type: String },\n label: { type: String },\n initial: { type: Boolean, default: false },\n value: { type: Number }\n };\n }\n\n createRenderRoot() {\n return this;\n }\n\n render() {\n const incentiveClass = this.from;\n const incentiveValue = this.value;\n const incentiveType = this.initial ? 'initial' : 'ongoing';\n /** @type {import('../core/types/reducer').Incentive[]} */\n const incentivesOfType = this.incentives[incentiveType] || [];\n\n // prefer to display PSI or program wide incentives, if available\n // since the incentives response may contain other incentives that do not apply, e.g. prepaid, Nth order, customer group, etc.\n const preferredIncentives = incentivesOfType.filter(\n incentive =>\n // we only have criteria if the incentive is standardized\n incentive.criteria &&\n incentive.criteria.node_type === 'PREMISE' &&\n // prefer to show non-threshold discounts\n // we don't currently evaluate thresholds, so we don't know if they apply or not (especially if it's order-level)\n !incentive.threshold_field &&\n preferredIncentiveStandards.includes(incentive.criteria.standard)\n );\n\n const incentive = [\n // put preferred incentives first, so we return one of those if it matches\n ...preferredIncentives,\n // if no preferred incentives matched, try the rest\n ...incentivesOfType.filter(incentive => !preferredIncentives.includes(incentive))\n ].find(incentive => isMatchingIncentive(incentive, { incentiveClass, incentiveValue }));\n\n return html`\n ${this.label} ${incentive ? discountBuilder(incentive) : this.renderFallback()}\n `;\n }\n\n renderFallback() {\n return html`\n ${discountBuilder({\n field: 'sub_total',\n object: 'order',\n type: 'Discount Percent',\n value: this.value\n })}\n `;\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => ({\n incentives: (state.incentives || {})[ownProps && ownProps?.product && safeProductId(ownProps?.product?.id)] || {}\n});\n\nexport const ConnectedIncentiveText = connect(mapStateToProps)(IncentiveText);\n\nexport default ConnectedIncentiveText;\n", "/**\n * @license\n * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {isPrimitive} from '../lib/parts.js';\nimport {directive, NodePart, Part} from '../lit-html.js';\n\ninterface PreviousValue {\n readonly value: unknown;\n readonly fragment: DocumentFragment;\n}\n\n// For each part, remember the value that was last rendered to the part by the\n// unsafeHTML directive, and the DocumentFragment that was last set as a value.\n// The DocumentFragment is used as a unique key to check if the last value\n// rendered to the part was with unsafeHTML. If not, we'll always re-render the\n// value passed to unsafeHTML.\nconst previousValues = new WeakMap<NodePart, PreviousValue>();\n\n/**\n * Renders the result as HTML, rather than text.\n *\n * Note, this is unsafe to use with any user-provided input that hasn't been\n * sanitized or escaped, as it may lead to cross-site-scripting\n * vulnerabilities.\n */\nexport const unsafeHTML = directive((value: unknown) => (part: Part): void => {\n if (!(part instanceof NodePart)) {\n throw new Error('unsafeHTML can only be used in text bindings');\n }\n\n const previousValue = previousValues.get(part);\n\n if (previousValue !== undefined && isPrimitive(value) &&\n value === previousValue.value && part.value === previousValue.fragment) {\n return;\n }\n\n const template = document.createElement('template');\n template.innerHTML = value as string; // innerHTML casts to string internally\n const fragment = document.importNode(template.content, true);\n part.setValue(fragment);\n previousValues.set(part, {value, fragment});\n});\n", "import { LitElement, html } from 'lit-element';\nimport { unsafeHTML } from 'lit-html/directives/unsafe-html';\nimport { connect } from '../core/connect';\nimport { withProduct } from '../core/resolveProperties';\nimport { makeBenefitMessagesSelector } from '../core/selectors';\n\nexport class BenefitMessages extends withProduct(LitElement) {\n static get properties() {\n return {\n ...super.properties,\n messages: { type: Array, attribute: false }\n };\n }\n\n createRenderRoot() {\n return this;\n }\n\n render() {\n if (!this.messages?.length) return html``;\n // Messages are expected to be pre-sanitized by SSPC, so we can safely render them as HTML.\n return html`\n <ul class=\"og-benefit-messages\">\n ${this.messages.map(\n msg => html`\n <li>${unsafeHTML(msg)}</li>\n `\n )}\n </ul>\n `;\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => makeBenefitMessagesSelector(ownProps?.product)(state);\n\nexport const ConnectedBenefitMessages = connect(mapStateToProps)(BenefitMessages);\n\nexport default ConnectedBenefitMessages;\n", "import { html, css } from 'lit-element';\nimport { productChangeFrequency } from '../core/actions';\nimport { withChildOptions } from '../core/resolveProperties';\nimport { FrequencyStatus, mapStateToProps, frequencyText } from './FrequencyStatus';\nimport { connect } from '../core/connect';\nimport { frequencyToSellingPlan } from '../core/utils';\n\nexport const frequencyEquals = (a, b) => {\n if (a === null || b === null) return false;\n return a.every === b.every && a.period === b.period;\n};\n\nexport class SelectFrequency extends withChildOptions(FrequencyStatus) {\n static get properties() {\n return {\n ...super.properties,\n defaultText: { type: String, attribute: 'default-text' }\n };\n }\n\n /**\n * // css customization i.e.\n * og-select-frequency {\n * background: black;\n * color: orange;\n * border-radius: 0;\n * font-weight: bold;\n * font-family: Impact;\n * --og-select-padding: 10px 30px 10px 10px;\n * font-size: 20px;\n * }\n */\n static get styles() {\n return css`\n :host {\n display: inline-block;\n cursor: pointer;\n background-color: var(--og-select-bg-color, #fff);\n border: var(--og-select-border, 1px solid #aaa);\n border-radius: var(--og-select-border-radius, 0.5em);\n border-width: var(--og-select-border-width, 1px);\n box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);\n z-index: 1;\n }\n `;\n }\n\n set defaultFrequency(val) {\n this._defaultFrequency = val;\n }\n\n // default frequency comes from redux store first, then default option value, and then finally attribute value.\n get defaultFrequency() {\n const { options, isSelected } = this.childOptions;\n let result;\n\n if (this.productDefaultFrequency) {\n result = this.productDefaultFrequency;\n } else if (isSelected) {\n result = isSelected;\n } else if (options.length) {\n result = options[0].value;\n } else {\n result = this._defaultFrequency;\n }\n\n // this runs for shopify selling plans translated to freq\n if (\n this.productFrequencies?.frequencies?.length &&\n result &&\n this.productFrequencies?.frequenciesEveryPeriod?.length\n ) {\n return frequencyToSellingPlan(result, this.productFrequencies);\n }\n\n return result;\n }\n\n get currentFrequency() {\n if (this.frequency) {\n return this.frequency;\n }\n return this.defaultFrequency;\n }\n\n productChangeFrequency(_, value) {\n this.frequency = value;\n }\n\n render() {\n let options;\n const defaultFrequency = this.defaultFrequency;\n\n if (this.frequencies?.length) {\n options = this.frequencies.map((value, ix) => {\n let text;\n const { frequenciesEveryPeriod, frequenciesText } = this.productFrequencies;\n if (frequenciesEveryPeriod && ix in frequenciesEveryPeriod) {\n text = frequencyText(frequenciesEveryPeriod[ix], defaultFrequency);\n } else if (frequenciesText && ix in frequenciesText) {\n text = frequenciesText[ix];\n } else {\n text = frequencyText(value, this.defaultFrequency);\n }\n return { value, text };\n });\n } else {\n ({ options } = this.childOptions);\n }\n\n if (!options.length) {\n options = (this.frequencies || []).map(value => ({\n value,\n text: frequencyText(value, defaultFrequency)\n }));\n }\n\n options = options.map(({ text, value }) => ({\n text:\n value === defaultFrequency\n ? html`\n ${text} ${this.defaultText || ''}\n `\n : text,\n value\n }));\n\n return html`\n <og-select\n .ariaLabel=\"${'Delivery frequency'}\"\n .options=\"${options}\"\n .selected=\"${this.currentFrequency}\"\n .onChange=\"${({ target: { value } }) => {\n this.productChangeFrequency(this.product, value, this.offer);\n }}\"\n ></og-select>\n `;\n }\n}\n\nexport const ConnectedSelectFrequency = connect(mapStateToProps, {\n productChangeFrequency\n})(SelectFrequency);\n\nexport default ConnectedSelectFrequency;\n", "const validParts = {\n // %d\tDay of the month as a decimal number (range 01 to 31).\n day: { day: '2-digit' },\n\n // %e\tDay of the month as a decimal number (range 1 to 31).\n 'day-numeric': { day: 'numeric' },\n\n // %a\tAbbreviated name of the day of the week.\n 'day-short': { weekday: 'short' },\n\n // %A\tFull name of the day of the week.\n 'day-long': { weekday: 'long' },\n\n // %m\tMonth as a decimal number (range 01 to 12).\n month: { month: '2-digit' },\n\n // %n\tMonth as a decimal number (range 1 to 12).\n 'month-numeric': { month: 'numeric' },\n\n // %b\tAbbreviated month name.\n 'month-short': { month: 'short' },\n\n // %B\tFull month name.\n 'month-long': { month: 'long' },\n\n // %y\tYear as a decimal number without a century (range 00 to 99).\n year: { year: '2-digit' },\n\n // %Y\tYear as a decimal number including the century.\n 'year-numeric': { year: 'numeric' }\n};\n\nexport const parse = date => {\n if (date instanceof Date) return date;\n return new Date(Date.parse(date));\n};\n\nexport const formatDate = (date, format) => {\n if (date instanceof Date) {\n return (format || '').toString().replace(/\\{\\{([-\\w]+)\\}\\}/g, it => {\n const part = it.replace(/[{}]/g, '');\n const value = validParts[part];\n\n if (typeof value === 'undefined') {\n return part;\n }\n\n const formatter = new Intl.DateTimeFormat('en-us', value);\n const dateInParts = formatter.formatToParts(date);\n const [{ value: result }] = dateInParts;\n return result;\n });\n }\n\n return date;\n};\n", "import { LitElement, html } from 'lit-element';\nimport { connect } from '../core/connect';\nimport { formatDate } from '../core/dateUtils';\n\nexport class FormattedDate extends LitElement {\n static get properties() {\n return {\n value: { type: String, reflect: true },\n format: { type: String }\n };\n }\n\n createRenderRoot() {\n return this;\n }\n\n render() {\n return html`\n ${formatDate(this.value, this.format || '{{month-long}} {{day}}, {{year-numeric}}')}\n `;\n }\n}\n\nexport const mapStateToProps = state => ({\n value: state.previewUpsellOffer ? new Date() : state.nextUpcomingOrder.place\n});\n\nexport const ConnectedNextUpcomingOrder = connect(mapStateToProps)(FormattedDate);\n\nexport default FormattedDate;\n", "import { html, css } from 'lit-element';\nimport memoize from 'lodash.memoize';\nimport { connect } from '../core/connect';\nimport { setPreview } from '../core/actions-preview';\nimport {\n fetchOffer,\n productHasChangedComponents,\n fetchOrders,\n optinProduct,\n setProductToSubscribe,\n setFirstOrderPlaceDate\n} from '../core/actions';\nimport {\n isSameProduct,\n getFallbackValue,\n templatesSelector,\n makeOptedoutSelector,\n makeProductFrequencyOptedInSelector,\n makeProductSpecificDefaultFrequencySelector,\n optedinSelector,\n autoshipSelector,\n makeOptedinSelector,\n kebabCase,\n makeProductDefaultFrequencySelector\n} from '../core/selectors';\nimport { product as productProp, auth as authProp } from '../core/props';\nimport { TemplateElement } from '../core/base';\nimport { onReady } from '../core/utils';\nimport { DEFAULT_OFFER_MODULE } from '../core/constants';\n\nconst memoizeKey = (...args) => JSON.stringify(args);\n\nconst logOnce = messageFn => {\n let hasLogged = false;\n return (...args) => {\n if (!hasLogged) {\n console.warn(messageFn(...args));\n hasLogged = true;\n }\n };\n};\n\nconst logMulticurrencyWarning = logOnce(\n (storeCurrency, primaryCurrency) =>\n `Hiding Ordergroove offer since the store currency ${storeCurrency} does not match your configured currency ${primaryCurrency} and you are not set up for multicurrency. Contact your Ordergroove representative for next steps.`\n);\n\nconst logProductSpecificFrequencyListWarning = logOnce(\n () => `Hiding Ordergroove offer since cart offers does not currently support product-specific frequency lists.`\n);\n\nexport const productAndComponents = memoize(\n (product, components) => Object.assign({ components }, product),\n memoizeKey\n);\n\nexport class Offer extends TemplateElement {\n static get properties() {\n return {\n ...super.properties,\n\n config: { type: Object, attribute: false },\n product: productProp,\n productComponents: { type: Array, attribute: 'product-components' },\n offerId: { type: String, attribute: false },\n auth: authProp,\n preview: { type: String, attribute: 'preview', reflect: 'true' },\n location: { type: String },\n autoshipByDefault: { type: Boolean, attribute: 'autoship-by-default' },\n productDefaultFrequency: { type: String, attribute: false },\n locale: { type: Object, attribute: true },\n firstOrderPlaceDate: { type: String, attribute: 'first-order-place-date' },\n productToSubscribe: { type: String, attribute: 'product-to-subscribe' },\n subscribed: { type: Boolean, reflect: true },\n frequency: { type: String, reflect: true },\n productFrequency: { type: String },\n isCart: { type: Boolean, attribute: 'cart' },\n optedin: { type: Object },\n variationId: { type: String },\n /** Attribute to force reading prices from the Offer response instead of the selling plan. Only used for testing. */\n overrideSellingPlanPrice: { type: Boolean, attribute: 'dev-override-selling-plan-price' }\n };\n }\n\n firstUpdated() {\n try {\n const preview = Array.from(this.getAttributeNames()).find(it => it.startsWith('preview-'));\n if (preview === 'preview-standard-offer') this.preview = 'regular';\n else if (preview === 'preview-upsell-offer') this.preview = 'upsell';\n else if (preview === 'preview-subscribed-offer') this.preview = 'subscribed';\n else if (preview === 'preview-prepaid-offer') this.preview = 'prepaid';\n } catch (e) {\n // in some rare cases, getAttributeNames throws an error and prevents the offer from initializing\n // since preview mode is non-essential, we can log and ignore it\n console.warn('Unable to set preview property', e);\n }\n }\n\n static get styles() {\n return css`\n :host[hidden] {\n display: none;\n }\n\n :host {\n display: block;\n }\n\n :host {\n color: var(--og-global-color, #000);\n font-family: var(--og-global-family, inherit);\n font-size: var(--og-global-size, inherit);\n padding: var(--og-wrapper-padding, 10px 0);\n min-width: var(--og-wrapper-min-width, 0);\n }\n\n p {\n margin: 0 0 0.3em;\n }\n\n :host og-upsell-button button {\n font-family: var(--og-upsell-family, inherit);\n font-size: var(--og-upsell-size, inherit);\n background-color: var(--og-upsell-background, inherit);\n color: var(--og-upsell-color, inherit);\n }\n\n .og-modal__btn {\n font-size: var(--og-modal-button-size, 0.875rem);\n font-family: var(--og-modal-button-family, inherit);\n padding-left: 1rem;\n padding-right: 1rem;\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n background-color: var(--og-modal-button-background, #e6e6e6);\n color: var(--og-modal-button-color, rgba(0, 0, 0, 0.8));\n border-radius: 0.25rem;\n border-style: none;\n border-width: 0;\n cursor: pointer;\n -webkit-appearance: button;\n text-transform: none;\n overflow: visible;\n line-height: 1.15;\n margin: 0;\n will-change: transform;\n -moz-osx-font-smoothing: grayscale;\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transition: -webkit-transform 0.25s ease-out;\n transition: transform 0.25s ease-out;\n transition:\n transform 0.25s ease-out,\n -webkit-transform 0.25s ease-out;\n }\n\n .og-modal__btn:focus,\n .og-modal__btn:hover {\n -webkit-transform: scale(1.05);\n transform: scale(1.05);\n }\n\n .og-modal__btn-primary {\n background-color: var(--og-confirm-button-background, #00449e);\n color: var(--og-confirm-button-color, #fff);\n }\n `;\n }\n\n static get initialTemplate() {\n return `\n <og-when test=\"regularEligible\">\n <div>\n\n <og-optout-button>\n <og-text key=\"offerOptOutLabel\"></og-text>\n </og-optout-button>\n </div>\n <div>\n <og-optin-button>\n <og-price discount>\n <span slot=\"prepend\">Subscribe and get</span>\n <span slot=\"append\">off</span>\n <og-text key=\"offerOptInLabel\" slot=\"fallback\"></og-text> \n </og-price>\n <og-price regular></og-price>\n <og-price subscription></og-price>\n \n </og-optin-button>\n <og-tooltip placement=\"bottom\">\n <div slot=\"trigger\">\n <og-text key=\"offerTooltipTrigger\"></og-text>\n </div>\n <div slot=\"content\">\n <og-text key=\"offerTooltipContent\"></og-text>\n </div>\n </og-tooltip>\n </div>\n <div style=\"margin-left: 2.2em\">\n <og-text key=\"offerEveryLabel\"></og-text>\n <og-select-frequency>\n <option value=\"3_1\" selected>3 Days</option>\n <option value=\"1_2\">1 Week</option>\n <option value=\"1_3\">1 Month</option>\n </og-select-frequency>\n </div>\n </og-when>\n\n <og-when test=\"upsellEligible\">\n <og-when test=\"!upcomingOrderContainsProduct\">\n <div class=\"og-iu-offer\">\n <og-text key=\"upsellButtonLabel\"></og-text>\n <og-upsell-button>\n <button type=\"button\">\n <og-text key=\"upsellButtonContent\"></og-text>\n <og-next-upcoming-order></og-next-upcoming-order>\n </button>\n </og-upsell-button>\n <og-upsell-modal>\n <og-text key=\"upsellModalContent\"></og-text>\n <br />\n\n <og-optout-button>\n <og-text key=\"upsellModalOptOutLabel\"></og-text>\n </og-optout-button>\n\n <br />\n\n <og-optin-button>\n <og-text key=\"upsellModalOptInLabel\"></og-text>\n </og-optin-button>\n <br />\n\n <og-text key=\"offerEveryLabel\"></og-text>\n <og-select-frequency>\n <option value=\"3_1\" selected>3 Days</option>\n <option value=\"1_2\">1 Week</option>\n <option value=\"1_3\">1 Month</option>\n </og-select-frequency>\n\n <button slot=\"confirm\" class=\"og-modal__btn og-modal__btn-primary\">\n <og-text key=\"upsellModalConfirmLabel\"></og-text>\n </button>\n <button slot=\"cancel\" class=\"og-modal__btn\"><og-text key=\"upsellModalCancelLabel\"></og-text></button>\n </og-upsell-modal>\n </div>\n </og-when>\n <og-when test=\"upcomingOrderContainsProduct\">\n The product is in your next upcomming order\n </og-when>\n </og-when>\n \n `;\n }\n\n constructor() {\n super();\n this.module = 'pdp';\n this.product = {};\n this.productComponents = [];\n this.fetchOffer = () => 0;\n this.fetchOrders = () => 0;\n this.productHasChangedComponents = () => 0;\n this.setFirstOrderPlaceDate = () => 0;\n this.setProductToSubscribe = () => 0;\n this.productChangeFrequency = () => 0;\n }\n\n applyTemplate(template) {\n super.applyTemplate(template);\n const { id: variationId, locale } = template;\n this.variationId = variationId;\n this.locale = locale;\n const event = new CustomEvent('template-changed');\n this.dispatchEvent(event);\n }\n\n updated(changed) {\n if (changed.has('preview')) {\n this.setPreview(this.preview, changed.get('preview'), this);\n }\n this.frequency = this.defaultFrequency;\n\n if (changed.has('product') && !this.isPreview) {\n onReady(() => this.fetchOffer(this.product.id, DEFAULT_OFFER_MODULE, this));\n }\n\n if (changed.has('firstOrderPlaceDate') && this.product.id && !this.isPreview) {\n this.setFirstOrderPlaceDate(this.product.id, this.firstOrderPlaceDate);\n }\n\n if (changed.has('productToSubscribe') && this.product.id && !this.isPreview) {\n this.setProductToSubscribe(this.product.id, this.productToSubscribe);\n }\n\n if (changed.has('auth') && this.auth && !this.isPreview) {\n this.fetchOrders();\n }\n\n if (changed.has('productComponents')) {\n const newProductWithComponents = productAndComponents(this.product, this.productComponents);\n const oldProductWithComponents = Object.assign({}, this.product, {\n components: changed.get('productComponents')\n });\n\n if (!isSameProduct(newProductWithComponents, oldProductWithComponents)) {\n this.productHasChangedComponents(newProductWithComponents, oldProductWithComponents);\n }\n }\n\n if (\n (changed.has('offerId') ||\n changed.has('autoshipByDefault') ||\n changed.has('location') ||\n changed.has('product')) &&\n this.offerId &&\n this.autoshipByDefault &&\n (this.location === 'cart' || this.isCart) &&\n this.product.id &&\n this.optinProduct &&\n !(this.optedin || []).find(product => isSameProduct(product, this.product))\n ) {\n this.optinProduct(\n {\n ...this.product,\n ...(this.productComponents.length && { components: this.productComponents })\n },\n this.defaultFrequency,\n this\n );\n }\n }\n\n get isPreview() {\n return this.preview || window.og.previewMode;\n }\n\n get shouldEnableOffer() {\n // currently, only the shopify reducer populates storeCurrency\n if (this.config && this.config.storeCurrency && this.config.merchantSettings) {\n const shouldEnable =\n this.config.merchantSettings.multicurrency_enabled ||\n this.config.storeCurrency === this.config.merchantSettings.currency_code;\n if (!shouldEnable) {\n logMulticurrencyWarning(this.config.storeCurrency, this.config.merchantSettings.currency_code);\n return false;\n }\n }\n\n return true;\n }\n\n render() {\n return this.shouldEnableOffer\n ? html`\n <slot></slot>\n `\n : null;\n }\n\n get defaultFrequency() {\n const storeFrequency = this.productFrequency || this.productDefaultFrequency;\n\n if (storeFrequency) {\n return storeFrequency;\n }\n\n const freq = this.querySelector('og-select-frequency');\n if (freq && freq.currentFrequency) {\n return freq.currentFrequency;\n }\n\n // not certain if this logic was used or not -- the following code was inlined from a shared function that was only used here\n const attributeValue = this.getValueFromAttribute('defaultFrequency');\n if (attributeValue) {\n return attributeValue;\n }\n\n if (this.template && this.template.config && typeof this.template.config.defaultFrequency !== 'undefined') {\n return this.template.config.defaultFrequency;\n }\n\n return this.configDefaultFrequency;\n }\n\n getValueFromAttribute(key) {\n const attrName = kebabCase(key);\n if (this.hasAttribute(attrName)) {\n const attr = this.getAttribute(attrName);\n if (attr.toString().toLowerCase() === 'true') return true;\n if (attr.toString().toLowerCase() === 'false') return false;\n return attr;\n }\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => ({\n config: state.config,\n auth: state.auth,\n offerId: ((state.productOffer || {})[(ownProps.product || {}).id] || [])[0],\n configDefaultFrequency: makeProductDefaultFrequencySelector(ownProps.product?.id)(state),\n productFrequency: makeProductFrequencyOptedInSelector(ownProps.product)(state),\n productDefaultFrequency: makeProductSpecificDefaultFrequencySelector((ownProps.product || {}).id)(state),\n autoshipByDefault:\n (state.config && state.config.autoshipByDefault) ||\n getFallbackValue(ownProps, 'autoshipByDefault', autoshipSelector(state)[(ownProps.product || {}).id]),\n ...(makeOptedoutSelector(ownProps.product)(state) && { autoshipByDefault: false }),\n optedin: optedinSelector(state),\n subscribed: makeOptedinSelector(ownProps.product)(state),\n ...templatesSelector(state)\n});\n\nexport const ConnectedOffer = connect(mapStateToProps, {\n fetchOffer,\n fetchOrders,\n productHasChangedComponents,\n optinProduct,\n setFirstOrderPlaceDate,\n setProductToSubscribe,\n setPreview\n})(Offer);\n\nexport default ConnectedOffer;\n", "import { receiveOffer, receiveOrders, authorize, unauthorized, optinProduct, setBenefitMessages } from './actions';\nimport { getObjectStructuredProductPlans } from './adapters';\nimport * as constants from './constants';\n\nexport const setPreviewStandardOffer = (isPreview, productId, offer) =>\n async function setPreviewStandardOfferThunk(dispatch) {\n await dispatch({\n type: constants.SET_PREVIEW_STANDARD_OFFER,\n payload: { isPreview, productId }\n });\n await dispatch({\n type: constants.UNAUTHORIZED\n });\n await dispatch(\n setBenefitMessages({\n '47c01e9aacbe40389b5c7325d79091aa': { 'en-US': 'Coffee products with 15% off' },\n e6534b9d877f41e586c37b7d8abc3a58: { 'en-US': 'Get a free gift on your 3rd order' },\n f35e842710b24929922db4a529eecd40: { 'en-US': 'Free shipping for your recurring orders' }\n })\n );\n await dispatch(\n receiveOffer(\n {\n in_stock: { [productId]: true },\n eligibility_groups: { [productId]: ['subscription', 'upsell'] },\n result: 'success',\n autoship: { [productId]: true },\n autoship_by_default: { [productId]: false },\n modifiers: {},\n module_view: { regular: '096135e6650111e9a444bc764e106cf4' },\n incentives_display: {\n '47c01e9aacbe40389b5c7325d79091aa': {\n field: 'sub_total',\n object: 'order',\n type: 'Discount Percent',\n value: 5\n },\n e6534b9d877f41e586c37b7d8abc3a58: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n f35e842710b24929922db4a529eecd40: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n '5be321d7c17f4e18a757212b9a20bfcc': {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 1\n }\n },\n incentives: {\n [productId]: {\n initial: ['5be321d7c17f4e18a757212b9a20bfcc'],\n ongoing: [\n 'e6534b9d877f41e586c37b7d8abc3a58',\n '47c01e9aacbe40389b5c7325d79091aa',\n 'f35e842710b24929922db4a529eecd40'\n ]\n }\n }\n },\n offer,\n productId\n )\n );\n };\n\nexport const mergeProductPlansToState = (state, newProductPlans) => {\n Object.entries(newProductPlans).forEach(([key, value]) => {\n if (Object.prototype.hasOwnProperty.call(state, key)) {\n const mergedArray = state[key].concat(value);\n const uniqueArray = [...new Set(mergedArray.map(item => JSON.stringify(item)))];\n state[key] = uniqueArray.map(item => JSON.parse(item));\n } else {\n state[key] = value;\n }\n });\n return state;\n};\n\nexport const setPreviewUpsellOffer = (isPreview, productId, offer) =>\n async function setPreviewUpsellOfferThunk(dispatch, getState) {\n await dispatch({ type: constants.SET_PREVIEW_UPSELL_OFFER, payload: { isPreview, productId } });\n\n const { merchantId } = getState();\n if (isPreview) {\n await dispatch(\n setBenefitMessages({\n '47c01e9aacbe40389b5c7325d79091aa': { 'en-US': 'Coffee products with 15% off' },\n e6534b9d877f41e586c37b7d8abc3a58: { 'en-US': 'Get a free gift on your 3rd order' }\n })\n );\n await dispatch(\n receiveOffer(\n {\n in_stock: { [productId]: true },\n module_view: { regular: '096135e6650111e9a444bc764e106cf4' },\n default_frequencies: { [productId]: { every: 1, every_period: 3 } },\n eligibility_groups: { [productId]: ['subscription', 'upsell'] },\n result: 'success',\n autoship: { [productId]: true },\n autoship_by_default: { [productId]: false },\n modifiers: {}\n },\n offer,\n productId\n )\n );\n await dispatch(\n receiveOrders({\n count: 1,\n next: null,\n previous: null,\n results: [\n {\n merchant: '0e5de2bedc5e11e3a2e4bc764e106cf4',\n customer: 'TestCust',\n payment: 'e98e789aba0111e9b90fbc764e107990',\n shipping_address: 'b3a5816ae59611e78937bc764e1043b0',\n public_id: '23322d4a83eb11ea9a1ebc764e101db1',\n sub_total: '206.98',\n tax_total: '0.00',\n shipping_total: '10.00',\n discount_total: '0.00',\n total: '216.98',\n created: '2020-04-21 11:14:11',\n place: '2020-06-24 00:00:00',\n cancelled: null,\n tries: 0,\n generic_error_count: 0,\n status: 1,\n type: 1,\n order_merchant_id: null,\n rejected_message: null,\n extra_data: null,\n locked: false,\n oos_free_shipping: false\n }\n ]\n })\n );\n await dispatch(authorize(merchantId, 'sig_field', 'ts', 'sig'));\n } else {\n await dispatch(unauthorized());\n }\n };\n\nexport const setPreviewPrepaid = (isPreview, productId, offer) =>\n async function setPreviewPrepaidThunk(dispatch, getState) {\n const existingProductPlans = getState().productPlans;\n\n await dispatch({\n type: constants.SET_PREVIEW_PREPAID_OFFER,\n payload: { isPreview, productId }\n });\n await dispatch({\n type: constants.UNAUTHORIZED\n });\n await dispatch(\n setBenefitMessages({\n '47c01e9aacbe40389b5c7325d79091aa': { 'en-US': 'Coffee products with 15% off' },\n e6534b9d877f41e586c37b7d8abc3a58: { 'en-US': 'Get a free gift on your 3rd order' }\n })\n );\n await dispatch(\n receiveOffer(\n {\n in_stock: { [productId]: true },\n eligibility_groups: { [productId]: ['subscription', 'upsell', 'prepaid'] },\n result: 'success',\n autoship: { [productId]: true },\n autoship_by_default: { [productId]: false },\n modifiers: {},\n module_view: { regular: '096135e6650111e9a444bc764e106cf4' },\n incentives_display: {\n '47c01e9aacbe40389b5c7325d79091aa': {\n field: 'sub_total',\n object: 'order',\n type: 'Discount Percent',\n value: 5\n },\n e6534b9d877f41e586c37b7d8abc3a58: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n f35e842710b24929922db4a529eecd40: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n '5be321d7c17f4e18a757212b9a20bfcc': {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 1\n }\n },\n incentives: {\n [productId]: {\n initial: ['5be321d7c17f4e18a757212b9a20bfcc'],\n ongoing: [\n 'e6534b9d877f41e586c37b7d8abc3a58',\n '47c01e9aacbe40389b5c7325d79091aa',\n 'f35e842710b24929922db4a529eecd40'\n ]\n }\n }\n },\n offer,\n productId\n )\n );\n await dispatch({\n type: constants.RECEIVE_PRODUCT_PLANS,\n payload: mergeProductPlansToState(\n existingProductPlans,\n getObjectStructuredProductPlans({\n [productId]: [\n {\n frequency: '1_3',\n regularPrice: '$15.00',\n subscriptionPrice: '$12.00',\n discountRate: '25%',\n prepaidShipments: 3,\n regularPrepaidPrice: '$36.00',\n prepaidSavingsPerShipment: '$3.00',\n prepaidSavingsTotal: '$9.00',\n prepaidExtraSavingsPercentage: '10%'\n },\n {\n frequency: '1_3',\n regularPrice: '$15.00',\n subscriptionPrice: '$12.00',\n discountRate: '20%',\n prepaidShipments: 6,\n regularPrepaidPrice: '$72.00',\n prepaidSavingsPerShipment: '$3.00',\n prepaidSavingsTotal: '$18.00',\n prepaidExtraSavingsPercentage: '10%'\n },\n {\n frequency: '1_3',\n regularPrice: '$15.00',\n subscriptionPrice: '$12.00',\n discountRate: '20%',\n prepaidShipments: 12,\n regularPrepaidPrice: '$144.00',\n prepaidSavingsPerShipment: '$3.00',\n prepaidSavingsTotal: '$36.00',\n prepaidExtraSavingsPercentage: '10%'\n }\n ]\n })\n )\n });\n await dispatch({\n type: constants.SET_CONFIG,\n payload: {\n prepaidSellingPlans: {\n [productId]: [\n {\n numberShipments: 3,\n sellingPlan: '1_3'\n },\n {\n numberShipments: 6,\n sellingPlan: '1_3'\n },\n {\n numberShipments: 12,\n sellingPlan: '1_3'\n }\n ]\n }\n }\n });\n };\n\nexport const setPreview = (value, oldValue, offer) =>\n async function (dispatch, _getState) {\n await dispatch({ type: constants.LOCAL_STORAGE_CLEAR });\n await dispatch({\n type: constants.SET_PREVIEW_STANDARD_OFFER,\n payload: { isPreview: false, productId: offer.product.id }\n });\n await dispatch({\n type: constants.SET_PREVIEW_UPSELL_OFFER,\n payload: { isPreview: false, productId: offer.product.id }\n });\n\n switch (value) {\n case 'regular':\n dispatch(setPreviewStandardOffer(true, offer.product.id, offer));\n break;\n case 'upsell':\n dispatch(setPreviewUpsellOffer(true, offer.product.id, offer));\n break;\n case 'subscribed':\n dispatch(setPreviewStandardOffer(true, offer.product.id, offer));\n dispatch(optinProduct(offer.product, '2_2'));\n break;\n case 'prepaid':\n dispatch(setPreviewPrepaid(true, offer.product.id, offer));\n // Prepaid needs to be subscribed to appear\n dispatch(optinProduct(offer.product, '1_3'));\n break;\n default:\n }\n };\n", "import { LitElement, html, css } from 'lit-element';\n\nexport class Modal extends LitElement {\n constructor() {\n super();\n this.showCancelButton = true;\n this.showConfirmButton = true;\n }\n\n static get properties() {\n return {\n title: { type: String, attribute: false },\n content: { type: String, attribute: false },\n confirmText: { type: String, attribute: false },\n cancelText: { type: String, attribute: false },\n showCancelButton: { type: Boolean },\n showConfirmButton: { type: Boolean },\n show: { type: Boolean, attribute: 'show' }\n };\n }\n\n static get styles() {\n return css`\n :host[hidden] {\n display: none;\n }\n\n :host {\n display: block;\n }\n\n .og-modal {\n display: none;\n }\n\n .og-modal.is-open {\n display: block;\n }\n\n .og-modal__overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.6);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 9999;\n }\n\n .og-modal__container {\n background-color: var(--og-modal-background-color, #fff);\n padding: var(--og-modal-padding, 30px);\n max-width: 500px;\n max-height: 100vh;\n border-radius: var(--og-modal-border-radius, 4px);\n box-sizing: border-box;\n }\n\n .og-modal__header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n\n .og-modal__title {\n margin-top: 0;\n margin-bottom: 0;\n font-weight: 600;\n font-size: 1.25rem;\n line-height: 1.25;\n color: #00449e;\n box-sizing: border-box;\n }\n\n .og-modal__close {\n background: transparent;\n border: 0;\n }\n\n .og-modal__close:before {\n content: '\u2715';\n }\n\n .og-modal__content {\n margin-top: 2rem;\n margin-bottom: 2rem;\n line-height: 1.5;\n }\n\n .og-modal__btn {\n font-size: var(--og-modal-button-size, 0.875rem);\n font-family: var(--og-modal-button-family, inherit);\n padding-left: 1rem;\n padding-right: 1rem;\n padding-top: 0.5rem;\n padding-bottom: 0.5rem;\n background-color: var(--og-modal-button-background, #e6e6e6);\n color: var(--og-modal-button-color, rgba(0, 0, 0, 0.8));\n border-radius: 0.25rem;\n border-style: none;\n border-width: 0;\n cursor: pointer;\n -webkit-appearance: button;\n text-transform: none;\n overflow: visible;\n line-height: 1.15;\n margin: 0;\n will-change: transform;\n -moz-osx-font-smoothing: grayscale;\n -webkit-backface-visibility: hidden;\n backface-visibility: hidden;\n -webkit-transform: translateZ(0);\n transform: translateZ(0);\n transition: -webkit-transform 0.25s ease-out;\n transition: transform 0.25s ease-out;\n transition:\n transform 0.25s ease-out,\n -webkit-transform 0.25s ease-out;\n }\n\n .og-modal__btn:focus,\n .og-modal__btn:hover {\n -webkit-transform: scale(1.05);\n transform: scale(1.05);\n }\n\n .og-modal__btn-primary {\n background-color: var(--og-confirm-button-background, #00449e);\n color: var(--og-confirm-button-color, #fff);\n }\n .btn {\n cursor: pointer;\n }\n `;\n }\n\n close() {\n this.removeAttribute('show');\n this.dispatchEvent(new CustomEvent('close'));\n }\n\n confirm() {\n this.removeAttribute('show');\n this.dispatchEvent(new CustomEvent('confirm'));\n }\n\n get confirmButton() {\n return this.showConfirmButton\n ? html`\n <span @click=\"${() => this.confirm()}\">\n <slot name=\"confirm\" class=\"btn\">\n <button class=\"og-modal__btn og-modal__btn-primary og-modal__confirm\" @click=\"${() => this.confirm()}\">\n ${this.confirmText}\n </button>\n </slot>\n </span>\n `\n : html``;\n }\n\n get cancelButton() {\n return this.showCancelButton\n ? html`\n <span @click=\"${() => this.close()}\" class=\"btn\">\n <slot name=\"cancel\">\n <button class=\"og-modal__btn og-modal__cancel\" @click=\"${() => this.close()}\">${this.cancelText}</button>\n </slot>\n </span>\n `\n : html``;\n }\n\n render() {\n if (!this.show) return html``;\n\n return html`\n <div class=\"og-modal is-open\" aria-hidden=\"true\">\n <div class=\"og-modal__overlay\" tabindex=\"-1\">\n <div class=\"og-modal__container\" role=\"dialog\" aria-modal=\"true\">\n <header class=\"og-modal__header\">\n <h2 class=\"og-modal__title\">\n <slot name=\"title\">${this.title}</slot>\n </h2>\n <button class=\"og-modal__close\" aria-label=\"Close\" @click=\"${() => this.close()}\"></button>\n </header>\n <main class=\"og-modal__content\">\n <slot name=\"content\">${this.content}</slot>\n </main>\n <footer class=\"og-modal__footer\">${this.confirmButton} ${this.cancelButton}</footer>\n </div>\n </div>\n </div>\n `;\n }\n}\n\nexport default Modal;\n", "/**\n * @license\n * Copyright (c) 2018 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at\n * http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at\n * http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at\n * http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at\n * http://polymer.github.io/PATENTS.txt\n */\n\nimport {AttributePart, directive, Part} from '../lit-html.js';\n\nconst previousValues = new WeakMap<Part, unknown>();\n\n/**\n * For AttributeParts, sets the attribute if the value is defined and removes\n * the attribute if the value is undefined.\n *\n * For other part types, this directive is a no-op.\n */\nexport const ifDefined = directive((value: unknown) => (part: Part) => {\n const previousValue = previousValues.get(part);\n\n if (value === undefined && part instanceof AttributePart) {\n // If the value is undefined, remove the attribute, but only if the value\n // was previously defined.\n if (previousValue !== undefined || !previousValues.has(part)) {\n const name = part.committer.name;\n part.committer.element.removeAttribute(name);\n }\n } else if (value !== previousValue) {\n part.setValue(value);\n }\n\n previousValues.set(part, value);\n});\n", "import { LitElement, css, html } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\n\nexport class Select extends LitElement {\n static get styles() {\n return css`\n :host {\n display: inline-block;\n color: inherit;\n position: relative;\n height: 100%;\n cursor: inherit;\n font-family: inherit;\n font-weight: inherit;\n }\n select {\n font-weight: inherit;\n display: block;\n height: 100%;\n cursor: inherit;\n color: inherit;\n font-family: inherit;\n font-size: 1em;\n line-height: 1.3;\n padding: var(--og-select-padding, 0.4em 1.8em 0.3em 0.5em);\n width: 100%;\n max-width: 100%;\n box-sizing: border-box;\n margin: 0;\n border: none;\n -moz-appearance: none;\n -webkit-appearance: none;\n appearance: none;\n background-color: transparent;\n }\n select::-ms-expand {\n display: none;\n }\n select:focus {\n outline: none;\n }\n select option {\n font-weight: inherit;\n }\n span {\n position: absolute;\n // background: white;\n color: inherit;\n fill: white;\n pointer-events: none;\n right: 0.3em;\n top: 50%;\n z-index: 1;\n font-size: 1em;\n line-height: 0.2em;\n transform: scaleY(0.5);\n }\n `;\n }\n\n static get properties() {\n return {\n options: { type: Array },\n selected: { type: String },\n // we intentionally don't convert from the \"aria-label\" attribute here\n // since if we set that on the element, we are also assigning a label to the wraper <og-select> element which can cause screen readers to read out the same text twice\n // https://github.com/WICG/webcomponents/issues/1073\n ariaLabel: { type: String }\n };\n }\n\n render() {\n const handleOnChange = ev => this.onChange(ev);\n return html`\n <select @change=\"${handleOnChange}\" aria-label=\"${ifDefined(this.ariaLabel)}\">\n ${this.options.map(\n option => html`\n <option\n value=\"${option.value}\"\n ?selected=${option.value === this.selected}\n .selected=${option.value === this.selected}\n >\n ${option.text}\n </option>\n `\n )}\n </select>\n <span>▼</span>\n `;\n }\n}\n\nexport default Select;\n", "import { LitElement, html, css } from 'lit-element';\nimport { ifDefined } from 'lit-html/directives/if-defined.js';\n\nconst ACTIVATION_TYPES = {\n AUTOMATIC: 'automatic',\n MANUAL: 'manual'\n};\n\nexport class Tooltip extends LitElement {\n constructor() {\n super();\n this.triggerLabel = 'Show tooltip';\n this.open = false;\n /** Default is \"automatic\" for backwards compatibility with existing templates */\n this.activationType = ACTIVATION_TYPES.AUTOMATIC;\n }\n\n static get properties() {\n return {\n placement: { type: String, default: 'bottom' },\n /** Set the aria-label attribute of the trigger. */\n triggerLabel: { type: String, attribute: 'trigger-label' },\n /**\n * \"automatic\" - show tooltip on hover and focus\n * \"manual\" - show tooltip on hover and click\n */\n activationType: { type: String, attribute: 'activation-type' },\n /** Whether the tooltip is showing. Internal property; only here so that we re-render when it changes */\n open: { type: Boolean, attribute: false }\n };\n }\n\n static get styles() {\n return css`\n :host[hidden] {\n display: none;\n }\n\n :host {\n display: inline-block;\n position: relative;\n z-index: 9;\n }\n\n /* reset default button styles */\n button.trigger {\n all: unset;\n }\n\n /* do not reset the button's default focus outline */\n button.trigger:focus {\n outline: revert;\n }\n\n .trigger {\n display: block;\n cursor: pointer;\n }\n\n /* for manual activation, hide the content completely from screen readers when the tooltip is closed */\n /* otherwise, interactive elements may receive focus even when they are not visible */\n [data-manual] .content {\n visibility: hidden;\n }\n\n .content {\n box-sizing: border-box;\n font-family: var(--og-tooltip-family, inherit);\n font-size: var(--og-tooltip-size, inherit);\n color: var(--og-tooltip-color, inherit);\n background-color: var(--og-tooltip-background, #ececec);\n box-shadow: var(--og-tooltip-box-shadow, 2px 2px 6px rgba(0, 0, 0, 0.28));\n display: block;\n opacity: 0;\n padding: var(--og-tooltip-padding, 0.5em);\n text-align: var(--og-tooltip-text-align, left);\n pointer-events: none;\n position: absolute;\n transform: translateY(10px);\n transition: transform 0.25s ease-out;\n z-index: 99999;\n border-radius: var(--og-tooltip-border-radius, 0);\n }\n\n .content:after {\n content: ' ';\n height: 0;\n position: absolute;\n width: 0;\n }\n\n .top {\n bottom: 100%;\n margin-bottom: 10px;\n }\n\n .bottom {\n top: 100%;\n margin-top: 10px;\n }\n\n .left {\n right: 100%;\n margin-right: 10px;\n }\n\n .right {\n left: 100%;\n margin-left: 10px;\n }\n\n .top-left {\n bottom: 100%;\n margin-bottom: 10px;\n right: 100%;\n margin-right: -16px;\n }\n\n .top-right {\n bottom: 100%;\n margin-bottom: 10px;\n left: 100%;\n margin-left: -16px;\n }\n\n .bottom-left {\n top: 100%;\n margin-top: 10px;\n right: 100%;\n margin-right: -16px;\n }\n\n .bottom-right {\n top: 100%;\n margin-top: 10px;\n left: 100%;\n margin-left: -16px;\n }\n\n .bottom-left:after,\n .bottom-right:after,\n .top-left:after,\n .top-right:after,\n .top:after,\n .bottom:after {\n margin-left: -10px;\n left: 50%;\n border-left: solid transparent 10px;\n border-right: solid transparent 10px;\n }\n\n .top-left:after,\n .top-right:after,\n .top:after {\n bottom: -10px;\n border-top: solid var(--og-tooltip-background, #ececec) 10px;\n }\n .bottom-left:after,\n .top-left:after {\n left: auto;\n right: 0;\n }\n\n .bottom-right:after,\n .top-right:after {\n left: 0;\n right: auto;\n margin-left: 0;\n }\n\n .bottom-left:after,\n .bottom-right:after,\n .bottom:after {\n top: -10px;\n border-bottom: solid var(--og-tooltip-background, #ececec) 10px;\n }\n\n .left:after,\n .right:after {\n margin-top: -10px;\n top: 50%;\n border-top: solid transparent 10px;\n border-bottom: solid transparent 10px;\n }\n .right:after {\n left: -10px;\n border-right: solid var(--og-tooltip-background, #ececec) 10px;\n }\n .left:after {\n right: -10px;\n border-left: solid var(--og-tooltip-background, #ececec) 10px;\n }\n\n .tooltip[data-open] .content {\n visibility: visible;\n opacity: 1;\n width: 200px;\n pointer-events: auto;\n transform: translateY(0px);\n }\n `;\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.abortController = new AbortController();\n const signal = this.abortController.signal;\n\n this.addEventListener('mouseenter', this.handleMouseEnter.bind(this), { signal });\n this.addEventListener('mouseleave', this.handleMouseLeave.bind(this), { signal });\n this.addEventListener('focusin', this.handleFocusIn.bind(this), { signal });\n this.addEventListener('focusout', this.handleFocusOut.bind(this), { signal });\n this.addEventListener('keydown', this.handleKeyDown.bind(this), { signal });\n\n document.addEventListener('click', this.handleDocumentClick.bind(this), { signal });\n }\n\n async recalculatePosition() {\n // wait for state changes to apply\n await this.updateComplete;\n if (!this.open) return;\n const trigger = this.shadowRoot.querySelector('.trigger');\n const triggerRect = trigger.getBoundingClientRect();\n const content = this.shadowRoot.querySelector('.content');\n const contentRect = content.getBoundingClientRect();\n if (!this.placement || this.placement === 'top' || this.placement === 'bottom')\n content.style.left = `${(-1 * contentRect.width + triggerRect.width) / 2}px`;\n else if (this.placement === 'left' || this.placement === 'right')\n content.style.top = `${(-1 * contentRect.height + triggerRect.height) / 2}px`;\n }\n\n handleMouseEnter() {\n this.open = true;\n this.recalculatePosition();\n }\n\n handleMouseLeave() {\n this.open = false;\n }\n\n handleFocusIn() {\n if (this.activationType !== ACTIVATION_TYPES.AUTOMATIC) return;\n this.open = true;\n this.recalculatePosition();\n }\n\n handleFocusOut(event) {\n if (this.activationType !== ACTIVATION_TYPES.AUTOMATIC) return;\n // keep the tooltip open if we're moving focus to another element inside the tooltip\n if (!this.contains(event.relatedTarget)) {\n this.open = false;\n }\n }\n\n handleKeyDown(event) {\n if (this.activationType !== ACTIVATION_TYPES.MANUAL) return;\n // close the tooltip on Escape press\n if (event.key === 'Escape' && this.open) {\n this.open = false;\n event.stopPropagation();\n }\n }\n\n handleClick() {\n if (this.activationType !== ACTIVATION_TYPES.MANUAL) return;\n this.open = !this.open;\n this.recalculatePosition();\n }\n\n handleDocumentClick(event) {\n if (this.activationType !== ACTIVATION_TYPES.MANUAL || !this.open) return;\n // close the tooltip if the user clicks outside of it\n if (!this.contains(event.target)) {\n this.open = false;\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n // remove event listeners\n this.abortController.abort();\n }\n\n render() {\n // allow removing aria-label by setting trigger-label to any falsy value\n // e.g. if the content inside the tooltip is sufficient\n const triggerLabel = this.triggerLabel ? this.triggerLabel : undefined;\n\n return html`\n <span class=\"tooltip\" ?data-open=\"${this.open}\" ?data-manual=\"${this.activationType === ACTIVATION_TYPES.MANUAL}\">\n ${this.activationType === ACTIVATION_TYPES.MANUAL\n ? html`\n <button\n class=\"trigger\"\n aria-label=\"${ifDefined(triggerLabel)}\"\n aria-expanded=\"${this.open}\"\n aria-controls=\"tooltip-content\"\n @click=\"${this.handleClick}\"\n >\n <slot name=\"trigger\">${this.trigger}</slot>\n </button>\n `\n : html`\n <span class=\"trigger\" tabindex=\"0\" role=\"button\" aria-label=\"${ifDefined(triggerLabel)}\">\n <slot name=\"trigger\">${this.trigger}</slot>\n </span>\n `}\n <div class=\"content ${this.placement || 'bottom'}\" role=\"tooltip\" id=\"tooltip-content\">\n <slot name=\"content\">${this.content}</slot>\n </div>\n </span>\n `;\n }\n}\n\nexport default Tooltip;\n", "import { LitElement, html } from 'lit-element';\nimport { connect } from '../core/connect';\nimport {\n makeProductPrepaidShipmentOptionsSelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makePrepaidShipmentsSelectedSelector\n} from '../core/selectors';\nimport { productChangePrepaidShipments } from '../core/actions';\nimport { withProduct } from '../core/resolveProperties';\nimport { getDefaultPrepaidOption } from '../shopify/utils';\n\nexport class PrepaidStatus extends withProduct(LitElement) {\n static get properties() {\n return {\n options: { type: Array },\n shipmentsOptedIn: { type: Number },\n prepaidShipmentsSelected: { type: Number },\n defaultPrepaidShipments: { type: Number, attribute: 'default-prepaid-shipments' }\n };\n }\n\n get prepaidOptedIn() {\n return this.shipmentsOptedIn > 1;\n }\n\n get selectedNumberOfShipments() {\n return this.prepaidShipmentsSelected || this.shipmentsOptedIn || this.getDefaultPrepaidShipments();\n }\n\n getDefaultPrepaidShipments() {\n return this.options.includes(this.defaultPrepaidShipments)\n ? this.defaultPrepaidShipments\n : getDefaultPrepaidOption(this.options);\n }\n\n handleSelect({ target: { value } }) {\n const valueAsNumber = +value;\n this.productChangePrepaidShipments(this.product, valueAsNumber, this.offer);\n }\n\n render() {\n return html``;\n }\n}\n\nexport const mapStateToProps = (state, ownProps) => ({\n options: makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state),\n shipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n prepaidShipmentsSelected: makePrepaidShipmentsSelectedSelector(ownProps.product)(state)\n});\n\nexport const ConnectedPrepaidStatus = connect(mapStateToProps, { productChangePrepaidShipments })(PrepaidStatus);\n\nexport default ConnectedPrepaidStatus;\n", "import { html, css } from 'lit-element';\nimport { connect } from '../core/connect';\nimport {\n makeProductPrepaidShipmentOptionsSelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makePrepaidShipmentsSelectedSelector\n} from '../core/selectors';\nimport { productChangePrepaidShipments } from '../core/actions';\nimport { PrepaidStatus } from './PrepaidStatus';\n\nexport class PrepaidToggle extends PrepaidStatus {\n constructor() {\n super();\n this.options = [];\n this.text = 'shipments';\n }\n\n static get properties() {\n return {\n ...super.properties,\n text: { type: String }\n };\n }\n\n // copied from SelectFrequency\n static get styles() {\n return css`\n og-select {\n display: inline-block;\n cursor: pointer;\n background-color: var(--og-select-bg-color, #fff);\n border: var(--og-select-border, 1px solid #aaa);\n border-width: var(--og-select-border-width, 1px);\n box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);\n z-index: 1;\n }\n\n input {\n width: 1.2em;\n height: 1.2em;\n accent-color: var(--og-prepaid-checkbox-color, black);\n border-radius: 4px;\n }\n `;\n }\n\n handleChange(e) {\n if (e.target.checked) {\n this.productChangePrepaidShipments(this.product, this.selectedNumberOfShipments, this.offer);\n } else {\n this.productChangePrepaidShipments(this.product, null, this.offer);\n }\n }\n\n render() {\n if (this.options.length === 0) {\n return html``;\n }\n\n const displayOptions = this.options.map(value => ({\n value: value,\n text: `${value} ${this.text}`\n }));\n\n return html`\n <div>\n <input id=\"cbx\" type=\"checkbox\" .checked=${this.prepaidOptedIn} @change=${this.handleChange} />\n <label for=\"cbx\">\n <slot name=\"label\">Prepay for</slot>\n ${this.options.length > 1\n ? html`\n <og-select\n .options=${displayOptions}\n .selected=${this.selectedNumberOfShipments}\n .onChange=\"${e => this.handleSelect(e)}\"\n ></og-select>\n `\n : html`\n <span>${displayOptions[0].text}</span>\n `}\n <slot name=\"append\"></slot>\n </label>\n </div>\n `;\n }\n}\n\nconst mapStateToProps = (state, ownProps) => ({\n options: makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state),\n shipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n prepaidShipmentsSelected: makePrepaidShipmentsSelectedSelector(ownProps.product)(state)\n});\n\nconst ConnectedPrepaidToggle = connect(mapStateToProps, { productChangePrepaidShipments })(PrepaidToggle);\n\nexport { ConnectedPrepaidToggle };\n", "import { css, html } from 'lit-element';\nimport { connect } from '../core/connect';\n\nimport {\n makeProductPrepaidShipmentOptionsSelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makePrepaidShipmentsSelectedSelector\n} from '../core/selectors';\nimport { safeProductId } from '../core/utils';\nimport { PrepaidStatus } from './PrepaidStatus';\n\nexport class PrepaidData extends PrepaidStatus {\n static get properties() {\n return {\n ...super.properties,\n productPlans: { type: Object },\n prepaidShipmentsSelected: { type: Number },\n totalPrice: { type: Boolean, reflect: true, attribute: 'total-price' },\n perDeliveryPrice: { type: Boolean, reflect: true, attribute: 'per-delivery-price' },\n totalSavings: { type: Boolean, reflect: true, attribute: 'total-savings' },\n perDeliverySavings: { type: Boolean, reflect: true, attribute: 'per-delivery-savings' },\n percentageSavings: { type: Boolean, reflect: true, attribute: 'percentage-savings' },\n extraPercentageSavings: { type: Boolean, reflect: true, attribute: 'extra-percentage-savings' },\n numberOfShipments: { type: Boolean, reflect: true, attribute: 'number-of-shipments' }\n };\n }\n\n static get styles() {\n return css`\n :host {\n display: inline-block;\n text-indent: initial;\n }\n `;\n }\n\n get value() {\n const realProductId = safeProductId(this.product);\n const plans = this.productPlans[realProductId] || [];\n\n const targetShipments = this.selectedNumberOfShipments;\n let currentPlan = plans.find(plan => plan.prepaidShipments > 1 && plan.prepaidShipments === targetShipments);\n\n if (!currentPlan) {\n currentPlan = plans.find(plan => plan.prepaidShipments > 1);\n if (!currentPlan) return '';\n }\n\n const {\n discountRate,\n subscriptionPrice,\n prepaidShipments,\n regularPrepaidPrice,\n prepaidSavingsPerShipment,\n prepaidSavingsTotal,\n prepaidExtraSavingsPercentage\n } = currentPlan;\n\n if (this.totalPrice) {\n return regularPrepaidPrice;\n }\n\n if (this.perDeliveryPrice) {\n return subscriptionPrice;\n }\n\n if (this.totalSavings) {\n return prepaidSavingsTotal;\n }\n\n if (this.perDeliverySavings) {\n return prepaidSavingsPerShipment;\n }\n\n if (this.percentageSavings) {\n return discountRate;\n }\n\n if (this.extraPercentageSavings) {\n return prepaidExtraSavingsPercentage;\n }\n\n if (this.numberOfShipments) {\n return prepaidShipments;\n }\n\n return '';\n }\n\n render() {\n const value = this.value;\n if (value)\n return html`\n <slot name=\"prepend\"></slot>\n ${value}\n <slot name=\"append\"></slot>\n `;\n\n return html`\n <slot name=\"fallback\"></slot>\n `;\n }\n}\nconst mapStateToProps = (state, ownProps) => ({\n options: makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state),\n shipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n prepaidShipmentsSelected: makePrepaidShipmentsSelectedSelector(ownProps.product)(state),\n productPlans: state.productPlans\n});\n\nconst ConnectedPrepaidData = connect(mapStateToProps)(PrepaidData);\n\nexport { ConnectedPrepaidData };\n", "import { html, css } from 'lit-element';\n\nimport {\n makeProductPrepaidShipmentOptionsSelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makePrepaidShipmentsSelectedSelector\n} from '../core/selectors';\nimport { productChangePrepaidShipments } from '../core/actions';\nimport { connect } from '../core/connect';\nimport { PrepaidStatus } from './PrepaidStatus';\n\nexport class PrepaidButton extends PrepaidStatus {\n constructor() {\n super();\n this.addEventListener('click', this.handleClick.bind(this));\n }\n\n static get styles() {\n return css`\n :host {\n cursor: pointer;\n display: inline-block;\n }\n\n :host[hidden] {\n display: none;\n }\n\n .btn {\n position: relative;\n width: var(--og-radio-width, 1.4em);\n height: var(--og-radio-height, 1.4em);\n margin: var(--og-radio-margin, 0);\n padding: 0;\n border: 1px solid var(--og-primary-color, var(--og-border-color, black));\n background: #fff;\n border-radius: 100%;\n vertical-align: middle;\n color: var(--og-primary-color, var(--og-btn-color, black));\n }\n\n .radio {\n text-indent: -9999px;\n flex-shrink: 0;\n }\n\n .radio {\n border-color: var(--og-checkbox-border-color, black);\n }\n\n .radio.active::after {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n background: var(--og-checkbox-border-color, black);\n }\n\n .radio.active::after {\n content: ' ';\n border-radius: 100%;\n border: 2px solid #fff;\n }\n `;\n }\n\n handleClick(ev) {\n if (!this.prepaidOptedIn) {\n this.productChangePrepaidShipments(this.product, this.selectedNumberOfShipments, this.offer);\n }\n ev.preventDefault();\n }\n\n render() {\n return html`\n <slot name=\"default\">\n <button id=\"action-trigger\" class=\"btn radio ${this.prepaidOptedIn ? 'active' : ''}\"></button>\n <label for=\"action-trigger\">\n <slot name=\"label\"><og-text key=\"prepaidOptInLabel\"></og-text></slot>\n </label>\n </slot>\n `;\n }\n}\n\nconst mapStateToProps = (state, ownProps) => ({\n options: makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state),\n shipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n prepaidShipmentsSelected: makePrepaidShipmentsSelectedSelector(ownProps.product)(state)\n});\n\nexport const ConnectedPrepaidButton = connect(mapStateToProps, { productChangePrepaidShipments })(PrepaidButton);\n\nexport default ConnectedPrepaidButton;\n", "import { html, css } from 'lit-element';\nimport { connect } from '../core/connect';\nimport {\n makeProductPrepaidShipmentOptionsSelector,\n makeProductPrepaidShipmentsOptedInSelector,\n makePrepaidShipmentsSelectedSelector\n} from '../core/selectors';\nimport { productChangePrepaidShipments } from '../core/actions';\nimport { PrepaidStatus } from './PrepaidStatus';\n\nexport class PrepaidSelect extends PrepaidStatus {\n constructor() {\n super();\n this.options = [];\n this.text = 'shipments';\n }\n\n static get properties() {\n return {\n ...super.properties,\n text: { type: String },\n /* The label used for the underlying select. */\n selectLabel: { type: String, attribute: 'select-label' }\n };\n }\n\n static get styles() {\n return css`\n og-select {\n display: inline-block;\n cursor: pointer;\n background-color: var(--og-select-bg-color, #fff);\n border: var(--og-select-border, 1px solid #aaa);\n border-width: var(--og-select-border-width, 1px);\n box-shadow: 0 1px 0 1px rgba(0, 0, 0, 0.04);\n z-index: 1;\n }\n `;\n }\n\n render() {\n if (this.options.length === 0) {\n return html``;\n }\n\n const displayOptions = this.options.map(value => ({\n value: value,\n text: `${value} ${this.text}`\n }));\n\n return html`\n ${this.options.length > 1\n ? html`\n <og-select\n .options=${displayOptions}\n .selected=${this.selectedNumberOfShipments}\n .onChange=\"${e => this.handleSelect(e)}\"\n .ariaLabel=\"${this.selectLabel}\"\n ></og-select>\n `\n : html`\n <span>${displayOptions[0].text}</span>\n `}\n <slot name=\"append\"></slot>\n `;\n }\n}\n\nconst mapStateToProps = (state, ownProps) => ({\n options: makeProductPrepaidShipmentOptionsSelector(ownProps.product.id)(state),\n shipmentsOptedIn: makeProductPrepaidShipmentsOptedInSelector(ownProps.product)(state),\n prepaidShipmentsSelected: makePrepaidShipmentsSelectedSelector(ownProps.product)(state)\n});\n\nconst ConnectedPrepaidSelect = connect(mapStateToProps, { productChangePrepaidShipments })(PrepaidSelect);\n\nexport { ConnectedPrepaidSelect };\n", "import { html } from 'lit-element';\nimport { optinProduct } from '../core/actions';\nimport { OptinButton } from './OptinButton';\nimport { mapStateToProps } from './OptinStatus';\nimport { connect } from '../core/connect';\nimport { resolveProduct } from '../core/resolveProperties';\n\nexport class SubscriptionButton extends OptinButton {\n /*\n * The main difference from this SubscriptionButton from the OptinButton is that\n * this button is disabled when the prepaid shipments are enabled.\n *\n * It has prepaid information so it can work together with the PrepaidButton.\n */\n\n static get properties() {\n return {\n ...super.properties,\n prepaidShipmentsOptedIn: { type: Number }\n };\n }\n\n get isActive() {\n if (this.prepaidShipmentsOptedIn > 0) {\n return false;\n }\n return this.subscribed;\n }\n\n handleClick(ev) {\n if (!this.isActive) {\n /*\n By using the `frequencies` we won't need to use the `defaultFrequency` property from the offer element.\n This is because the `frequencies` property will always evaluate to pay as you go frequencies, where the defaultFrequency\n could be a prepaid frequency if there are positive prepaidShipmentsOptedIn.\n */\n const payAsYouGoFrequency =\n this.frequencies && this.frequencies.length > 0 ? this.frequencies[0] : this.optinFrequency;\n this.optinProduct(resolveProduct(this), payAsYouGoFrequency, this.offer);\n }\n ev.preventDefault();\n }\n\n render() {\n return html`\n <slot name=\"default\">\n <button id=\"action-trigger\" class=\"btn radio ${this.isActive ? ' active' : ''}\"></button>\n <label for=\"action-trigger\">\n <slot>\n <slot name=\"label\"><og-text key=\"offerOptInLabel\"></og-text></slot>\n </slot>\n </label>\n </slot>\n `;\n }\n}\n\nexport const ConnectedSubscriptionButton = connect(mapStateToProps, { optinProduct })(SubscriptionButton);\n\nexport default ConnectedSubscriptionButton;\n", "import { LitElement, html, css } from 'lit-element';\n\nimport * as actions from '../core/actions';\n\nexport class TestWizard extends LitElement {\n static get styles() {\n return css`\n :host {\n position: fixed;\n top: 5em;\n righit: 5em;\n background-color: rgba(255, 255, 255, 0.7);\n width: 400px;\n padding: 1em;\n border-radius: 5px;\n border: 1px solid #ccc;\n box-shadow: 2px 2px 0 0 #000;\n }\n\n button {\n margin: 0 0.5em 0.5em;\n background-color: gray;\n color: white;\n border: 0;\n border-radius: 3px;\n cursor: pointer;\n padding: 0.5em;\n }\n\n button.primary {\n background-color: blue;\n padding: 1em;\n color: white;\n border: 0;\n border-radius: 3px;\n }\n\n button[disabled] {\n background-color: #777;\n }\n\n div {\n margin-bottom: 0.5em;\n }\n\n .message {\n margin-left: 0.5em;\n margin: 1em;\n }\n\n .success {\n color: green;\n }\n\n .error {\n color: red;\n }\n\n .warning {\n color: orange;\n }\n a {\n color: white;\n }\n `;\n }\n\n runTests() {\n this.results = [];\n this.disabled = true;\n this.requestUpdate();\n\n const offerElements = document.querySelectorAll('og-offer');\n offerElements.forEach(element => {\n const state = element.store.getState();\n const productAttribute = element.getAttribute('product');\n const locationAttribute = element.getAttribute('location');\n const result = {\n messages: this.getOfferAttributeMessages(productAttribute, locationAttribute).concat(\n this.getOfferRequestMessages(productAttribute, state)\n ),\n product: productAttribute\n };\n this.results.push(result);\n });\n this.testsRan = true;\n this.disabled = false;\n this.requestUpdate();\n }\n\n getOfferAttributeMessages(productAttribute, locationAttribute) {\n const messages = [];\n\n if (!productAttribute) {\n messages.push({\n name: 'Offer element found but missing product attribute',\n type: 'error'\n });\n }\n\n if (!locationAttribute) {\n messages.push({\n name: 'Offer element found but missing location attribute',\n type: 'warning'\n });\n }\n\n if (productAttribute && locationAttribute) {\n messages.push({\n name: 'Offer element found and properly tagged',\n type: 'success'\n });\n }\n\n return messages;\n }\n\n getOfferRequestMessages(productAttribute, state) {\n const inStock = state.inStock[productAttribute];\n const autoshipEligible = state.autoshipEligible[productAttribute];\n const messages = [];\n\n if (productAttribute && inStock === false) {\n messages.push({\n name: 'This product is marked as out of stock in the OG database',\n type: 'warning'\n });\n }\n\n if (productAttribute && autoshipEligible === false) {\n messages.push({\n name: 'This product is not eligible for autoship',\n type: 'warning'\n });\n }\n\n if (productAttribute && inStock === null && autoshipEligible === null) {\n messages.push({\n name: 'This product does not exist in our database',\n type: 'error'\n });\n }\n\n return messages;\n }\n\n resultsCodeBlock() {\n return this.results.length === 0\n ? html`\n <div class=\"message error\">No offer element found on the page</div>\n `\n : this.results.map(\n (result, ix) => html`\n <div>For offer tag with product = \"${result.product}\"</div>\n ${result.messages.map(\n message => html`\n <div class=\"message ${message.type}\">${message.name}</div>\n `\n )}\n <button @click=${this.toggleProductFlags(ix, {})}>Set inStock and eligible</button>\n <br />\n <button @click=${this.toggleProductFlags(ix, { inStock: false })}>Set to not inStock</button>\n <br />\n <button @click=${this.toggleProductFlags(ix, { autoship: false })}>Set to not eligible</button>\n <br />\n <button @click=${this.toggleProductFlags(ix, { autoship: false, inStock: false })}>\n Set to not eligible and not in stock\n </button>\n <br />\n <button @click=${this.toggleUpsellPreview(ix)}>Toggle upsell/regular in this offer</button>\n <br />\n <button @click=${this.toggleUpsellNextOrder(ix)}>upsell product is in next order</button>\n <br />\n `\n );\n }\n\n toggleUpsellPreview(ix) {\n return ev => {\n ev.preventDefault();\n const offer = document.querySelectorAll('og-offer')[ix];\n if (!offer.getAttribute('preview-upsell-offer')) {\n offer.setAttribute('preview-upsell-offer', true);\n } else {\n offer.removeAttribute('preview-upsell-offer');\n }\n this.runTests();\n };\n }\n\n toggleProductFlags(ix, { inStock = true, autoship = true, groups = ['subscription', 'upsell'] }) {\n return ev => {\n ev.preventDefault();\n const offer = document.querySelectorAll('og-offer')[ix];\n const productId = offer.product.id;\n offer.store.dispatch(\n actions.receiveOffer(\n {\n in_stock: { [productId]: inStock },\n eligibility_groups: { [productId]: groups },\n result: 'success',\n autoship: { [productId]: autoship },\n module_view: { regular: '58a01e9aacbe40389b5c7325d79091bb' },\n modifiers: {},\n incentives_display: {\n '47c01e9aacbe40389b5c7325d79091aa': {\n field: 'sub_total',\n object: 'order',\n type: 'Discount Percent',\n value: 5\n },\n e6534b9d877f41e586c37b7d8abc3a58: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 5\n },\n f35e842710b24929922db4a529eecd40: {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 10\n },\n '5be321d7c17f4e18a757212b9a20bfcc': {\n field: 'total_price',\n object: 'item',\n type: 'Discount Percent',\n value: 1\n }\n },\n incentives: {\n [productId]: {\n initial: ['5be321d7c17f4e18a757212b9a20bfcc'],\n ongoing: [\n 'e6534b9d877f41e586c37b7d8abc3a58',\n '47c01e9aacbe40389b5c7325d79091aa',\n 'f35e842710b24929922db4a529eecd40'\n ]\n }\n }\n },\n {},\n productId\n )\n );\n this.runTests();\n };\n }\n\n toggleUpsellNextOrder(ix) {\n return ev => {\n const offer = document.querySelectorAll('og-offer')[ix];\n const productId = offer.product.id;\n\n ev.preventDefault();\n offer.store.dispatch(\n actions.receiveItems({\n count: 1,\n next: null,\n previous: null,\n results: [\n {\n order: '24d50352579511ea806cbc764e100cfd',\n offer: null,\n subscription: '8a076b7a0ea011e7a5bcbc764e105eda',\n product: productId,\n components: [],\n quantity: 1,\n public_id: '24d6901e579511ea806cbc764e100cfd',\n product_attribute: null,\n price: '14.99',\n extra_cost: '0.00',\n total_price: '13.49',\n one_time: false,\n frozen: false,\n first_placed: null\n }\n ]\n })\n );\n this.runTests();\n };\n }\n\n render() {\n return html`\n <div>\n ${this.testsRan\n ? this.resultsCodeBlock()\n : html`\n <div>Click the button to run tests</div>\n `}\n <button ?disabled=${this.disabled} @click=\"${this.runTests.bind(this)}\" class=\"primary\">Run Test</button>\n </div>\n `;\n }\n}\n\nexport default TestWizard;\n", "import { TestWizard } from './components/TestWizard';\n\nexport default function () {\n const name = 'og-test-wizard';\n if (!customElements.get(name)) {\n customElements.define(name, TestWizard);\n }\n const modal = document.createElement(name);\n document.body.appendChild(modal);\n}\n", "import runTests from './run-tests';\n\nexport const keys = [\n 79, // O\n 71, // G\n 68, // D\n 69, // E\n 86 // V\n];\n\nexport const enable = () => {\n if (window.OG_OFFERS_TEST_MODE_ENABLE) return;\n window.OG_OFFERS_TEST_MODE_ENABLE = true;\n let keysCounter = 0;\n document.addEventListener(\n 'keyup',\n async function (e) {\n const key = e.which;\n if (key === keys[keysCounter]) {\n const currentkeys = keys[keysCounter];\n setTimeout(function () {\n if (keysCounter <= currentkeys) keysCounter = 0;\n }, 5000);\n keysCounter += 1;\n if (keysCounter >= keys.length) {\n runTests();\n }\n } else {\n keysCounter = 0;\n }\n },\n false\n );\n};\n\nexport default enable;\n", "import { html, css } from 'lit-element';\nimport { connect } from '../core/connect';\n\nimport { withProduct } from '../core/resolveProperties';\nimport { TemplateElement } from '../core/base';\nimport {\n makeDiscountedProductPriceSelector,\n makeProductDefaultFrequencySelector,\n makeProductFrequencyOptedInSelector\n} from '../core/selectors';\nimport { safeProductId } from '../core/utils';\n\nexport class Price extends withProduct(TemplateElement) {\n static get properties() {\n return {\n ...super.properties,\n regular: { type: Boolean, reflect: true },\n subscription: { type: Boolean, reflect: true },\n discount: { type: Boolean, reflect: true },\n /** Force displaying the pay-as-you-go price. This is relevant when there is a prepaid plan that the user has opted into, and you still want to display the pay-as-you-go price for comparison */\n payAsYouGo: { type: Boolean, reflect: true, attribute: 'pay-as-you-go' },\n frequency: { type: Object },\n /** If Shopify, this is derived from the selling plans attached to the product */\n productPlans: { type: Object },\n /** The discounted price, as calculated from the Offers API response */\n discountedProductPriceFromOffers: { type: Object }\n };\n }\n\n static get styles() {\n return css`\n :host::before {\n clip-path: inset(100%);\n clip: rect(1px, 1px, 1px, 1px);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n }\n\n :host([subscription])::before {\n content: 'Discounted subscription price';\n }\n\n :host([regular])::before {\n content: 'Regular price';\n }\n `;\n }\n\n get value() {\n const realProductId = safeProductId(this.product);\n const frequency = this.frequency || this.configDefaultFrequency || this.offer?.defaultFrequency;\n const plans = this.productPlans[realProductId] || [];\n\n let currentPlan = this.payAsYouGo\n ? plans.find(plan => plan.prepaidShipments === null || plan.prepaidShipments === undefined)\n : plans.find(plan => plan.frequency === frequency);\n\n if (!currentPlan) return '';\n\n // default to pulling from the selling plan\n let { regularPrice, discountRate, subscriptionPrice } = currentPlan;\n // if the selling plan has no price adjustments, then use the offer response to determine the discounted price\n // this will be true for merchants on standardized offer profiles\n // we still rely on the selling plan for prepaid subscriptions, for simplicity\n if (\n // overrideSellingPlanPrice is a dev flag to force using the offer price for testing purposes\n (currentPlan.hasPriceAdjustments === false || this.offer?.overrideSellingPlanPrice) &&\n !currentPlan.prepaidShipments\n ) {\n ({ regularPrice, discountRate, subscriptionPrice } = this.discountedProductPriceFromOffers);\n }\n\n // if payAsYouGo, always show the price even if no discount\n // it's unclear if this was the original intention, but preserving existing behavior\n if (subscriptionPrice === regularPrice && !this.payAsYouGo) return '';\n\n if (this.regular) {\n return regularPrice;\n }\n if (this.discount) return discountRate;\n return subscriptionPrice;\n }\n\n render() {\n const value = this.value;\n if (value)\n return html`\n <slot name=\"prepend\"></slot>\n ${value}\n <slot name=\"append\"></slot>\n `;\n\n return html`\n <slot name=\"fallback\"></slot>\n `;\n }\n}\nconst mapStateToProps = (state, ownProps) => ({\n productPlans: state.productPlans,\n configDefaultFrequency: makeProductDefaultFrequencySelector(ownProps.product?.id)(state),\n frequency: makeProductFrequencyOptedInSelector(ownProps.product)(state),\n discountedProductPriceFromOffers: makeDiscountedProductPriceSelector(ownProps.product?.id)(state)\n});\n\nexport default connect(mapStateToProps)(Price);\n", "import { offersLiveEditor } from '@ordergroove/offers-live-editor';\nimport { setStore } from './core/connect';\nimport * as adapters from './core/adapters';\nimport * as actions from './core/actions';\nimport { ConnectedWhen } from './components/When';\nimport { ConnectedOptinButton } from './components/OptinButton';\nimport { ConnectedOptoutButton } from './components/OptoutButton';\nimport { ConnectedOptinSelect } from './components/OptinSelect';\nimport { ConnectedUpsellButton } from './components/UpsellButton';\nimport { ConnectedUpsellModal } from './components/UpsellModal';\nimport { ConnectedOptinToggle } from './components/OptinToggle';\nimport { ConnectedOptinStatus } from './components/OptinStatus';\nimport { ConnectedText } from './components/Text';\nimport { ConnectedIncentiveText } from './components/IncentiveText';\nimport { ConnectedBenefitMessages } from './components/BenefitMessages';\nimport { ConnectedSelectFrequency } from './components/SelectFrequency';\nimport { ConnectedNextUpcomingOrder } from './components/NextUpcomingOrder';\nimport { ConnectedOffer } from './components/Offer';\nimport { Modal } from './components/Modal';\nimport { Select } from './components/Select';\nimport { Tooltip } from './components/Tooltip';\nimport { ConnectedFrequencyStatus } from './components/FrequencyStatus';\nimport { ConnectedPrepaidToggle } from './components/PrepaidToggle';\nimport { ConnectedPrepaidData } from './components/PrepaidData';\nimport { ConnectedPrepaidButton } from './components/PrepaidButton';\nimport { ConnectedPrepaidSelect } from './components/PrepaidSelect';\nimport { ConnectedSubscriptionButton } from './components/SubscriptionButton';\nimport * as testMode from './test-mode';\nimport { RECEIVE_PRODUCT_PLANS } from './core/constants';\nimport ConnectedPrice from './components/Price';\nimport platform from './platform';\n\nexport default function makeApi(store) {\n testMode.enable();\n\n setStore(store);\n\n try {\n customElements.define('og-when', ConnectedWhen);\n customElements.define('og-text', ConnectedText);\n customElements.define('og-incentive-text', ConnectedIncentiveText);\n customElements.define('og-benefit-messages', ConnectedBenefitMessages);\n customElements.define('og-offer', ConnectedOffer);\n customElements.define('og-select-frequency', ConnectedSelectFrequency);\n customElements.define('og-optout-button', ConnectedOptoutButton);\n customElements.define('og-optin-toggle', ConnectedOptinToggle);\n customElements.define('og-optin-status', ConnectedOptinStatus);\n customElements.define('og-optin-button', ConnectedOptinButton);\n customElements.define('og-optin-select', ConnectedOptinSelect);\n customElements.define('og-upsell-button', ConnectedUpsellButton);\n customElements.define('og-frequency-status', ConnectedFrequencyStatus);\n customElements.define('og-modal', Modal);\n customElements.define('og-select', Select);\n customElements.define('og-tooltip', Tooltip);\n customElements.define('og-upsell-modal', ConnectedUpsellModal);\n customElements.define('og-next-upcoming-order', ConnectedNextUpcomingOrder);\n customElements.define('og-price', ConnectedPrice);\n customElements.define('og-prepaid-toggle', ConnectedPrepaidToggle);\n customElements.define('og-prepaid-data', ConnectedPrepaidData);\n customElements.define('og-prepaid-button', ConnectedPrepaidButton);\n customElements.define('og-prepaid-select', ConnectedPrepaidSelect);\n customElements.define('og-subscription-button', ConnectedSubscriptionButton);\n } catch (err) {\n console.info('OG WebComponents already registered, skipping.');\n }\n\n // // use this syntax to allow es6 module be called as default function og.offers(...)\n // module.exports = offers.initialize;\n let isReady = false;\n const offers = {\n store,\n isReady: () => isReady,\n setEnvironment(e) {\n store.dispatch(actions.setEnvironment(e));\n return this;\n },\n setMerchantId(m) {\n store.dispatch(actions.setMerchantId(m));\n return this;\n },\n setAuthUrl(authUrl) {\n store.dispatch(actions.setAuthUrl(authUrl));\n return this;\n },\n receiveMerchantSettings(settings) {\n store.dispatch(actions.receiveMerchantSettings(settings));\n return this;\n },\n getProductsForPurchasePost(productIds = []) {\n return adapters.getProductsForPurchasePost(store.getState(), productIds);\n },\n getOptins(productIds = []) {\n return adapters.getProductsForPurchasePost(store.getState(), productIds);\n },\n clear() {\n store.dispatch(actions.checkout());\n },\n addOptinChangedCallback(fn) {\n if (typeof fn === 'function') document.addEventListener('optin-changed', e => fn(e.detail));\n },\n disableOptinChangedCallbacks() {\n document.addEventListener('optin-changed', e => e.stopPropagation(), true);\n },\n\n register() {\n /* noop */\n },\n previewMode(set) {\n window.og = window.og || {};\n if (set === false) {\n delete window.og;\n } else {\n window.og.previewMode = true;\n console.log('OG Offers preview mode enabled');\n }\n return this;\n },\n config(configuration) {\n store.dispatch(actions.setConfig(configuration));\n return this;\n },\n setLocale(locale) {\n store.dispatch(actions.setLocale(locale));\n return this;\n },\n /**\n * Set benefit messages keyed by incentive public id. Each value is a\n * locale map (IETF tag \u2192 message text) for the incentive; the consumer\n * picks the appropriate locale at render time. Replaces the entire map.\n * @param {{ [incentivePublicId: string]: { [locale: string]: string } }} messages\n */\n setBenefitMessages(messages) {\n store.dispatch(actions.setBenefitMessages(messages));\n return this;\n },\n addTemplate(tagName, content, configOption) {\n store.dispatch(actions.addTemplate(tagName, content, configOption));\n return this;\n },\n /**\n * templates object where keys are selectors and values are content\n */\n setTemplates(templates) {\n store.dispatch(actions.setTemplates(templates));\n return this;\n },\n\n setPublicPath(_publicPath) {\n return this;\n },\n\n resolveSettings(merchantId, env, settings, storeInstance = store) {\n // window.og_settings does not affect Shopify selling plan offers\n if (platform.shopify_selling_plans) return;\n\n if (merchantId && env && settings) {\n let products = [];\n if (settings.product) {\n products.push(settings.product);\n } else if (settings.cart && Array.isArray(settings.cart.products)) {\n products = products.concat(settings.cart.products);\n }\n\n const state = storeInstance.getState();\n const { sessionId } = state;\n if (sessionId) {\n products.forEach(product => storeInstance.dispatch(actions.requestOffer(product)));\n }\n\n if (settings.product_discounts && typeof settings.product_discounts === 'object') {\n storeInstance.dispatch({ type: RECEIVE_PRODUCT_PLANS, payload: settings.product_discounts });\n }\n }\n },\n\n /**\n * Initialize OG object\n * @param {*} merchantId\n * @param {*} env\n * @param {*} authUrl\n * @param {import('./core/types/api').MerchantSettings} merchantSettings\n */\n initialize(merchantId, env, authUrl, merchantSettings = {}) {\n // settings resolves once, before anything.\n if (isReady) {\n console.warn('og.offers has been initialized already. Skipping.');\n }\n\n const state = store.getState();\n // dont re-trigger actions if value is the same. allowing set new authurl only\n if (merchantId && merchantId !== state.merchantId) offers.setMerchantId(merchantId);\n if (env && env !== state.environment?.name) offers.setEnvironment(env);\n // always set merchant settings\n offers.receiveMerchantSettings(merchantSettings);\n\n // allow set new authUrl\n if (authUrl) offers.setAuthUrl(authUrl);\n\n // ensure to dispatch settings actions before any other action\n if (!isReady) {\n offers.resolveSettings(merchantId, env, window.og_settings, store);\n }\n\n isReady = true;\n\n return this;\n }\n };\n\n window.OG = window.OG || {};\n Object.assign(window.OG, offers);\n Object.assign(offers.initialize, offers);\n\n offersLiveEditor(window.opener, offers);\n\n return offers;\n}\n", "import { combineReducers } from 'redux';\nimport * as constants from './constants';\nimport { isSameProduct } from './selectors';\nimport { stringifyFrequency } from './api';\nimport { getObjectStructuredProductPlans } from './adapters';\nimport { safeProductId, getMatchingProductIfExists } from './utils';\nimport { experimentsReducer } from './experiments';\n\nimport {\n AuthState,\n EnvironmentState,\n AutoshipByDefaultState,\n AutoshipEligibleState,\n BenefitMessagesState,\n ConfigState,\n Incentive,\n IncentiveObject,\n IncentivesState,\n NextUpcomingOrderState,\n OptedInState,\n OptedOutState,\n PrepaidShipmentsSelectedState,\n PriceState,\n ProductPlansState,\n ReceiveOfferPayload\n} from './types/reducer';\nimport { EmptyObject } from './types/utility';\nimport { IncentiveDisplay, IncentivesDisplayEnhanced } from './types/api';\n\nexport const optedin = (state: OptedInState = [], action): OptedInState => {\n switch (action.type) {\n case constants.LOCAL_STORAGE_CLEAR:\n return [];\n case constants.LOCAL_STORAGE_CHANGE:\n return action.newValue ? action.newValue.optedin : state;\n case constants.OPTIN_PRODUCT:\n case constants.PRODUCT_CHANGE_FREQUENCY: {\n // since prepaid maps to a different set of frequencies, we remove prepaidShipments when frequency is changed\n const [{ prepaidShipments, ...oldone }, rest] = getMatchingProductIfExists(state, action.payload.product);\n return rest.concat({\n ...oldone,\n ...action.payload.product,\n frequency: action.payload.frequency\n });\n }\n case constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS: {\n const { payload } = action;\n const [{ prepaidShipments, ...oldone }, rest] = getMatchingProductIfExists(state, payload.product);\n const newState = {\n ...oldone,\n ...payload.product\n };\n if (payload.prepaidShipments) {\n newState.prepaidShipments = payload.prepaidShipments;\n }\n return rest.concat(newState);\n }\n case constants.OPTOUT_PRODUCT:\n return state.filter(a => !isSameProduct(action.payload.product, a));\n case constants.PRODUCT_HAS_CHANGED:\n return state.map(product =>\n isSameProduct(action.payload.product, product) ? { ...product, ...action.payload.newProduct } : product\n );\n case constants.CONVERT_ONE_TIME:\n return state.filter(a => !isSameProduct(action.payload.product, a));\n case constants.CHECKOUT:\n return [];\n default:\n return state;\n }\n};\n\nexport const optedout = (state: OptedOutState = [], action): OptedOutState => {\n switch (action.type) {\n case constants.LOCAL_STORAGE_CLEAR:\n return [];\n case constants.LOCAL_STORAGE_CHANGE:\n return action.newValue ? action.newValue.optedout : state;\n case constants.OPTIN_PRODUCT:\n case constants.PRODUCT_CHANGE_FREQUENCY:\n return state.filter(a => !isSameProduct(action.payload.product, a));\n case constants.OPTOUT_PRODUCT: {\n const [oldone, rest] = getMatchingProductIfExists(state, action.payload.product);\n return rest.concat({\n ...oldone,\n ...action.payload.product,\n frequency: action.payload.frequency\n });\n }\n case constants.PRODUCT_HAS_CHANGED:\n return state.map(product =>\n isSameProduct(action.payload.product, product) ? { ...product, ...action.payload.newProduct } : product\n );\n case constants.CHECKOUT:\n return [];\n default:\n return state;\n }\n};\n\nexport const nextUpcomingOrder = (state: NextUpcomingOrderState = {}, { type, payload }): NextUpcomingOrderState => {\n switch (type) {\n case constants.RECEIVE_ORDERS:\n return payload && payload.count > 0\n ? {\n ...state,\n ...(payload.results[0] && {\n ...payload.results[0],\n place: new Date(Date.parse(payload.results[0].place.replace(/-/gi, '/')))\n })\n }\n : state;\n case constants.RECEIVE_ORDER_ITEMS:\n return {\n ...state,\n products: (payload.results || []).map(it => it.product)\n };\n case constants.CREATE_ONE_TIME:\n // when CREATE_IU_ORDER payload is just order item object created\n return {\n ...state,\n ...payload,\n public_id: payload.order,\n ...(payload.product && { products: (state.products || []).concat(payload.product) })\n };\n default:\n return state;\n }\n};\n\nexport const autoshipEligible = (state: AutoshipEligibleState = {}, action): AutoshipEligibleState => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...action.payload.autoship\n };\n default:\n return state;\n }\n};\n\nexport const inStock = (state = {}, action) => {\n switch (action.type) {\n // force offer to refresh when requesting a new one\n case constants.REQUEST_OFFER:\n return { ...state };\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...action.payload.in_stock\n };\n default:\n return state;\n }\n};\n\nexport const eligibilityGroups = (state = {}, action) => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...action.payload.eligibility_groups\n };\n default:\n return state;\n }\n};\n\nconst mapIncentive = (\n incentive: string[],\n incentiveDisplay: IncentiveDisplay,\n incentiveDisplayEnhanced?: IncentivesDisplayEnhanced\n): Incentive[] => {\n return incentive.map(i => {\n const enhanced = incentiveDisplayEnhanced?.[i];\n return {\n ...incentiveDisplay[i],\n // for standard incentives, include the criteria so we know which kind of incentive (e.g. PSI, prepaid, etc)\n ...(enhanced\n ? {\n enhanced: true,\n criteria: enhanced.criteria\n ? enhanced.criteria\n : // when there is no criteria in the enhanced incentive, it means it's a program wide incentive\n // for ease-of-use, we set use a \"PROGRAM_WIDE\" pseudo-standard here\n {\n node_type: 'PREMISE',\n standard: constants.INCENTIVE_STANDARD_TYPES.PROGRAM_WIDE,\n premise_value: null\n },\n threshold_field: enhanced.threshold_field,\n threshold_value: enhanced.threshold_value\n }\n : {}),\n id: [i][0]\n };\n });\n};\n\nexport const incentives = (\n state: IncentivesState = {},\n action: { type: string; payload: ReceiveOfferPayload }\n): IncentivesState => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...[...new Set(Object.keys(action.payload.incentives || {}))].reduce(\n (obj, uniqueProductId) => ({\n ...obj,\n [uniqueProductId]: Object.entries(action.payload.incentives)\n .filter(([productId]) => productId === uniqueProductId)\n .reduce(\n (incentiveObj: IncentiveObject | EmptyObject, [, { initial, ongoing }]) => ({\n ...incentiveObj,\n initial: [\n ...(incentiveObj.initial || []),\n ...mapIncentive(\n initial,\n action.payload.incentives_display,\n action.payload.incentives_display_enhanced\n )\n ],\n ongoing: [\n ...(incentiveObj.ongoing || []),\n ...mapIncentive(\n ongoing,\n action.payload.incentives_display,\n action.payload.incentives_display_enhanced\n )\n ]\n }),\n {}\n )\n }),\n {}\n )\n };\n default:\n return state;\n }\n};\n\nexport const frequency = (state = {}, action) => {\n switch (action.type) {\n case constants.OPTIN_PRODUCT:\n case constants.PRODUCT_CHANGE_FREQUENCY:\n return {\n ...state,\n [safeProductId(action.payload.product)]: action.payload.frequency\n };\n case constants.OPTOUT_PRODUCT:\n return { ...state, [safeProductId(action.payload.product)]: undefined };\n default:\n return state;\n }\n};\n\nexport const auth = (state: AuthState = false, action): AuthState => {\n switch (action.type) {\n case constants.AUTHORIZE:\n return {\n ...action.payload\n };\n case constants.UNAUTHORIZED:\n return false;\n default:\n return state;\n }\n};\n\nexport const merchantId = (state = '', action) => {\n switch (action.type) {\n case constants.SET_MERCHANT_ID:\n return action.payload;\n default:\n return state;\n }\n};\n\nexport const authUrl = (state = null, action) => {\n switch (action.type) {\n case constants.SET_AUTH_URL:\n return action.payload;\n default:\n return state;\n }\n};\n\nexport const offer = (state = {}, action) => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n offerId: (action.payload.module_view || {}).regular,\n ...action.payload.modifiers\n };\n default:\n return state;\n }\n};\n\nexport const offerId = (state = '', action) => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return (action.payload.module_view || {}).regular || '';\n default:\n return state;\n }\n};\nexport const sessionId = (state = null, action) => {\n switch (action.type) {\n case constants.LOCAL_STORAGE_CLEAR:\n return null;\n case constants.CREATED_SESSION_ID:\n return action.payload;\n default:\n return state;\n }\n};\n\nexport const productOffer = (state = {}, action) => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...Object.entries(action.payload.autoship)\n .map(([key]) => ({ [key]: Object.keys(action.payload.modifiers) }))\n .reduce((acc, object) => ({ ...acc, ...object }), {})\n };\n case constants.CHECKOUT:\n return {};\n default:\n return state;\n }\n};\n\nexport const firstOrderPlaceDate = (state = {}, action) => {\n switch (action.type) {\n case constants.SET_FIRST_ORDER_PLACE_DATE:\n return {\n ...state,\n [safeProductId(action.payload.product)]: action.payload.firstOrderPlaceDate\n };\n default:\n return state;\n }\n};\n\nexport const productToSubscribe = (state = {}, action) => {\n switch (action.type) {\n case constants.SET_PRODUCT_TO_SUBSCRIBE:\n return {\n ...state,\n [safeProductId(action.payload.product)]: action.payload.productToSubscribe\n };\n default:\n return state;\n }\n};\n\nexport const environment = (state: EnvironmentState = {}, action): EnvironmentState => {\n switch (action.type) {\n case constants.SET_ENVIRONMENT_LOCAL:\n return {\n ...state,\n name: 'local',\n apiUrl: 'http://py3web.ordergroove.localhost',\n legoUrl: 'http://py3lego.ordergroove.localhost'\n };\n case constants.SET_ENVIRONMENT_STAGING:\n return {\n ...state,\n name: constants.ENV_STAGING,\n apiUrl: 'https://staging.offers.ordergroove.com',\n // scUrl: 'https://staging.sc.ordergroove.com',\n // widgetsUrl: 'https://staging.static.ordergroove.com',\n // masterDbUrl: 'https://staging.v2.ordergroove.com',\n // reorderUrl: 'https://staging.static.ordergroove.com/reorder/',\n legoUrl: 'https://staging.restapi.ordergroove.com'\n };\n case constants.SET_ENVIRONMENT_DEV:\n return {\n ...state,\n name: constants.ENV_DEV,\n apiUrl: 'https://dev.offers.ordergroove.com',\n // scUrl: 'https://dev.sc.ordergroove.com',\n // widgetsUrl: 'https://dev.static.ordergroove.com',\n // masterDbUrl: 'https://dev.api.ordergroove.com',\n // reorderUrl: 'https://staging.static.ordergroove.com/reorder/',\n legoUrl: 'https://dev.restapi.ordergroove.com'\n };\n case constants.SET_ENVIRONMENT_PROD:\n return {\n ...state,\n name: constants.ENV_PROD,\n apiUrl: 'https://offers.ordergroove.com',\n // scUrl: 'https://sc.ordergroove.com',\n // widgetsUrl: 'https://static.ordergroove.com',\n // masterDbUrl: 'https://api.ordergroove.com',\n // reorderUrl: 'https://static.ordergroove.com/reorder/',\n legoUrl: 'https://restapi.ordergroove.com'\n };\n default:\n return state;\n }\n};\n\nexport const locale = (\n state = {\n offerOptInLabel: 'Subscribe to save',\n offerIncentiveText: 'Save {{ogIncentive DiscountPercent}} when you subscribe',\n offerOptOutLabel: 'Deliver one-time only',\n offerEveryLabel: 'Delivery Every',\n offerTooltipTrigger: '[?]',\n offerTooltipContent: 'Seems this is a great subscription offering. Many fun details about this program exist.',\n optinButtonLabel: '\u2022',\n optoutButtonLabel: '\u2022',\n optinStatusOptedInLabel: \"You're opted in!\",\n optinStatusOptedOutLabel: \"You're not opted in.\",\n optinToggleLabel: '\u2022',\n upsellButtonLabel: 'Add item to order on ',\n upsellButtonPrefix: '',\n upsellModalContent: 'Some upsell modal content',\n upsellModalOptInLabel: 'Subscribe',\n upsellModalOptOutLabel: 'Purchase one time',\n upsellModalTitle: 'Impulse Upsell',\n upsellModalConfirmLabel: 'Ok',\n upsellModalCancelLabel: 'Cancel',\n defaultFrequencyCopy: '(Most Popular)',\n frequencyPeriods: {\n 1: 'day',\n 2: 'week',\n 3: 'month'\n },\n prepaidOptInLabel: 'Prepaid Subscription',\n prepaidShipmentsLabel: 'Number of prepaid shipments'\n },\n action\n) => {\n switch (action.type) {\n case constants.SET_LOCALE:\n return { ...state, ...action.payload };\n default:\n return state;\n }\n};\n\nexport const config = (\n state: ConfigState = {\n offerType: 'radio'\n },\n action\n): ConfigState => {\n switch (action.type) {\n case constants.SET_CONFIG:\n return {\n ...state,\n ...action.payload,\n // these are not populated by default; only if the merchant calls the config method on the Offers API\n defaultFrequency: action.payload.defaultFrequency\n ? stringifyFrequency(action.payload.defaultFrequency)\n : state.defaultFrequency,\n frequenciesEveryPeriod: [],\n frequencies: action.payload.frequencies ? action.payload.frequencies.map(stringifyFrequency) : state.frequencies\n };\n case constants.RECEIVE_MERCHANT_SETTINGS:\n return {\n ...state,\n merchantSettings: {\n ...action.payload\n }\n };\n default:\n return state;\n }\n};\n\nexport const previewStandardOffer = (state = false, action) => {\n switch (action.type) {\n case constants.SET_PREVIEW_STANDARD_OFFER:\n return action.payload.isPreview;\n default:\n return state;\n }\n};\n\nexport const previewUpsellOffer = (state = false, action) => {\n switch (action.type) {\n case constants.SET_PREVIEW_UPSELL_OFFER:\n return action.payload.isPreview;\n default:\n return state;\n }\n};\n\nexport const previewPrepaidOffer = (state = false, action) => {\n switch (action.type) {\n case constants.SET_PREVIEW_PREPAID_OFFER:\n return action.payload.isPreview;\n default:\n return state;\n }\n};\n\nexport const autoshipByDefault = (state: AutoshipByDefaultState = {}, action): AutoshipByDefaultState => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...action.payload.autoship_by_default\n };\n default:\n return state;\n }\n};\n\nexport const defaultFrequencies = (state = [], action) => {\n switch (action.type) {\n case constants.RECEIVE_OFFER:\n return {\n ...state,\n ...action.payload.default_frequencies\n };\n default:\n return state;\n }\n};\n\nexport const templates = (state = [], action) => {\n switch (action.type) {\n case constants.SET_TEMPLATES:\n return [...(action.payload || [])];\n case constants.ADD_TEMPLATE:\n // Unshift the payload at the top\n return [action.payload, ...state];\n default:\n return state;\n }\n};\n\nexport const productPlans = (state: ProductPlansState = {}, action): ProductPlansState => {\n switch (action.type) {\n case constants.RECEIVE_PRODUCT_PLANS:\n return getObjectStructuredProductPlans(action.payload);\n default:\n return state;\n }\n};\n\nexport const prepaidShipmentsSelected = (\n state: PrepaidShipmentsSelectedState = {},\n action\n): PrepaidShipmentsSelectedState => {\n switch (action.type) {\n // Given that, in the cart, products will have a composed id (<productId>:<cartId>) and that every time\n // a product changes in the cart we need to sync these changes back with the eComm platform, this operation\n // may result in a new cartId that needs to replace the old product's cartId in order to have the\n // prepaidShipmentsSelected object up-to-date\n case constants.CART_PRODUCT_KEY_HAS_CHANGED: {\n const { [action.payload.oldCartProductKey]: preservedPrepaidShipments, ...stateWithoutOldCartProductKey } = state;\n return { ...stateWithoutOldCartProductKey, [action.payload.newCartProductKey]: preservedPrepaidShipments };\n }\n case constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS:\n if (action.payload.prepaidShipments) {\n return { ...state, [action.payload.product.id]: action.payload.prepaidShipments };\n }\n return state;\n default:\n return state;\n }\n};\n\nexport const price = (state: PriceState = {}, _action) => state;\n\nexport const benefitMessages = (state: BenefitMessagesState = {}, action): BenefitMessagesState => {\n switch (action.type) {\n case constants.SET_BENEFIT_MESSAGES:\n return { ...(action.payload || {}) };\n default:\n return state;\n }\n};\n\nexport default combineReducers({\n optedin,\n optedout,\n nextUpcomingOrder,\n autoshipEligible,\n inStock,\n eligibilityGroups,\n incentives,\n frequency,\n auth,\n merchantId,\n authUrl,\n offer,\n offerId,\n experiments: experimentsReducer,\n sessionId,\n productOffer,\n firstOrderPlaceDate,\n productToSubscribe,\n environment,\n locale,\n config,\n previewStandardOffer,\n previewUpsellOffer,\n autoshipByDefault,\n defaultFrequencies,\n templates,\n productPlans,\n prepaidShipmentsSelected,\n price,\n benefitMessages\n});\n", "import { getPayAsYouGoSellingPlan, money, percentage } from '../utils';\nimport { ShopifyProductEntity, ShopifySellingPlanAllocationsEntity, ShopifySellingPlansEntity } from '../types/shopify';\nimport { ProductPlanEntity } from '../types/productPlan';\n\nexport const isPrepaidAllocation = (allocation: ShopifySellingPlanAllocationsEntity) =>\n Array.isArray(allocation.selling_plan?.options) &&\n allocation.selling_plan?.options.some(option => option?.name === 'Shipment amount');\n\nexport const getPrepaidShipmentsNumberFromOptions = options => {\n if (options && options.length > 1) {\n const shipmentAmountArray = options.find(option => option?.name === 'Shipment amount').value.split(' ');\n return shipmentAmountArray.length > 0 ? +shipmentAmountArray[0] : null;\n }\n\n return null;\n};\n\nexport const getAllocationFrequency = (allocation: ShopifySellingPlanAllocationsEntity) => {\n // now frequency every_period will match with selling_plan_id so no need to convert it\n return (allocation.selling_plan_id || (allocation.selling_plan?.id ?? '')).toString();\n};\n\nexport const getAllocationRegularPrice = (allocation: ShopifySellingPlanAllocationsEntity, currency: string) => {\n return money(allocation.compare_at_price, currency);\n};\n\nexport const getAllocationSubscriptionPrice = (allocation: ShopifySellingPlanAllocationsEntity, currency: string) => {\n if (isPrepaidAllocation(allocation)) {\n const prepaidShipmentsPerBilling = getPrepaidShipmentsNumberFromOptions(allocation.selling_plan?.options);\n const pricePerShipment = Math.round(allocation.price / prepaidShipmentsPerBilling);\n return money(pricePerShipment, currency);\n }\n\n return money(allocation.price, currency);\n};\n\nconst getPrepaidPercentage = (allocation: ShopifySellingPlanAllocationsEntity, pricePerShipment: number) => {\n return Math.round(((allocation.compare_at_price - pricePerShipment) * 100) / allocation.compare_at_price);\n};\n\nexport const getAllocationDiscountRate = (allocation: ShopifySellingPlanAllocationsEntity, currency: string) => {\n if (isPrepaidAllocation(allocation)) {\n const prepaidShipmentsPerBilling = getPrepaidShipmentsNumberFromOptions(allocation.selling_plan?.options);\n const pricePerShipment = allocation.price / prepaidShipmentsPerBilling;\n const prepaidPercentageSavings = getPrepaidPercentage(allocation, pricePerShipment);\n\n return percentage(prepaidPercentageSavings);\n }\n\n let formatted_discount = '';\n\n if (allocation.price_adjustments[0]?.value_type === 'percentage') {\n formatted_discount = percentage(allocation.price_adjustments[0].value);\n } else if (allocation.price_adjustments[0]?.value) {\n formatted_discount = money(allocation.price_adjustments[0].value, currency);\n } else if (allocation.compare_at_price) {\n formatted_discount = money(allocation.compare_at_price - allocation.price, currency);\n }\n\n return formatted_discount;\n};\n\nexport const getAllocationNumberOfShipments = (allocation: ShopifySellingPlanAllocationsEntity) => {\n if (isPrepaidAllocation(allocation)) {\n return getPrepaidShipmentsNumberFromOptions(allocation.selling_plan?.options);\n }\n return null;\n};\n\nexport const addPrepaidPriceAndSavings = (\n allocation: ShopifySellingPlanAllocationsEntity,\n productPlan: ProductPlanEntity,\n payAsYouGoPlan: ShopifySellingPlansEntity,\n currency: string\n) => {\n const prepaidShipmentsPerBilling = getPrepaidShipmentsNumberFromOptions(allocation.selling_plan?.options);\n const pricePerShipment = allocation.price / prepaidShipmentsPerBilling;\n const prepaidSaving = allocation.compare_at_price - pricePerShipment;\n const prepaidPercentageSavings = getPrepaidPercentage(allocation, pricePerShipment);\n const payAsYouGoAdjustment = payAsYouGoPlan?.price_adjustments?.[0];\n const payAsYouGoPercentage =\n payAsYouGoAdjustment && payAsYouGoAdjustment.value_type === 'percentage' ? payAsYouGoAdjustment.value : null;\n\n productPlan['regularPrepaidPrice'] = money(allocation.price, currency);\n productPlan['prepaidSavingsPerShipment'] = money(Math.round(prepaidSaving), currency);\n productPlan['prepaidSavingsTotal'] = money(Math.round(prepaidSaving * prepaidShipmentsPerBilling), currency);\n\n if (payAsYouGoPercentage && prepaidPercentageSavings) {\n productPlan['prepaidExtraSavingsPercentage'] = percentage(prepaidPercentageSavings - payAsYouGoPercentage);\n }\n\n return productPlan;\n};\n\nexport const mapSellingPlanToDiscount = (\n allocation: ShopifySellingPlanAllocationsEntity,\n sellingPlans: ShopifySellingPlansEntity[],\n currency: string\n) => {\n if (!allocation.selling_plan) {\n allocation.selling_plan = sellingPlans.find(plan => plan.id === allocation.selling_plan_id);\n }\n\n const productPlan: ProductPlanEntity = {\n frequency: getAllocationFrequency(allocation),\n regularPrice: getAllocationRegularPrice(allocation, currency),\n subscriptionPrice: getAllocationSubscriptionPrice(allocation, currency),\n discountRate: getAllocationDiscountRate(allocation, currency),\n prepaidShipments: getAllocationNumberOfShipments(allocation),\n hasPriceAdjustments: allocation.price_adjustments?.length > 0\n };\n\n if (isPrepaidAllocation(allocation)) {\n const payAsYouGoPlan = getPayAsYouGoSellingPlan(sellingPlans);\n return addPrepaidPriceAndSavings(allocation, productPlan, payAsYouGoPlan, currency);\n }\n\n return productPlan;\n};\n\nexport const sellingPlanAllocationsReducer = (\n acc: ProductPlanEntity[],\n cur: ShopifySellingPlanAllocationsEntity,\n sellingPlans: ShopifySellingPlansEntity[] = [],\n currency: string\n) => [...acc, mapSellingPlanToDiscount(cur, sellingPlans, currency)];\n\nexport const getSellingPlans = (product: ShopifyProductEntity) =>\n product.selling_plan_groups.reduce<ShopifySellingPlansEntity[]>(\n (allGroups, group) => [...allGroups, ...group.selling_plans.map(selling_plan => ({ ...selling_plan, group }))],\n []\n );\n", "import * as constants from '../../core/constants';\nimport { getFirstSellingPlan, isOgFrequency, mapFrequencyToSellingPlan, safeProductId } from '../../core/utils';\nimport type {\n ConfigState,\n ReceiveMerchantSettingsPayload,\n ReceiveOfferPayload,\n SetupProductPayload\n} from '../../core/types/reducer';\n\nimport {\n getPayAsYouGoSellingPlanGroup,\n sellingPlansToEveryPeriod,\n sellingPlansToFrequencies,\n getPrepaidShipments\n} from '../utils';\nimport { ShopifyProductEntity, ShopifySellingPlanGroupsEntity, ShopifyVariantsEntity } from '../types/shopify';\n\nconst config = (\n state: ConfigState = {\n offerType: 'radio',\n productFrequencies: {},\n frequencies: [],\n frequenciesEveryPeriod: []\n },\n action\n): ConfigState => {\n if (constants.SETUP_PRODUCT === action.type) {\n const {\n payload: { product, currency }\n } = action as { payload: SetupProductPayload };\n let configToAdd: ConfigState = {};\n let productFrequencies: ConfigState['productFrequencies'] = product.variants?.reduce(\n (acc, variant) => reduceSellingPlansToFrequencies(acc, variant, product.selling_plan_groups, state),\n {}\n );\n\n let updatedProductFrequencies = {\n ...state.productFrequencies,\n ...productFrequencies\n };\n\n configToAdd = {\n ...configToAdd,\n productFrequencies: updatedProductFrequencies,\n // populate the old frequency fields for backwards compatibility\n // these are only needed if someone was reading our config state directly, which shouldn't be common but is possible\n ...Object.values(updatedProductFrequencies)[0]\n };\n\n // prepaid selling plans\n const prepaidSellingPlans = getPrepaidSellingPlans(product);\n if (Object.keys(prepaidSellingPlans).length) {\n configToAdd = {\n ...configToAdd,\n prepaidSellingPlans: { ...state.prepaidSellingPlans, ...prepaidSellingPlans }\n };\n }\n return {\n ...state,\n ...configToAdd,\n storeCurrency: currency\n };\n }\n\n if (constants.RECEIVE_OFFER === action.type) {\n const {\n payload: { offer: offerEl }\n } = action as { payload: ReceiveOfferPayload };\n const { defaultFrequency, product } = offerEl || {};\n const { prepaidSellingPlans = {} } = state;\n\n // productFrequencies does not have entries for the cart ID\n // eligible frequencies apply to cart entries for the product\n const productId = safeProductId(product?.id);\n const currentProductFrequencies = state.productFrequencies[productId];\n\n let updatedProductFrequencies: ConfigState['productFrequencies'] = {\n ...state.productFrequencies,\n [productId]: {\n ...currentProductFrequencies,\n defaultFrequency: getUpdatedDefaultFrequency(\n productId,\n defaultFrequency,\n prepaidSellingPlans,\n currentProductFrequencies?.frequencies,\n currentProductFrequencies?.frequenciesEveryPeriod\n )\n }\n };\n\n return {\n ...state,\n productFrequencies: updatedProductFrequencies,\n // populate the old frequency fields for backwards compatibility\n ...Object.values(updatedProductFrequencies)[0]\n };\n }\n\n if (constants.RECEIVE_MERCHANT_SETTINGS === action.type) {\n return {\n ...state,\n merchantSettings: {\n ...(action.payload as ReceiveMerchantSettingsPayload)\n }\n };\n }\n\n return state;\n};\n\nfunction getFrequencies(\n productSellingPlanGroups: ShopifySellingPlanGroupsEntity[],\n state: { defaultFrequency?: string }\n) {\n const sellingPlanGroup = getPayAsYouGoSellingPlanGroup(productSellingPlanGroups);\n const frequencies = sellingPlansToFrequencies(sellingPlanGroup);\n if (frequencies?.length) {\n const frequenciesEveryPeriod = sellingPlansToEveryPeriod(sellingPlanGroup);\n const frequenciesText = sellingPlanGroup.options?.[0]?.values || frequencies;\n let defaultFrequency = state?.defaultFrequency;\n\n if (defaultFrequency && isOgFrequency(defaultFrequency)) {\n defaultFrequency =\n mapFrequencyToSellingPlan(frequencies, frequenciesEveryPeriod, defaultFrequency) ||\n getFirstSellingPlan(frequencies) ||\n defaultFrequency;\n }\n return {\n frequencies,\n frequenciesEveryPeriod,\n frequenciesText,\n ...(defaultFrequency ? { defaultFrequency } : {})\n };\n }\n return null;\n}\n\nfunction reduceSellingPlansToFrequencies(\n acc: ConfigState['productFrequencies'],\n variant: ShopifyVariantsEntity,\n sellingPlanGroups: ShopifySellingPlanGroupsEntity[],\n state: ConfigState\n) {\n const sellingPlanGroupIdsForProduct = variant.selling_plan_allocations.map(\n allocation => allocation.selling_plan_group_id\n );\n const applicableSellingPlanGroups = sellingPlanGroups.filter(group =>\n sellingPlanGroupIdsForProduct.includes(group.id)\n );\n const frequencies = getFrequencies(applicableSellingPlanGroups, state.productFrequencies[variant.id]);\n if (frequencies) {\n acc[variant.id] = frequencies;\n }\n return acc;\n}\n\nfunction getUpdatedDefaultFrequency(\n productId: string,\n offerElementDefaultFrequency: string,\n prepaidSellingPlans: ConfigState['prepaidSellingPlans'],\n frequencies: string[] | undefined = [],\n frequenciesEveryPeriod: string[] | undefined = []\n) {\n // We don't want to be setting the default frequency to a prepaid selling plan\n if (prepaidSellingPlans[productId]?.some(({ sellingPlan }) => sellingPlan === offerElementDefaultFrequency)) {\n return getFirstSellingPlan(frequencies) || offerElementDefaultFrequency;\n }\n\n if (!isOgFrequency(offerElementDefaultFrequency)) {\n return offerElementDefaultFrequency;\n }\n\n return (\n mapFrequencyToSellingPlan(frequencies, frequenciesEveryPeriod, offerElementDefaultFrequency) ||\n getFirstSellingPlan(frequencies) ||\n offerElementDefaultFrequency\n );\n}\n\nexport function getPrepaidSellingPlans(\n product: ShopifyProductEntity\n): Record<string, { numberShipments: number; sellingPlan: string }[]> {\n const prepaidSellingPlanGroups = product?.selling_plan_groups.filter(group => /^Prepaid-.*/.test(group.name));\n if (!prepaidSellingPlanGroups.length) {\n return {};\n }\n\n return prepaidSellingPlanGroups.reduce((acc, cur) => {\n const variant = cur.name.split('-')[1];\n\n const sellingPlanInfo = cur.selling_plans.map(sellingPlanObject => {\n return {\n numberShipments: getPrepaidShipments(sellingPlanObject),\n sellingPlan: String(sellingPlanObject.id)\n };\n });\n\n return { ...acc, [variant]: sellingPlanInfo };\n }, {});\n}\n\nexport default config;\n", "import { combineReducers } from 'redux';\nimport * as constants from '../core/constants';\n\nimport baseReducer, {\n autoshipByDefault,\n auth,\n authUrl,\n benefitMessages,\n defaultFrequencies,\n eligibilityGroups,\n environment,\n firstOrderPlaceDate,\n incentives,\n locale,\n merchantId,\n nextUpcomingOrder,\n optedin as coreOptedin,\n optedout,\n offerId,\n previewStandardOffer,\n previewUpsellOffer,\n productToSubscribe,\n sessionId,\n templates,\n prepaidShipmentsSelected\n} from '../core/reducer';\nimport {\n getFirstSellingPlan,\n hasShopifySellingPlans,\n isOgFrequency,\n mapFrequencyToSellingPlan,\n safeProductId,\n getMatchingProductIfExists\n} from '../core/utils';\nimport type {\n AutoshipEligibleState,\n OfferElement,\n OptedInState,\n OptInItem,\n PriceState,\n ReceiveOfferPayload,\n SetupProductPayload\n} from '../core/types/reducer';\n\nimport { sellingPlanAllocationsReducer, getSellingPlans } from './reducers/productPlans';\nimport config, { getPrepaidSellingPlans } from './reducers/config';\nimport { experimentsReducer } from '../core/experiments';\nimport {\n getPayAsYouGoSellingPlanGroup,\n getPayAsYouGoSellingPlanGroups,\n sellingPlansToEveryPeriod,\n sellingPlansToFrequencies,\n getPrepaidShipments,\n getDefaultPrepaidOption\n} from './utils';\nimport { EmptyObject } from '../core/types/utility';\nimport { ELIGIBILITY_GROUPS } from '../core/constants';\n\nconst overrideLineKey = (state, productId, newValue) => {\n const keys = Object.keys(state).filter(it => it.startsWith(productId.toString()));\n if (keys.length) {\n return { ...state, ...keys.reduce((acc, cur) => ({ ...acc, [cur]: newValue }), {}) };\n }\n return state;\n};\n\nexport const getDefaultSellingPlan = (\n sellingPlans: string[],\n frequenciesEveryPeriod: string[],\n defaultFrequency: string | undefined\n) => {\n if (!defaultFrequency) {\n return null;\n }\n\n if (!isOgFrequency(defaultFrequency)) {\n return defaultFrequency;\n }\n\n if (hasShopifySellingPlans(sellingPlans, frequenciesEveryPeriod)) {\n const sellingPlan = mapFrequencyToSellingPlan(sellingPlans, frequenciesEveryPeriod, defaultFrequency);\n\n if (sellingPlan) {\n return sellingPlan;\n }\n\n return getFirstSellingPlan(sellingPlans);\n }\n\n return defaultFrequency;\n};\n\nexport const mapExistingOptinsFromOfferResponse = (\n state: OptedInState,\n offerEl: OfferElement | EmptyObject,\n frequencyConfig: ReceiveOfferPayload['frequencyConfig']\n) =>\n state.map(it => {\n if (isOgFrequency(it?.frequency)) {\n return {\n ...it,\n frequency: hasShopifySellingPlans(frequencyConfig?.frequencies, frequencyConfig?.frequenciesEveryPeriod)\n ? mapFrequencyToSellingPlan(\n frequencyConfig?.frequencies,\n frequencyConfig?.frequenciesEveryPeriod,\n it.frequency\n ) ||\n mapFrequencyToSellingPlan(\n frequencyConfig?.frequencies,\n frequencyConfig?.frequenciesEveryPeriod,\n offerEl?.defaultFrequency\n ) ||\n getFirstSellingPlan(frequencyConfig?.frequencies)\n : it.frequency\n };\n }\n\n return it;\n });\n\nexport const reduceNewOptinsFromOfferResponse = (\n {\n autoship = {},\n autoship_by_default = {},\n default_frequencies = {},\n in_stock = {},\n eligibility_groups = {}\n }: ReceiveOfferPayload,\n existingOptins: OptedInState,\n offerEl: OfferElement | EmptyObject,\n frequencyConfig: ReceiveOfferPayload['frequencyConfig'],\n prepaidSellingPlans: ReceiveOfferPayload['prepaidSellingPlans']\n) =>\n Object.keys(autoship).reduce((acc, id) => {\n // if the user is not opted in and the product is set to default to subscription\n if (!existingOptins.some(it => it.id === id) && autoship_by_default[id] && in_stock[id]) {\n if (autoship[id]) {\n return acc.concat({\n id,\n frequency: getOptInDefaultFrequency({\n frequencyConfig,\n offerEl,\n default_frequencies,\n id\n })\n });\n } else if (eligibility_groups[id]?.includes(ELIGIBILITY_GROUPS.PREPAID)) {\n // if the product is prepaid eligible but not subscription eligible, opt them into a prepaid subscription\n const prepaidPlan = prepaidSellingPlans ? getDefaultPrepaidOption(prepaidSellingPlans) : null;\n return acc.concat({\n id,\n // we might not have a prepaid plan yet if the Shopify product request hasn't completed (SETUP_PRODUCT)\n frequency: prepaidPlan?.sellingPlan || PREPAID_PLACEHOLDER,\n prepaidShipments: prepaidPlan?.numberShipments || null\n });\n }\n }\n\n return acc;\n }, []);\n\nconst getOptInDefaultFrequency = ({\n frequencyConfig,\n offerEl,\n default_frequencies,\n id\n}: {\n frequencyConfig: ReceiveOfferPayload['frequencyConfig'];\n offerEl: OfferElement | EmptyObject;\n default_frequencies: ReceiveOfferPayload['default_frequencies'];\n id: string;\n}) => {\n const { frequencies: sellingPlans, frequenciesEveryPeriod } = frequencyConfig;\n const { defaultFrequency } = offerEl || {};\n const psdf = default_frequencies[id];\n let frequency;\n\n if (default_frequencies[id] && hasShopifySellingPlans(sellingPlans, frequenciesEveryPeriod)) {\n frequency =\n mapFrequencyToSellingPlan(sellingPlans, frequenciesEveryPeriod, `${psdf.every}_${psdf.every_period}`) ||\n getDefaultSellingPlan(sellingPlans, frequenciesEveryPeriod, defaultFrequency) ||\n getFirstSellingPlan(sellingPlans);\n } else if (default_frequencies[id]) {\n frequency = `${psdf.every}_${psdf.every_period}`;\n } else {\n frequency = getDefaultSellingPlan(sellingPlans, frequenciesEveryPeriod, defaultFrequency) || '_'; // Placeholder to be backfilled in SETUP_PRODUCT reducer\n }\n\n return frequency;\n};\n\nconst productOrVariantInStockReducer = (acc, cur) => ({\n ...overrideLineKey(acc, cur.id, cur.available),\n [cur.id]: cur.available\n});\n\nconst reduceProductCartLine = (acc, cur) => {\n const productId = safeProductId(cur.key);\n return { ...acc, [cur.key]: acc[productId] || null };\n};\n\nexport const autoshipEligible = (state: AutoshipEligibleState = {}, action): AutoshipEligibleState => {\n if (constants.SETUP_CART === action.type) {\n const { payload: cart } = action;\n return cart.items.reduce(reduceProductCartLine, state);\n }\n if (constants.SETUP_PRODUCT === action.type) {\n const {\n payload: { product }\n } = action as { payload: SetupProductPayload };\n const applicableSellingPlanGroups = getPayAsYouGoSellingPlanGroups(product?.selling_plan_groups);\n\n const ogSellingPlanIds = new Set(\n applicableSellingPlanGroups.flatMap(group => group.selling_plans.map(sellingPlan => sellingPlan.id)) ?? []\n );\n\n return product.variants.reduce((acc, cur) => {\n const productSellingPlansFromOG =\n cur?.selling_plan_allocations?.filter(sellingPlan => ogSellingPlanIds.has(sellingPlan.selling_plan_id)) ?? [];\n // a product is autoship eligible if it has plans from the default or PSFL selling plan group\n // the presence of prepaid selling plans does not mean it is autoship eligible\n const isAutoshipEligible = productSellingPlansFromOG.length > 0;\n\n return {\n ...overrideLineKey(acc, cur.id, isAutoshipEligible),\n [cur.id]: isAutoshipEligible\n };\n }, state);\n }\n if (constants.SET_PREVIEW_STANDARD_OFFER === action.type) {\n if (action.payload.isPreview !== true) return state;\n return { ...state, ...{ [action.payload.productId]: true } };\n }\n return state;\n};\n\nexport const inStock = (state = {}, action) => {\n if (constants.SETUP_CART === action.type) {\n const cart = action.payload;\n\n return cart.items.reduce(reduceProductCartLine, state);\n }\n\n if (constants.SETUP_PRODUCT === action.type) {\n const {\n payload: { product }\n } = action as { payload: SetupProductPayload };\n // it's unclear whether this needs to check the base product object or could only check the variants\n // leaving for now to preserve backwards compatibility\n return [product, ...(product?.variants ?? [])]?.reduce(productOrVariantInStockReducer, state) || state;\n }\n // force offer to refresh when requesting a new one\n if (constants.REQUEST_OFFER === action.type && action.payload.product === null) {\n return { ...state };\n }\n if (constants.SET_PREVIEW_STANDARD_OFFER === action.type) {\n if (action.payload.isPreview !== true) return state;\n return { ...state, ...{ [action.payload.productId]: true } };\n }\n return state;\n};\n\nexport const offer = (state = {}, _action) => state;\n\nfunction getOptedInItem(cartItem) {\n const prepaidShipments = getPrepaidShipments(cartItem.selling_plan_allocation.selling_plan);\n const item: OptInItem = {\n id: cartItem.key,\n frequency: `${cartItem.selling_plan_allocation.selling_plan.id}`\n };\n if (prepaidShipments) {\n item.prepaidShipments = prepaidShipments;\n }\n return item;\n}\n\nconst PREPAID_PLACEHOLDER = 'prepaid-replace-me';\nexport const optedin = (state: OptedInState = [], action): OptedInState => {\n if (constants.SETUP_CART === action.type) {\n const cart = action.payload;\n return state\n .filter(it => !it.id.includes(':'))\n .concat(cart.items.reduce((acc, cur) => (cur.selling_plan_allocation ? [...acc, getOptedInItem(cur)] : acc), []));\n }\n\n if (constants.RECEIVE_OFFER === action.type) {\n const payload = action.payload as ReceiveOfferPayload;\n const { offer: offerEl = {}, frequencyConfig, prepaidSellingPlans } = payload;\n const existingOptins = mapExistingOptinsFromOfferResponse(state, offerEl, frequencyConfig);\n const newOptins = reduceNewOptinsFromOfferResponse(\n payload,\n existingOptins,\n offerEl,\n frequencyConfig,\n prepaidSellingPlans\n );\n\n return [...existingOptins, ...newOptins];\n }\n\n if (constants.SETUP_PRODUCT === action.type) {\n const { product } = action.payload;\n const sellingPlanGroup = getPayAsYouGoSellingPlanGroup(product?.selling_plan_groups);\n const prepaidSellingPlans = getPrepaidSellingPlans(product);\n const frequencies = sellingPlanGroup ? sellingPlansToFrequencies(sellingPlanGroup) : [];\n const frequenciesEveryPeriod = sellingPlanGroup ? sellingPlansToEveryPeriod(sellingPlanGroup) : [];\n\n return state\n .map(curr => {\n const prepaidSellingPlansForVariant = prepaidSellingPlans[curr.id];\n if (sellingPlanGroup && isOgFrequency(curr.frequency)) {\n return {\n ...curr,\n frequency:\n mapFrequencyToSellingPlan(frequencies, frequenciesEveryPeriod, curr.frequency) ||\n getFirstSellingPlan(frequencies)\n };\n } else if (curr.frequency === PREPAID_PLACEHOLDER && prepaidSellingPlansForVariant?.length > 0) {\n // if we opted the user into a prepaid plan on RECEIVE_OFFER and now have the actual selling plan information, update it\n const { sellingPlan, numberShipments } = getDefaultPrepaidOption(prepaidSellingPlansForVariant);\n return {\n ...curr,\n frequency: sellingPlan,\n prepaidShipments: numberShipments\n };\n }\n\n return curr;\n })\n .filter(i => i.frequency !== PREPAID_PLACEHOLDER); // remove any leftover placeholders\n }\n\n if (constants.PRODUCT_CHANGE_PREPAID_SHIPMENTS === action.type) {\n const { payload } = action;\n // core reducer sets prepaid shipments\n const newState = coreOptedin(state, action);\n // get the new frequency (selling plan) that matches the prepaid shipments\n const [oldone, rest] = getMatchingProductIfExists(newState, payload.product);\n return rest.concat({\n ...oldone,\n ...payload.product,\n frequency: payload.frequency\n });\n }\n\n return coreOptedin(state, action);\n};\n\nexport const price = (state: PriceState = {}, action): PriceState => {\n if (constants.SETUP_PRODUCT === action.type) {\n const {\n payload: { product }\n } = action as { payload: SetupProductPayload };\n return (\n product.variants?.reduce(\n (acc, cur) => ({\n ...acc,\n [cur.id]: { value: cur.price }\n }),\n state\n ) || state\n );\n }\n\n return state;\n};\n\nexport const productOffer = (state = {}, _action) => state;\n\nexport const productPlans = (state = {}, action) => {\n if (constants.SETUP_PRODUCT === action.type) {\n const {\n payload: { product, currency }\n } = action as { payload: SetupProductPayload };\n\n const sellingPlans = getSellingPlans(product);\n\n return (\n product.variants.reduce(\n (acc, cur) => ({\n ...acc,\n [cur.id]: cur.selling_plan_allocations?.reduce(\n (accumulator, current) => sellingPlanAllocationsReducer(accumulator, current, sellingPlans, currency),\n []\n )\n }),\n state\n ) || state\n );\n }\n if (constants.SETUP_CART === action.type) {\n const cart = action.payload;\n return (\n cart.items.reduce(\n (acc, cur) =>\n cur.selling_plan_allocation\n ? {\n ...acc,\n [cur.key]: sellingPlanAllocationsReducer([], cur.selling_plan_allocation, [], cart.currency)\n }\n : acc,\n state\n ) || state\n );\n }\n return state;\n};\n\nconst reducer = combineReducers({\n auth,\n authUrl,\n autoshipByDefault,\n autoshipEligible,\n config,\n defaultFrequencies,\n eligibilityGroups,\n environment,\n firstOrderPlaceDate,\n incentives,\n inStock,\n locale,\n merchantId,\n nextUpcomingOrder,\n offer,\n offerId,\n experiments: experimentsReducer,\n optedin,\n optedout,\n previewStandardOffer,\n previewUpsellOffer,\n price,\n productOffer,\n productPlans,\n productToSubscribe,\n sessionId,\n templates,\n prepaidShipmentsSelected,\n benefitMessages\n});\n\nexport default function shopifyReducer(state, action) {\n if (window.og && window.og.previewMode) return baseReducer(state, action);\n return reducer(state, action);\n}\n", "import memoize from 'lodash.memoize';\nimport { debounce } from 'throttle-debounce';\n\nimport {\n CART_PRODUCT_KEY_HAS_CHANGED,\n CART_UPDATED_EVENT,\n OPTIN_PRODUCT,\n OPTOUT_PRODUCT,\n PRODUCT_CHANGE_FREQUENCY,\n PRODUCT_CHANGE_PREPAID_SHIPMENTS,\n RECEIVE_OFFER,\n REQUEST_OFFER,\n SETUP_CART,\n SETUP_PRODUCT\n} from '../core/constants';\n\nimport { isShopifyDiscountFunctionInUseSelector, makeSubscribedSelector } from '../core/selectors';\nimport { getOrCreateHidden, safeProductId } from '../core/utils';\nimport { getTrackingKey } from './shopifyTrackingMiddleware';\nimport { ShopifyCart, ShopifyProductEntity } from './types/shopify';\nimport { SetupProductPayload, SetupCartPayload, OfferElement, State } from '../core/types/reducer';\nimport { type Store } from 'redux';\n\nconst SHOPIFY_ROOT = window.Shopify?.routes?.root || '/';\nconst CART_PAGE_URL = '/cart';\nconst CART_JS_URL = `${SHOPIFY_ROOT}cart.js`;\nconst CART_CHANGE_URL = `${SHOPIFY_ROOT}cart/change.js`;\nconst CART_UPDATE_URL = `${SHOPIFY_ROOT}cart/update.js`;\nconst PRODUCTS_URL = `${SHOPIFY_ROOT}products/`;\nconst OFFER_ATTRIBUTE_NAME = '__ordergroove_offer_id';\n\n/**\n * List of section DOM elements to update via section-rendering api https://shopify.dev/api/section-rendering\n */\nconst DEFAULT_SHOPIFY_CART_AJAX_SECTIONS =\n '[id^=\"shopify-section-\"][id$=__cart-items], [id^=\"shopify-section-\"][id$=\"__cart-footer\"],#cart-live-region-text,#cart-icon-bubble';\nconst makeSyncProductId = offer =>\n debounce(100, false, function (form) {\n const { id } = Object.fromEntries([...new FormData(form).entries()]);\n if (id) {\n offer.setAttribute('product', id);\n } else {\n offer.removeAttribute('product');\n }\n });\n\nasync function getCurrency() {\n const windowCurrency = window.Shopify?.currency?.active;\n if (windowCurrency) {\n return windowCurrency;\n }\n const cart = await getCart();\n return cart.currency;\n}\n\nexport async function setupPdp(store, offer) {\n const handle = guessProductHandle(offer);\n if (handle) {\n try {\n const [product, currency] = await Promise.all([getProduct(handle), getCurrency()]);\n const payload: SetupProductPayload = { product, offer, currency: currency };\n store.dispatch({ type: SETUP_PRODUCT, payload });\n } catch (err) {\n console.warn('OG: Unable to fetch product details for PDP', err);\n }\n }\n // try closest form (safer)\n let form = offer.closest('form');\n // sometimes template is so closest does not work\n // <div>\n // <og-offer ..>\n // </div>\n // <div>\n // <form action=\"/cart/add\"/>\n // </div>\n if (!form) {\n let ref = offer.parentElement;\n // look up parents element of offer that contains the form. This will fix eventually category offers.\n while (ref) {\n form = ref.querySelector('form[action$=\"/cart/add\"]');\n if (form) break;\n if (ref.tagName.toLowerCase() === 'body') break;\n ref = ref.parentElement;\n }\n }\n\n if (form) {\n // this code watches the cart form for changes, so that we can update the product ID on the offer when the variant changes\n const syncProductId = makeSyncProductId(offer);\n // watch the cart form for changes\n // note: changes to hidden inputs do not fire change events\n form.addEventListener('change', () => syncProductId(form));\n // watch for added/removed nodes anywhere in the cart form (including updates to text content)\n // also watch for changes to the \"value\" attribute, which will catch changes to hidden inputs\n const mo = new MutationObserver(e => {\n // if we're only looking at attribute changes\n if (e.every(it => it.type === 'attributes')) {\n // sync the product ID only if the \"id\" input changed - this happens when the product variant changes\n // for performance reasons, avoid reacting to every form attribute change\n if (e.some(it => (it.target as HTMLInputElement).name === 'id')) {\n syncProductId(form);\n }\n } else {\n syncProductId(form);\n }\n });\n mo.observe(form, { subtree: true, childList: true, attributes: true, attributeFilter: ['value'] });\n } else {\n console.info('no /cart/add form found for og-offer', offer);\n }\n}\n\nasync function getCart(): Promise<ShopifyCart> {\n return (await fetch(CART_JS_URL)).json();\n}\n\n/**\n * Attemps to guess the product handle o\n * @returns\n */\nexport function guessProductHandle(offer): string {\n return (\n [\n // Allow specify data-shopify-product-handle attribute offer level so it will work on category qv\n // <og-offer product=\"{{ card_product.selected_or_first_available_variant.id }}\"\n // data-shopify-product-handle=\"{{ card_product.handle }}\"\n // location=\"category\"></og-offer>\n () => offer?.dataset.shopifyProductHandle,\n () =>\n // Use the oembed to get the product handle\n (document\n .querySelector('[href$=\".oembed\"]')\n ?.getAttribute('href')\n ?.match(/\\/([^/]+)\\.oembed$/) || [])[1],\n\n () =>\n // Use the open graph og:type==product and og:url to get the product handle\n ((document.querySelector('meta[property=\"og:type\"][content=\"product\"]') &&\n document\n .querySelector('meta[property=\"og:url\"][content]')\n ?.getAttribute('content')\n ?.match(/\\/([^/]+)$/)) ||\n [])[1],\n\n () =>\n // use any json in the markup\n [...document.querySelectorAll('[type$=json]')]\n .map(it => JSON.parse(it.textContent || '{}'))\n .find(it => it.handle && it.price)?.handle\n ]\n // returns the first truthy and prevent call next functions\n .reduce((acc, cur) => acc || cur(), '')\n );\n}\n\nconst getProduct = memoize(async function (handle: string): Promise<ShopifyProductEntity> {\n return (await fetch(`${PRODUCTS_URL}${handle}.js`)).json();\n});\n\nasync function setupCart(store, offer) {\n const cart = await getCart();\n const { items } = cart;\n const cartPayload: SetupCartPayload = cart;\n store.dispatch({ type: SETUP_CART, payload: cartPayload });\n\n // some minicart templates does not contains line.key but contains line which corresponds to\n // the index on the cart items (Vedge)\n\n const productAsCartLine = Number(offer.product.id);\n if (productAsCartLine <= items.length) {\n offer.setAttribute('product', items[productAsCartLine - 1].key);\n }\n\n const products = await Promise.all(Array.from(new Set(items.map(({ handle }) => handle))).map(getProduct));\n products.forEach(product => {\n const payload: SetupProductPayload = { product, offer, currency: cart.currency };\n store.dispatch({ type: SETUP_PRODUCT, payload });\n });\n}\n\n/**\n * Synchronizes the optins/optouts using shopify cart ajax api\n *\n * @param action\n * @param store\n */\nexport async function synchronizeCartOptin(action: any, store: any) {\n const offerElement = action.payload.offer;\n const selling_plan = action.payload.frequency || getSubscribedFrequency(action.payload.product.id, store);\n const trackingEvent = getTrackingEvent(action);\n\n if (!offerElement?.isCart) {\n return;\n }\n\n try {\n // disable the interactions on the offer since we need to process its side-effects first.\n offerElement.style.pointerEvents = 'none';\n offerElement.style.opacity = '.7';\n\n const sectionsToUpdate = Array.from(document.querySelectorAll(DEFAULT_SHOPIFY_CART_AJAX_SECTIONS));\n\n const key = action.payload.product.id; // shopify cart.item.key\n const cart = await getCart();\n const offerIx = cart?.items?.findIndex(it => it.key === key); // cart.items[offerIx];\n const item = cart.items[offerIx];\n const qty = item.quantity;\n const productId = safeProductId(key);\n\n const offerIdAttribute = getOfferIdAttribute(store);\n const attributes = {\n ...Object.fromEntries([trackingEvent]),\n ...(offerIdAttribute ? { [OFFER_ATTRIBUTE_NAME]: offerIdAttribute } : {})\n };\n\n if (Object.keys(attributes).length > 0) {\n // update the cart attributes\n const updateRes = await fetch(CART_UPDATE_URL, {\n method: 'POST',\n credentials: 'same-origin',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n attributes\n })\n });\n\n if (updateRes.status !== 200) throw new Error('Cart attributes not updated');\n }\n\n const changeRes = await fetch(CART_CHANGE_URL, {\n method: 'POST',\n credentials: 'same-origin',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n id: key,\n quantity: qty,\n properties: item.properties,\n selling_plan: selling_plan || null,\n sections: sectionsToUpdate.map((el: HTMLElement) => el.id.replace(/^shopify-section-/, ''))\n })\n });\n\n if (changeRes.status !== 200) throw new Error('Cart not updated');\n\n const newCart: ShopifyCart = await changeRes.json();\n\n // If both carts have same length we can update the item.key\n // to the original offer element, at least provide\n // some graceful degradations if no sections nor cart page\n const newKey =\n cart.items.length === newCart.items.length\n ? newCart.items[offerIx].key\n : newCart.items.find(\n line =>\n line.quantity === qty &&\n // @ts-expect-error - existing issue flagged after enabling type checking; ignoring for now\n line.product_id === productId &&\n ((!selling_plan && !line.selling_plan_allocation) ||\n line?.selling_plan_allocation.selling_plan.id === selling_plan)\n )?.key;\n\n if (newKey) {\n store.dispatch({\n type: CART_PRODUCT_KEY_HAS_CHANGED,\n payload: {\n oldCartProductKey: key,\n newCartProductKey: newKey\n }\n });\n\n offerElement.setAttribute('product', newKey);\n }\n\n // dispatch SETUP_CART so offer does not flip the state\n const newCartPayload: SetupCartPayload = newCart;\n store.dispatch({ type: SETUP_CART, payload: newCartPayload });\n\n // Use a custom event to hook custom cart updates.\n const cartUpdateEvent = new CustomEvent(CART_UPDATED_EVENT, { bubbles: true, cancelable: true });\n offerElement.dispatchEvent(cartUpdateEvent);\n\n // Let client uses preventDefault if they want to skip default logic after event.\n if (cartUpdateEvent.defaultPrevented) return;\n\n const sections = newCart.sections;\n\n if (Object.values(sections).length) {\n sectionsToUpdate.forEach((sectionElement: HTMLElement) => {\n const sectionId = sectionElement.id.replace(/^shopify-section-/, '');\n if (!(sectionId in sections)) return;\n\n const sectionRawHtml = sections[sectionId];\n\n const el = new DOMParser()\n .parseFromString(sectionRawHtml.toString() || '', 'text/html')\n .getElementById(sectionElement.id);\n if (el) {\n sectionElement.innerHTML = el.innerHTML;\n }\n });\n } else if (window.location.pathname.startsWith(CART_PAGE_URL)) {\n // only do if we are on the cart page\n window.location.reload();\n }\n } catch (err) {\n console.log('OG Error updating cart', err);\n } finally {\n offerElement.style.pointerEvents = 'auto';\n offerElement.style.opacity = '1';\n }\n}\n\n/**\n * Returns a tracking event adhering to the below format:\n *\n * og__<ts in seconds>: \"<product_id>,<action>,<location>,<selling_plan optional>,<variation_id optional>\"\n *\n * Examples:\n *\n * - optin_product with selling plan ID 123 and variation ID 456:\n * og__165653130: \"optin_product,pdp,123,456\"\n *\n * - optin_product with no selling plan and variation ID 456:\n * og__165653137: \"optin_product,pdp,,456\"\n *\n * - optin_product with selling plan ID 123 and no variation ID:\n * og__165653139: \"optin_product,pdp,123,\"\n *\n * - optin_product with no selling plan and no variation ID:\n * og__165653141: \"optin_product,pdp,,\"\n *\n * - optout_product with variation id 456:\n * og__165653135: \"optout_product,pdp,,456\"\n *\n * - product_change_frequency with selling plan ID 123 and variation ID 456:\n * og__165653131: \"product_change_frequency,pdp,123,456\"\n *\n * @param action a Redux action\n * @return {Array} an array with positional values key, value\n */\nexport function getTrackingEvent(action): Array<string> {\n const product_id = action.payload.product.id;\n if (!product_id) return [];\n const key = getTrackingKey();\n const location = action.payload.offer?.location || '';\n const variation = action.payload.offer?.variationId || '';\n const value = [product_id, action.type.toLowerCase(), location];\n\n switch (action.type) {\n case REQUEST_OFFER:\n case OPTOUT_PRODUCT:\n value.push(''); // No selling plan should be associated with these actions\n value.push(variation);\n break;\n case OPTIN_PRODUCT:\n case PRODUCT_CHANGE_FREQUENCY:\n value.push(action.payload.frequency);\n value.push(variation);\n break;\n default:\n return []; // we dont track anything else\n }\n\n return [key, value.join(',')];\n}\n\nexport function getSubscribedFrequency(productId, store) {\n const subscribedSelector = makeSubscribedSelector({ id: productId });\n const optin = subscribedSelector(store.getState());\n const sellingPlanId = optin ? optin.frequency : undefined;\n return sellingPlanId;\n}\n\nfunction getOfferIdAttribute(store: Store<State>) {\n const state = store.getState();\n // if the Shopify Discount Function is being used, we need to pass along the offer ID as a cart attribute so the discount is calculated correctly\n if (isShopifyDiscountFunctionInUseSelector(state)) {\n return state.offerId;\n }\n return null;\n}\n\n/**\n * // update <input type=\"hidden\" name=\"selling_plan\"/> if available\n *\n * @param store\n */\nexport function synchronizeSellingPlan(store: any, offerElement?: OfferElement) {\n if (offerElement?.isCart) return; // hidden inputs are used when product page, not cart.\n if (!offerElement?.shouldEnableOffer) return; // do not set a selling plan if we're hiding the offer\n\n [...document.querySelectorAll('form[action$=\"/cart/add\"] [name=id]')].forEach((productIdInput: HTMLInputElement) => {\n const productId = productIdInput.value;\n\n const sellingPlanId = getSubscribedFrequency(productId, store);\n\n getOrCreateHidden(productIdInput.form, 'selling_plan', sellingPlanId);\n getOrCreateHidden(productIdInput.form, `attributes[og__session]`, store.getState().sessionId);\n\n const offerIdAttribute = getOfferIdAttribute(store);\n if (offerIdAttribute) {\n getOrCreateHidden(productIdInput.form, `attributes[${OFFER_ATTRIBUTE_NAME}]`, offerIdAttribute);\n }\n\n if (offerElement) {\n // use this to update the product attributes in future\n }\n });\n}\n\nexport default function shopifyMiddleware(store) {\n return next => action => {\n /**\n * This redux middleware will perform Shopify specific side-effects such as change\n * the product selling plan when offer is cart\n */\n switch (action.type) {\n case OPTIN_PRODUCT:\n case OPTOUT_PRODUCT:\n case PRODUCT_CHANGE_FREQUENCY:\n break;\n case REQUEST_OFFER:\n if (action.payload.offer?.isCart) {\n setupCart(store, action.payload.offer);\n } else {\n setupPdp(store, action.payload.offer);\n }\n break;\n default:\n }\n\n next(action);\n\n switch (action.type) {\n case OPTIN_PRODUCT:\n case OPTOUT_PRODUCT:\n case PRODUCT_CHANGE_FREQUENCY:\n case PRODUCT_CHANGE_PREPAID_SHIPMENTS:\n synchronizeCartOptin(action, store);\n // falls through\n case REQUEST_OFFER:\n case RECEIVE_OFFER:\n case SETUP_PRODUCT:\n synchronizeSellingPlan(store, action.payload.offer);\n break;\n default:\n }\n };\n}\n", "import { OPTIN_PRODUCT, OPTOUT_PRODUCT, PRODUCT_CHANGE_FREQUENCY, RECEIVE_OFFER } from '../core/constants';\nimport { getTrackingEvent, getSubscribedFrequency } from './shopifyMiddleware';\n\n/**\n * Creates or updates a hidden input used for tracking on non-cart pages\n *\n * @param product_id a product ID\n * @param name an input name, og_<timestamp in seconds>\n * @param value an input value, <tracking event>\n * @return {undefined}\n */\nexport function updateTrackingInputs(product_id: string, name: string, value: string) {\n const store2FormElementSelector = `[name=\"id\"][value=\"${product_id}\"]`;\n const store1FormElementSelector = `form[action=\"/cart/add\"] option[value=\"${product_id}\"]`;\n if (!name) return;\n let cartAddFormElements = document.querySelectorAll(store2FormElementSelector);\n if (!cartAddFormElements.length) {\n cartAddFormElements = document.querySelectorAll(store1FormElementSelector);\n }\n [...cartAddFormElements].forEach((cartAddFormElement: HTMLInputElement) => {\n const parent = cartAddFormElement.form;\n\n let input = parent?.querySelector(`[name=\"${name}\"]`) as HTMLInputElement;\n if (!input) {\n input = document.createElement('input');\n input.type = 'hidden';\n input.name = `attributes[${name}]`;\n parent?.appendChild(input);\n }\n input.value = value;\n });\n}\n\nexport function getTrackingKey() {\n return `og__${Math.ceil(new Date().getTime() / 1000)}`;\n}\n\nexport function addDefaultToSubTracking(action, store) {\n // check if default to sub\n const isDefaultToSub = action.payload.offer?.autoshipByDefault;\n if (!isDefaultToSub) return;\n\n // if default to sub, get tracking info\n const productId = action.payload.offer?.product.id;\n const key = getTrackingKey();\n const location = action.payload.offer?.location || '';\n const variation = action.payload.offer?.variationId || '';\n const frequency = getSubscribedFrequency(productId, store);\n const value = [productId, OPTIN_PRODUCT.toLowerCase(), location, frequency, variation];\n const inputValue = value.join(',');\n updateTrackingInputs(productId, key, inputValue);\n}\n\nexport default function shopifyTrackingMiddleware(store) {\n return next => action => {\n next(action);\n\n switch (action.type) {\n case OPTIN_PRODUCT:\n case OPTOUT_PRODUCT:\n case PRODUCT_CHANGE_FREQUENCY: {\n const offerElement = action.payload.offer;\n const trackingEvent = getTrackingEvent(action);\n\n if (offerElement && !offerElement.isCart) {\n updateTrackingInputs(offerElement.product.id, trackingEvent[0], trackingEvent[1]);\n }\n break;\n }\n case RECEIVE_OFFER:\n addDefaultToSubTracking(action, store);\n break;\n default:\n }\n };\n}\n", "import { authorize, unauthorized } from '../core/actions';\nimport { clearCookie, getCookieValue, getMainJs, resolveEnvAndMerchant } from '../core/utils';\n\nconst SHOPIFY_OG_AUTH_ENDPOINT = '/apps/subscriptions/auth/';\nconst SHOPIFY_OG_AUTH_BEGIN = 'og_auth_begin';\nconst SHOPIFY_OG_AUTH_END = 'og_auth_end';\n\ntype ShopifyOGAuth = {\n customerId: string;\n timestamp: number;\n signature: string;\n};\n\n/**\n * We tag shopify liquid this way.\n * window.ogShopifyConfig = {\n * {%- if customer -%}\n * customer: {\n * id: \"{{customer.id}}\",\n * email: \"{{customer.email}}\",\n * signature: \"{{signature}}\",\n * timestamp: \"{{timestamp}}\",\n * },\n * {%- else -%}\n * customer: null,\n * {%- endif -%}\n */\ntype OgShopifyConfigCustomer = {\n id: string;\n signature: string;\n timestamp: string;\n email?: string;\n};\n\ntype OgShopifyConfig = {\n customer?: OgShopifyConfigCustomer;\n};\n\n/**\n * We rely on window.ogShopifyConfig side of integration\n */\ndeclare global {\n interface Window {\n og: {\n previewMode: boolean;\n };\n ogShopifyConfig: OgShopifyConfig;\n Shopify?: {\n routes?: {\n root: string;\n };\n currency?: {\n active: string;\n rate: string;\n };\n };\n }\n}\n\nconst parseIntegrationTempAuth = (raw: string) => {\n const [id, timestamp, signature, email] = atob(raw).split('|');\n return {\n id,\n signature,\n timestamp,\n email\n } as OgShopifyConfigCustomer;\n};\n/**\n *\n * Markup needed for integration:\n * ```html\n * <script src=\"https://static.ordergroove.com/<merchant_id>/main.js\" {% if customer -%}\n * {%- assign secret_key = shop.metafields.accentuate.theme_hash_key -%}\n * {%- assign timestamp = \"now\" | date: \"%s\" -%}\n * {%- assign signature = customer.id | append: \"|\" | append: timestamp | hmac_sha256: secret_key -%}\n * data-customer=\"{{customer.id | append: \"|\" | append: timestamp | append: \"|\" | append: signature | append: \"|\" | append: customer.email | base64_encode }}\"\n * {%- endif %}></script>\n * ```\n */\nexport async function authorizeShopifyCustomer({ store }) {\n const [merchantId] = resolveEnvAndMerchant();\n const script = getMainJs();\n\n let customer = script?.dataset.customer\n ? parseIntegrationTempAuth(script.dataset.customer)\n : window.ogShopifyConfig?.customer;\n if (customer) {\n const val = await getOrCreateAuthCookie(customer);\n if (val) {\n const [sig_field, ts, sig] = val.split('|');\n store.dispatch(authorize(merchantId, sig_field, Number(ts), sig));\n }\n } else {\n clearCookie('og_auth');\n // after clearing the cookie, we need to make sure the store clears its own auth state\n store.dispatch(unauthorized('No customer found'));\n }\n}\n/**\n * Borrow from here https://github.com/ordergroove/shopify-app/blob/88becb621b29776a946ab0cd3ae215043e174626/server/lib/theme-partials/js/helpers/cookies.js#L18\n * @param customer\n * @returns\n */\nexport async function fetchOGSignature(customer: OgShopifyConfigCustomer) {\n try {\n const response = await fetch(\n `${SHOPIFY_OG_AUTH_ENDPOINT}?customer=${customer.id}&customer_signature=${customer.signature}&customer_timestamp=${customer.timestamp}`\n );\n const data = await response.text();\n const beginningIndex = data.lastIndexOf(SHOPIFY_OG_AUTH_BEGIN);\n\n if (beginningIndex < 0) throw 'Invalid response from OG auth endpoint';\n\n return JSON.parse(\n data.substring(beginningIndex + SHOPIFY_OG_AUTH_BEGIN.length, data.lastIndexOf(SHOPIFY_OG_AUTH_END))\n ) as ShopifyOGAuth;\n } catch (err) {\n console.error(err);\n }\n}\n/**\n * Original source https://github.com/ordergroove/shopify-app/blob/88becb621b29776a946ab0cd3ae215043e174626/server/lib/theme-partials/js/helpers/cookies.js#L56\n *\n * @param customer\n * @returns\n */\nexport async function getOrCreateAuthCookie(customer: OgShopifyConfigCustomer) {\n const ogAuthCookie = getCookieValue('og_auth');\n\n // The cookie hasn't expired yet so we don't need to refresh the auth\n if (ogAuthCookie) {\n return ogAuthCookie;\n }\n const { customerId, timestamp, signature } = await fetchOGSignature(customer);\n\n if (!customerId) return '';\n\n // set expiration to now + 2hrs\n const ogToday = new Date();\n const binarySignature = btoa(signature);\n ogToday.setTime(ogToday.getTime() + 2 * 60 * 60 * 1000);\n const value = `${customerId}|${timestamp}|${binarySignature}`;\n document.cookie = `og_auth=${value};expires=${ogToday.toUTCString()};secure;path=/`;\n return value;\n}\n"],
|
|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,GAAYrB,EAAO,UACnBsB,GAAetB,EAAO,aACtBuB,GAAgBvB,EAAO,cACvBwB,GAAWC,EAAA,IAAMC,GAAqB1B,CAAM,EAAjC,YAGxB,IAAO2B,GAAQC,EAAO,WA1CtBC,IAqDIA,GAAAC,IAAA,MAAAD,GAAU,uBACZE,GAAQ,IAAMC,GAAyBJ,CAAM,CAAC",
|
|
6
|
+
"names": ["throttle", "delay", "noTrailing", "callback", "debounceMode", "timeoutID", "cancelled", "lastExec", "clearExistingTimeout", "clearTimeout", "cancel", "undefined", "wrapper", "_len", "arguments_", "_key", "self", "elapsed", "Date", "now", "exec", "apply", "clear", "setTimeout", "__name", "debounce", "atBegin", "require_lodash", "__commonJSMin", "exports", "module", "FUNC_ERROR_TEXT", "HASH_UNDEFINED", "funcTag", "genTag", "reRegExpChar", "reIsHostCtor", "freeGlobal", "freeSelf", "root", "getValue", "object", "key", "__name", "isHostObject", "value", "result", "arrayProto", "funcProto", "objectProto", "coreJsData", "maskSrcKey", "uid", "funcToString", "hasOwnProperty", "objectToString", "reIsNative", "splice", "Map", "getNative", "nativeCreate", "Hash", "entries", "index", "length", "entry", "hashClear", "hashDelete", "hashGet", "data", "hashHas", "hashSet", "ListCache", "listCacheClear", "listCacheDelete", "assocIndexOf", "lastIndex", "listCacheGet", "listCacheHas", "listCacheSet", "MapCache", "mapCacheClear", "mapCacheDelete", "getMapData", "mapCacheGet", "mapCacheHas", "mapCacheSet", "array", "eq", "baseIsNative", "isObject", "isMasked", "pattern", "isFunction", "toSource", "map", "isKeyable", "type", "func", "memoize", "resolver", "memoized", "args", "cache", "other", "tag", "require_murmurhash3_gc", "__commonJSMin", "exports", "module", "murmurhash3_32_gc", "key", "seed", "remainder", "bytes", "h1", "h1b", "c1", "c1b", "c2", "c2b", "k1", "i", "__name", "require_murmurhash2_gc", "__commonJSMin", "exports", "module", "murmurhash2_32_gc", "str", "seed", "l", "h", "k", "__name", "require_murmurhash_js", "__commonJSMin", "exports", "module", "murmur3", "murmur2", "require_token_type", "__commonJSMin", "exports", "module", "TokenType", "require_tokenizer", "__commonJSMin", "exports", "module", "TokenType", "Tokenizer", "__name", "exp", "literal", "tokens", "char", "code", "require_polish", "__commonJSMin", "exports", "module", "TokenType", "PolishNotation", "__name", "tokens", "queue", "stack", "token", "PolishGenerator", "polish", "index", "require_node", "__commonJSMin", "exports", "module", "TokenType", "ExpNode", "op", "left", "right", "literal", "exp", "lit", "__name", "make", "gen", "data", "nodeEvaluator", "tree", "literalEvaluator", "require_logical_expression_parser", "__commonJSMin", "exports", "module", "Tokenizer", "Polish", "Node", "parse", "__name", "exp", "literalChecker", "tokens", "polish", "gen", "tree", "src_exports", "__export", "addOptinChangedCallback", "addTemplate", "autoInit", "clear", "config", "src_default", "disableOptinChangedCallbacks", "getOptins", "getProductsForPurchasePost", "initialize", "isReady", "offers", "platform_default", "previewMode", "register", "resolveSettings", "setAuthUrl", "setBenefitMessages", "setEnvironment", "setLocale", "setMerchantId", "setPublicPath", "setTemplates", "setupCart", "setupProduct", "setupProducts", "store", "symbolObservablePonyfill", "root", "result", "Symbol", "__name", "root", "result", "symbolObservablePonyfill", "es_default", "randomString", "__name", "ActionTypes", "isPlainObject", "obj", "proto", "createStore", "reducer", "preloadedState", "enhancer", "_ref2", "currentReducer", "currentState", "currentListeners", "nextListeners", "isDispatching", "ensureCanMutateNextListeners", "getState", "subscribe", "listener", "isSubscribed", "index", "dispatch", "action", "listeners", "i", "replaceReducer", "nextReducer", "observable", "_ref", "outerSubscribe", "observer", "observeState", "unsubscribe", "es_default", "getUndefinedStateErrorMessage", "key", "action", "actionType", "actionDescription", "__name", "assertReducerShape", "reducers", "key", "reducer", "initialState", "ActionTypes", "__name", "combineReducers", "reducerKeys", "finalReducers", "i", "finalReducerKeys", "unexpectedKeyCache", "shapeAssertionError", "e", "state", "action", "warningMessage", "hasChanged", "nextState", "_i", "_key", "previousStateForKey", "nextStateForKey", "errorMessage", "getUndefinedStateErrorMessage", "bindActionCreator", "actionCreator", "dispatch", "bindActionCreators", "actionCreators", "boundActionCreators", "_defineProperty", "obj", "value", "ownKeys", "object", "enumerableOnly", "keys", "sym", "_objectSpread2", "target", "source", "compose", "_len", "funcs", "arg", "a", "b", "applyMiddleware", "middlewares", "createStore", "store", "_dispatch", "middlewareAPI", "chain", "middleware", "createThunkMiddleware", "extraArgument", "middleware", "__name", "_ref", "dispatch", "getState", "next", "action", "thunk", "es_default", "import_throttle_debounce", "ogAuthRegExp", "readAuthCookie", "__name", "_ogAuthRegExp", "it", "parseAuth", "authCookie", "parts", "iframeLoad", "auth_url", "resolve", "reject", "iframe", "isJsonResponse", "response", "_readStaticAuth", "_delayedReadStaticAuth", "ms", "res", "resolveAuth", "_readAuthCookie", "_iframeLoad", "auth", "OPTIN_PRODUCT", "OPTOUT_PRODUCT", "PRODUCT_CHANGE_FREQUENCY", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "SET_MERCHANT_ID", "REQUEST_OFFER", "RECEIVE_OFFER", "PRODUCT_HAS_CHANGED", "CREATED_SESSION_ID", "SET_AUTH_URL", "REQUEST_AUTH", "AUTHORIZE", "UNAUTHORIZED", "REQUEST_ORDERS", "RECEIVE_ORDERS", "CART_PRODUCT_KEY_HAS_CHANGED", "RECEIVE_ORDER_ITEMS", "FETCH_RESPONSE_ERROR", "SET_ENVIRONMENT_LOCAL", "SET_ENVIRONMENT_STAGING", "SET_ENVIRONMENT_DEV", "SET_ENVIRONMENT_PROD", "READY", "CONCLUDE_UPSELL", "REQUEST_CREATE_IU_ORDER", "CREATE_ONE_TIME", "REQUEST_CONVERT_ONE_TIME", "CONVERT_ONE_TIME", "CHECKOUT", "RECEIVE_FETCH", "SET_LOCALE", "SET_CONFIG", "SET_BENEFIT_MESSAGES", "SET_PREVIEW_STANDARD_OFFER", "SET_PREVIEW_UPSELL_OFFER", "SET_PREVIEW_PREPAID_OFFER", "ADD_TEMPLATE", "SET_TEMPLATES", "LOCAL_STORAGE_CHANGE", "LOCAL_STORAGE_CLEAR", "SET_FIRST_ORDER_PLACE_DATE", "SET_PRODUCT_TO_SUBSCRIBE", "RECEIVE_PRODUCT_PLANS", "SETUP_PRODUCT", "SETUP_CART", "RECEIVE_MERCHANT_SETTINGS", "SET_EXPERIMENT_VARIANT", "DEFAULT_OFFER_MODULE", "ENV_LOCAL", "ENV_DEV", "ENV_STAGING", "ENV_PROD", "STATIC_HOST", "STAGING_STATIC_HOST", "INCENTIVE_STANDARD_TYPES", "ELIGIBILITY_GROUPS", "CART_UPDATED_EVENT", "import_lodash", "memoizeKey", "__name", "args", "withFetchJson", "cb", "res", "withHost", "host", "extra", "path", "options", "withAuth", "auth", "withJsonBody", "toQuery", "params", "key", "val", "toProductId", "product", "it", "fetchOffer", "memoize", "merchantId", "sessionId", "module", "searchParams", "query", "fetchOrders", "status", "ordering", "fetchItems", "orderId", "createOneTime", "order", "quantity", "offer", "parseFrequency", "raw", "every", "every_period", "n", "isFrequencyValid", "compareFrequencies", "a", "b", "parseFrequenciesList", "value", "stringifyFrequency", "__name", "ref", "every", "period", "every_period", "convertOneTimeToSubscription", "withFetchJson", "withHost", "withAuth", "withJsonBody", "item", "frequency", "offer", "sessionId", "parsedFrequency", "parseFrequency", "api", "fetchOffer", "fetchOrders", "fetchItems", "createOneTime", "api_default", "script", "getMainJs", "platform_default", "defaultEqualityCheck", "a", "b", "__name", "areArgumentsShallowlyEqual", "equalityCheck", "prev", "next", "length", "defaultMemoize", "func", "lastArgs", "lastResult", "getDependencies", "funcs", "dependencies", "dep", "dependencyTypes", "createSelectorCreator", "memoize", "_len", "memoizeOptions", "_key", "_len2", "_key2", "recomputations", "resultFunc", "memoizedResultFunc", "selector", "params", "i", "createSelector", "import_lodash", "money", "__name", "val", "currency", "percentage", "DEFAULT_PAY_AS_YOU_GO_GROUP_NAME", "EXPERIMENT_SHOPIFY_APP_ID_PREFIX", "getPayAsYouGoSellingPlanGroup", "sellingPlanGroups", "isProductSpecificFrequencySellingPlanGroup", "isDefaultSellingPlanGroup", "isExperimentSellingPlanGroup", "getPayAsYouGoSellingPlanGroups", "group", "_a", "getPayAsYouGoSellingPlan", "sellingPlans", "plan", "sellingPlansToFrequencies", "sellingPlanGroup", "id", "sellingPlansToEveryPeriod", "options", "value", "textToFreq", "text", "period", "it", "every", "getPrepaidShipments", "sellingPlan", "shipments", "name", "getDefaultPrepaidOption", "memoize", "arraysEqual", "a", "b", "i", "__name", "resolveFrequency", "sellingPlans", "frequenciesEveryPeriod", "frequency", "ogFrequency", "stringifyFrequency", "platform_default", "mapFrequencyToSellingPlan", "isSameProduct", "optedinSelector", "state", "optedoutSelector", "autoshipSelector", "defaultFrequenciesSelector", "prepaidSellingPlansSelector", "_a", "prepaidShipmentsSelectedSelector", "makeOptedinSelector", "product", "createSelector", "optedin", "optedout", "autoshipByDefault", "entry", "makeSubscribedSelector", "makePrepaidSubscribedSelector", "makePrepaidShipmentsSelectedSelector", "prepaidShipmentsSelected", "makeOptedoutSelector", "makeProductFrequencyOptedInSelector", "productOptin", "makeProductPrepaidShipmentsOptedInSelector", "makeProductPrepaidShipmentOptionsSelector", "productId", "prepaidSellingPlans", "safeProductId", "numberShipments", "makeProductSpecificDefaultFrequencySelector", "makeProductFrequenciesSelector", "defaultFrequencies", "makeProductFrequencyOptionsSelector", "productFrequencies", "makeProductDefaultFrequencySelector", "oldFrequencies", "oldFrequenciesEveryPeriod", "oldFrequenciesText", "oldDefaultFrequency", "makeFrequencyForPrepaidShipmentsSelector", "prepaidShipments", "frequencies", "plan", "p", "makePrepaidSellingPlansSelector", "makeDiscountedProductPriceSelector", "prices", "incentives", "currency", "productPriceObj", "productPrice", "regularPrice", "subscriptionPrice", "productIncentives", "incentive", "findRelevantIncentive", "formatted_discount", "percentage", "money", "validIncentiveStandards", "INCENTIVE_STANDARD_TYPES", "kebabCase", "string", "getFallbackValue", "element", "key", "defaultValue", "templatesSelector", "isShopifyDiscountFunctionInUseSelector", "plans", "resolveLocaleMessage", "localeMap", "enUS", "browserLocale", "langPrefix", "partialMatch", "msg", "makeBenefitMessagesSelector", "benefitMap", "isPreview", "seenIds", "seenMessages", "list", "id", "onReady", "fn", "__name", "getMainJs", "STATIC_HOST", "STAGING_STATIC_HOST", "resolveEnvAndMerchant", "script", "url", "env", "ENV_STAGING", "ENV_PROD", "merchantId", "safeProductId", "product", "_a", "productId", "platform_default", "safeOgFrequency", "initialFrequency", "frequencies", "frequenciesEveryPeriod", "ix", "frequencyToSellingPlan", "ogFrequency", "frequencyConfig", "autoInitializeOffers", "offers", "clearCookie", "cookieId", "getCookieValue", "cookie", "isOgFrequency", "frequency", "getFirstSellingPlan", "hasShopifySellingPlans", "sellingPlans", "mapFrequencyToSellingPlan", "index", "it", "getOrCreateHidden", "parent", "name", "value", "input", "getMatchingProductIfExists", "state", "oldone", "rest", "acc", "val", "isSameProduct", "optinProduct", "__name", "product", "frequency", "offer", "OPTIN_PRODUCT", "optoutProduct", "OPTOUT_PRODUCT", "productHasChangedComponents", "newProduct", "PRODUCT_HAS_CHANGED", "productChangeFrequency", "PRODUCT_CHANGE_FREQUENCY", "productChangePrepaidShipments", "prepaidShipments", "dispatch", "getState", "makeFrequencyForPrepaidShipmentsSelector", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "concludeUpsell", "__name", "product", "CONCLUDE_UPSELL", "setMerchantId", "merchantId", "SET_MERCHANT_ID", "createSessionId", "CREATED_SESSION_ID", "requestAuth", "payload", "REQUEST_AUTH", "authorize", "sigfield", "ts", "sig", "AUTHORIZE", "unauthorized", "reason", "UNAUTHORIZED", "setAuthUrl", "url", "SET_AUTH_URL", "fetchDone", "initiator", "RECEIVE_FETCH", "fetchAuth", "authResolver", "u", "dispatch", "getState", "authUrl", "requestAction", "sig_field", "err", "requestOrders", "status", "ordering", "REQUEST_ORDERS", "receiveOrders", "response", "RECEIVE_ORDERS", "receiveItems", "RECEIVE_ORDER_ITEMS", "fetchOrders", "legoUrl", "auth", "api", "nextOrderId", "res", "setEnvironment", "env", "ENV_LOCAL", "SET_ENVIRONMENT_LOCAL", "ENV_DEV", "SET_ENVIRONMENT_DEV", "ENV_STAGING", "SET_ENVIRONMENT_STAGING", "ENV_PROD", "SET_ENVIRONMENT_PROD", "requestSessionId", "sessionId", "receiveOffer", "offer", "productId", "state", "frequencyConfig", "makeProductFrequenciesSelector", "prepaidSellingPlans", "makePrepaidSellingPlansSelector", "RECEIVE_OFFER", "fetchResponseError", "FETCH_RESPONSE_ERROR", "requestOffer", "module", "DEFAULT_OFFER_MODULE", "REQUEST_OFFER", "fetchOffer", "checkout", "CHECKOUT", "requestCreateOneTime", "order", "quantity", "offerId", "REQUEST_CREATE_IU_ORDER", "receiveCreateOneTime", "CREATE_ONE_TIME", "requestConvertOneTimeToSubscription", "item", "frequency", "REQUEST_CONVERT_ONE_TIME", "receiveConvertOneTime", "CONVERT_ONE_TIME", "createIu", "subscribed", "initialFrequency", "previewUpsellOffer", "frequencies", "frequenciesEveryPeriod", "safeOgFrequency", "setLocale", "SET_LOCALE", "setConfig", "SET_CONFIG", "setBenefitMessages", "SET_BENEFIT_MESSAGES", "addTemplate", "selector", "markup", "config", "ADD_TEMPLATE", "setTemplates", "templates", "SET_TEMPLATES", "setFirstOrderPlaceDate", "firstOrderPlaceDate", "SET_FIRST_ORDER_PLACE_DATE", "setProductToSubscribe", "productToSubscribe", "SET_PRODUCT_TO_SUBSCRIBE", "receiveMerchantSettings", "settings", "RECEIVE_MERCHANT_SETTINGS", "STORE_ROOT", "safeParseState", "__name", "serializedState", "isPreviewMode", "loadState", "serializeState", "state", "saveState", "listenLocalStorageChanges", "store", "ev", "key", "newValue", "LOCAL_STORAGE_CLEAR", "requestSessionId", "LOCAL_STORAGE_CHANGE", "import_throttle_debounce", "dispatchEvent", "__name", "name", "detail", "el", "dispatchOptinChangedEvent", "optedIn", "productId", "components", "conditionals", "type", "OPTIN_PRODUCT", "PRODUCT_CHANGE_FREQUENCY", "OPTOUT_PRODUCT", "dispatchMiddleware", "store", "next", "action", "state", "conditional", "expression", "offerEvents", "_store", "_a", "ev", "RECEIVE_OFFER", "localStorageMiddleware", "callToSave", "saveState", "LOCAL_STORAGE_CHANGE", "waitFor", "__name", "resolve", "reject", "yes", "no", "waitUntilOffersReady", "store", "waitForSetEnv", "resolveEnv", "waitForMerchantId", "resolveMerchantId", "waitForSessionId", "resolveSessionId", "merchantId", "sessionId", "createSessionId", "waitForReady", "_a", "READY", "listenLocalStorageChanges", "fetchAuth", "next", "action", "SET_ENVIRONMENT_LOCAL", "SET_ENVIRONMENT_DEV", "SET_ENVIRONMENT_STAGING", "SET_ENVIRONMENT_PROD", "SET_MERCHANT_ID", "CREATED_SESSION_ID", "offerRequestMiddleware", "store", "next", "action", "REQUEST_OFFER", "merchantId", "sessionId", "apiUrl", "productId", "safeProductId", "api_default", "DEFAULT_OFFER_MODULE", "response", "receiveOffer", "err", "fetchResponseError", "fetchDone", "__name", "import_murmurhash_js", "getVariantIx", "key", "variants", "variant", "b", "n", "murmur", "lower_bound", "i", "v", "upper_bound", "__name", "experimentsReducer", "state", "action", "_a", "RECEIVE_MERCHANT_SETTINGS", "SET_EXPERIMENT_VARIANT", "resolveShopifySetupProductWhenExperiment", "product", "experimentSettings", "sellingPlanGroups", "isExperimentSellingPlanGroup", "sellingPlanGroup", "app_id", "selling_plan_allocations", "it", "selling_plan_group_id", "getAssignedExperimentVariant", "sessionId", "experimentPublicId", "index", "experimentsMiddleware", "store", "waitForReady", "resolveReady", "waitFor", "next", "READY", "REQUEST_OFFER", "SETUP_PRODUCT", "newProduct", "makeStore", "reducer", "extraMiddlewares", "isPreviewMode", "composeEnhancers", "compose", "middlewares", "waitUntilOffersReady", "es_default", "experimentsMiddleware", "offerRequestMiddleware", "dispatchMiddleware", "offerEvents", "initial", "loadState", "localStorageMiddleware", "enhancer", "applyMiddleware", "it", "store", "createStore", "__name", "createIsMessageAllowed", "__name", "allowedOrigin", "ev", "createBroadcastMessage", "opener", "ogType", "data", "target", "offersLiveEditor", "og", "handleReady", "isMessageAllowed", "broadcastMessage", "options", "publicPath", "initializeClient", "storeInstance", "defaultMapDispatchToProps", "__name", "dispatch", "resolveStore", "_obj", "createRecalcProps", "mapStateToProps", "mapDispatchToProps", "obj", "getState", "stateProps", "dispatchProps", "connect", "baseElement", "recalcProps", "bindActionCreators", "name", "old", "value", "setStore", "_store", "getProductsForPurchasePost", "__name", "state", "productIds", "optin", "purchasePostObject", "parseFrequency", "getObjectStructuredProductPlans", "productPlans", "adaptedProductPlans", "productVariant", "productPlanOnArrayStructure", "frequencyAsKey", "arrayPrices", "newProductPlanStructure", "isCEPolyfill", "removeNodes", "__name", "container", "start", "end", "n", "marker", "nodeMarker", "markerRegex", "boundAttributeSuffix", "Template", "result", "element", "nodesToRemove", "stack", "walker", "lastPartIndex", "index", "partIndex", "strings", "length", "node", "attributes", "count", "i", "endsWith", "stringForPart", "name", "lastAttributeNameRegex", "attributeLookupName", "attributeValue", "statics", "data", "parent", "lastIndex", "insert", "s", "createMarker", "match", "n", "__name", "str", "suffix", "isTemplatePartActive", "part", "walkerNodeFilter", "removeNodesFromTemplate", "template", "nodesToRemove", "content", "parts", "walker", "partIndex", "nextActiveIndexInTemplateParts", "part", "nodeIndex", "removeCount", "nodesToRemoveInTemplate", "currentRemovingNode", "node", "n", "__name", "countNodes", "count", "startIndex", "i", "isTemplatePartActive", "insertNodeIntoTemplate", "refNode", "insertCount", "walkerIndex", "directives", "directive", "__name", "f", "args", "d", "isDirective", "o", "noChange", "nothing", "TemplateInstance", "template", "processor", "options", "values", "i", "part", "fragment", "isCEPolyfill", "stack", "parts", "walker", "partIndex", "nodeIndex", "node", "isTemplatePartActive", "__name", "policy", "s", "commentMarker", "marker", "TemplateResult", "strings", "values", "type", "processor", "l", "html", "isCommentBinding", "commentOpen", "attributeMatch", "lastAttributeNameRegex", "nodeMarker", "boundAttributeSuffix", "template", "value", "__name", "isPrimitive", "__name", "value", "isIterable", "AttributeCommitter", "element", "name", "strings", "AttributePart", "l", "parts", "v", "text", "i", "part", "t", "committer", "noChange", "isDirective", "directive", "NodePart", "options", "container", "createMarker", "ref", "TemplateResult", "nothing", "node", "valueAsString", "template", "TemplateInstance", "instance", "fragment", "itemParts", "partIndex", "itemPart", "item", "startNode", "removeNodes", "BooleanAttributePart", "PropertyCommitter", "PropertyPart", "eventOptionsSupported", "EventPart", "eventName", "eventContext", "e", "newListener", "oldListener", "shouldRemoveListener", "shouldAddListener", "getOptions", "event", "o", "templateFactory", "result", "templateCache", "templateCaches", "template", "key", "marker", "Template", "__name", "parts", "render", "__name", "result", "container", "options", "part", "removeNodes", "NodePart", "templateFactory", "DefaultTemplateProcessor", "element", "name", "strings", "options", "prefix", "PropertyCommitter", "EventPart", "BooleanAttributePart", "AttributeCommitter", "NodePart", "__name", "defaultTemplateProcessor", "html", "__name", "strings", "values", "TemplateResult", "defaultTemplateProcessor", "getTemplateCacheKey", "__name", "type", "scopeName", "compatibleShadyCSSVersion", "shadyTemplateFactory", "result", "cacheKey", "templateCache", "templateCaches", "template", "key", "marker", "element", "Template", "TEMPLATE_TYPES", "removeStylesFromLitTemplates", "templates", "content", "styles", "s", "removeNodesFromTemplate", "shadyRenderSet", "prepareTemplateStyles", "renderedDOM", "templateElement", "length", "condensedStyle", "i", "style", "insertNodeIntoTemplate", "removes", "render", "container", "options", "hasRendered", "parts", "needsScoping", "firstScopeRender", "renderContainer", "part", "TemplateInstance", "removeNodes", "prop", "_obj", "defaultConverter", "value", "type", "notEqual", "__name", "old", "defaultPropertyDeclaration", "STATE_HAS_UPDATED", "STATE_UPDATE_REQUESTED", "STATE_IS_REFLECTING_TO_ATTRIBUTE", "STATE_IS_REFLECTING_TO_PROPERTY", "finalized", "UpdatingElement", "attributes", "v", "p", "attr", "superProperties", "k", "name", "options", "key", "descriptor", "oldValue", "superCtor", "props", "propKeys", "attribute", "hasChanged", "converter", "fromAttribute", "res", "_v", "ctor", "attrValue", "propName", "shouldRequestUpdate", "result", "shouldUpdate", "changedProperties", "e", "_changedProperties", "_a", "ElementProto", "legacyMatches", "supportsAdoptingStyleSheets", "constructionToken", "CSSResult", "cssText", "safeToken", "__name", "unsafeCSS", "value", "textFromCSSResult", "css", "strings", "values", "acc", "v", "idx", "renderNotImplemented", "LitElement", "UpdatingElement", "userStyles", "addStyles", "__name", "styles", "set", "s", "v", "supportsAdoptingStyleSheets", "cssText", "css", "rule", "unsafeCSS", "changedProperties", "templateResult", "style", "render", "import_logical_expression_parser", "sanitizeFrequencyString", "__name", "value", "matchDwm", "buildProduct", "element", "resolveProduct", "__name", "element", "product", "buildProduct", "offer", "resolveOffer", "ref", "withOfferTemplate", "Base", "withProduct", "withChildOptions", "options", "isSelected", "it", "value", "sanitizeFrequencyString", "text", "descriptors_exports", "__export", "autoshipByDefault", "eligibilityGroups", "eligible", "hasPrepaidOptions", "hasUpcomingOrder", "hasUpsellGroup", "inStock", "optedout", "prepaidEligible", "prepaidSubscribed", "regularEligible", "subscribed", "subscriptionEligible", "upcomingOrderContainsProduct", "upsellEligible", "inStock", "__name", "state", "ownProps", "eligible", "autoshipByDefault", "subscriptionEligible", "eligibilityGroups", "productId", "safeProductId", "hasUpsellGroup", "groups", "it", "prepaidEligible", "ELIGIBILITY_GROUPS", "subscribed", "makeSubscribedSelector", "optedout", "makeOptedoutSelector", "prepaidSubscribed", "makePrepaidSubscribedSelector", "hasPrepaidOptions", "makeProductPrepaidShipmentOptionsSelector", "hasUpcomingOrder", "upcomingOrderContainsProduct", "upsellEligible", "_a", "regularEligible", "removeWhitespace", "__name", "str", "When", "withProduct", "LitElement", "html", "test", "expression", "key", "descriptors_exports", "changedProperties", "mapStateToProps", "state", "ConnectedWhen", "connect", "product", "value", "defaultFrequency", "isFrequencyValid", "subscribed", "auth", "withTemplate", "__name", "Base", "template", "markup", "tmpl", "selector", "val", "TemplateElement", "LitElement", "OptinStatus", "withProduct", "TemplateElement", "subscribed", "css", "changed", "html", "__name", "mapStateToProps", "state", "ownProps", "_a", "_b", "makeOptedinSelector", "makeProductFrequencyOptedInSelector", "makeProductSpecificDefaultFrequencySelector", "makeProductPrepaidShipmentsOptedInSelector", "makeProductDefaultFrequencySelector", "getFallbackValue", "makeProductFrequencyOptionsSelector", "templatesSelector", "makeProductFrequenciesSelector", "ConnectedOptinStatus", "connect", "OptinButton", "OptinStatus", "defaultFrequency", "changed", "platform_default", "buttonFreq", "frequencyToSellingPlan", "freq", "ev", "resolveProduct", "html", "__name", "ConnectedOptinButton", "connect", "mapStateToProps", "optinProduct", "OptoutButton", "OptinStatus", "ev", "html", "__name", "ConnectedOptoutButton", "connect", "mapStateToProps", "optoutProduct", "frequencyText", "__name", "frequency", "initial", "every", "period", "parseFrequency", "html", "FrequencyStatus", "withProduct", "TemplateElement", "subscribed", "defaultFrequency", "parseFrequenciesList", "css", "mapStateToProps", "state", "ownProps", "_a", "_b", "makeOptedinSelector", "makeProductFrequencyOptedInSelector", "makeProductSpecificDefaultFrequencySelector", "makeProductFrequencyOptionsSelector", "getFallbackValue", "makeProductDefaultFrequencySelector", "templatesSelector", "makeProductFrequenciesSelector", "ConnectedFrequencyStatus", "connect", "OptinSelect", "withChildOptions", "OptinStatus", "defaultFrequency", "css", "value", "_a", "childOptions", "options", "frequenciesText", "option", "ix", "frequencyText", "html", "__name", "ConnectedOptinSelect", "connect", "state", "ownProps", "mapStateToProps", "makeProductFrequencyOptionsSelector", "getFallbackValue", "productChangeFrequency", "optoutProduct", "UpsellButton", "withProduct", "TemplateElement", "css", "auth", "changed", "modal", "html", "__name", "mapStateToProps", "state", "ConnectedUpsellButton", "connect", "fetchOrders", "createIu", "concludeUpsell", "UpsellModal", "withProduct", "TemplateElement", "defaultFrequency", "auth", "html", "val", "freq", "__name", "mapStateToProps", "state", "ownProps", "_a", "makeOptedinSelector", "makeProductFrequencyOptedInSelector", "makeProductDefaultFrequencySelector", "getFallbackValue", "ConnectedUpsellModal", "connect", "concludeUpsell", "createIu", "OptinToggle", "OptinStatus", "css", "ev", "html", "__name", "ConnectedOptinToggle", "connect", "mapStateToProps", "optoutProduct", "optinProduct", "pluralize", "__name", "word", "count", "Text", "withOfferTemplate", "LitElement", "key", "i18n", "text", "html", "mapStateToProps", "state", "ConnectedText", "connect", "DiscountAmount", "value", "__name", "DiscountPercent", "ShippingDiscountPercent", "DISCOUNT_PERCENT", "DISCOUNT_AMOUNT", "TOTAL_PRICE", "SHIPPING_TOTAL", "SUB_TOTAL", "discountBuilder", "field", "object", "type", "available", "it", "isMatchingIncentive", "incentive", "incentiveValue", "incentiveClass", "discountBuilder", "__name", "preferredIncentiveStandards", "INCENTIVE_STANDARD_TYPES", "IncentiveText", "withProduct", "LitElement", "incentiveClass", "incentiveValue", "incentiveType", "incentivesOfType", "preferredIncentives", "incentive", "isMatchingIncentive", "html", "discountBuilder", "__name", "mapStateToProps", "state", "ownProps", "_a", "safeProductId", "ConnectedIncentiveText", "connect", "previousValues", "unsafeHTML", "directive", "value", "part", "NodePart", "previousValue", "isPrimitive", "template", "fragment", "BenefitMessages", "withProduct", "LitElement", "_a", "html", "msg", "unsafeHTML", "__name", "mapStateToProps", "state", "ownProps", "makeBenefitMessagesSelector", "ConnectedBenefitMessages", "connect", "SelectFrequency", "withChildOptions", "FrequencyStatus", "css", "val", "_a", "_b", "_c", "_d", "options", "isSelected", "result", "frequencyToSellingPlan", "_", "value", "defaultFrequency", "ix", "text", "frequenciesEveryPeriod", "frequenciesText", "frequencyText", "html", "__name", "ConnectedSelectFrequency", "connect", "mapStateToProps", "productChangeFrequency", "validParts", "formatDate", "__name", "date", "format", "it", "part", "value", "validParts", "dateInParts", "result", "FormattedDate", "LitElement", "html", "formatDate", "__name", "mapStateToProps", "state", "ConnectedNextUpcomingOrder", "connect", "import_lodash", "setPreviewStandardOffer", "__name", "isPreview", "productId", "offer", "dispatch", "SET_PREVIEW_STANDARD_OFFER", "UNAUTHORIZED", "setBenefitMessages", "receiveOffer", "mergeProductPlansToState", "state", "newProductPlans", "key", "value", "mergedArray", "uniqueArray", "item", "setPreviewUpsellOffer", "getState", "SET_PREVIEW_UPSELL_OFFER", "merchantId", "receiveOrders", "authorize", "unauthorized", "setPreviewPrepaid", "existingProductPlans", "SET_PREVIEW_PREPAID_OFFER", "RECEIVE_PRODUCT_PLANS", "getObjectStructuredProductPlans", "SET_CONFIG", "setPreview", "oldValue", "_getState", "LOCAL_STORAGE_CLEAR", "optinProduct", "memoizeKey", "__name", "args", "logOnce", "messageFn", "hasLogged", "logMulticurrencyWarning", "storeCurrency", "primaryCurrency", "logProductSpecificFrequencyListWarning", "productAndComponents", "memoize", "product", "components", "Offer", "TemplateElement", "auth", "preview", "it", "css", "template", "variationId", "locale", "event", "changed", "onReady", "DEFAULT_OFFER_MODULE", "newProductWithComponents", "oldProductWithComponents", "isSameProduct", "html", "storeFrequency", "freq", "attributeValue", "key", "attrName", "kebabCase", "attr", "mapStateToProps", "state", "ownProps", "_a", "makeProductDefaultFrequencySelector", "makeProductFrequencyOptedInSelector", "makeProductSpecificDefaultFrequencySelector", "getFallbackValue", "autoshipSelector", "makeOptedoutSelector", "optedinSelector", "makeOptedinSelector", "templatesSelector", "ConnectedOffer", "connect", "fetchOffer", "fetchOrders", "productHasChangedComponents", "optinProduct", "setFirstOrderPlaceDate", "setProductToSubscribe", "setPreview", "Modal", "LitElement", "css", "html", "__name", "previousValues", "ifDefined", "directive", "value", "part", "previousValue", "AttributePart", "name", "Select", "LitElement", "css", "html", "__name", "ev", "ifDefined", "option", "ACTIVATION_TYPES", "Tooltip", "LitElement", "css", "signal", "triggerRect", "content", "contentRect", "event", "triggerLabel", "html", "ifDefined", "__name", "PrepaidStatus", "withProduct", "LitElement", "getDefaultPrepaidOption", "value", "valueAsNumber", "html", "__name", "mapStateToProps", "state", "ownProps", "makeProductPrepaidShipmentOptionsSelector", "makeProductPrepaidShipmentsOptedInSelector", "makePrepaidShipmentsSelectedSelector", "ConnectedPrepaidStatus", "connect", "productChangePrepaidShipments", "PrepaidToggle", "PrepaidStatus", "css", "html", "displayOptions", "value", "e", "__name", "mapStateToProps", "state", "ownProps", "makeProductPrepaidShipmentOptionsSelector", "makeProductPrepaidShipmentsOptedInSelector", "makePrepaidShipmentsSelectedSelector", "ConnectedPrepaidToggle", "connect", "productChangePrepaidShipments", "PrepaidData", "PrepaidStatus", "css", "realProductId", "safeProductId", "plans", "targetShipments", "currentPlan", "plan", "discountRate", "subscriptionPrice", "prepaidShipments", "regularPrepaidPrice", "prepaidSavingsPerShipment", "prepaidSavingsTotal", "prepaidExtraSavingsPercentage", "value", "html", "__name", "mapStateToProps", "state", "ownProps", "makeProductPrepaidShipmentOptionsSelector", "makeProductPrepaidShipmentsOptedInSelector", "makePrepaidShipmentsSelectedSelector", "ConnectedPrepaidData", "connect", "PrepaidButton", "PrepaidStatus", "css", "ev", "html", "__name", "mapStateToProps", "state", "ownProps", "makeProductPrepaidShipmentOptionsSelector", "makeProductPrepaidShipmentsOptedInSelector", "makePrepaidShipmentsSelectedSelector", "ConnectedPrepaidButton", "connect", "productChangePrepaidShipments", "PrepaidSelect", "PrepaidStatus", "css", "html", "displayOptions", "value", "e", "__name", "mapStateToProps", "state", "ownProps", "makeProductPrepaidShipmentOptionsSelector", "makeProductPrepaidShipmentsOptedInSelector", "makePrepaidShipmentsSelectedSelector", "ConnectedPrepaidSelect", "connect", "productChangePrepaidShipments", "SubscriptionButton", "OptinButton", "ev", "payAsYouGoFrequency", "resolveProduct", "html", "__name", "ConnectedSubscriptionButton", "connect", "mapStateToProps", "optinProduct", "TestWizard", "LitElement", "css", "element", "state", "productAttribute", "locationAttribute", "result", "messages", "inStock", "autoshipEligible", "html", "ix", "message", "ev", "offer", "autoship", "groups", "productId", "receiveOffer", "receiveItems", "__name", "run_tests_default", "name", "TestWizard", "modal", "__name", "keys", "enable", "__name", "keysCounter", "currentkeys", "run_tests_default", "Price", "withProduct", "TemplateElement", "css", "_a", "_b", "realProductId", "safeProductId", "frequency", "plans", "currentPlan", "plan", "regularPrice", "discountRate", "subscriptionPrice", "value", "html", "__name", "mapStateToProps", "state", "ownProps", "makeProductDefaultFrequencySelector", "makeProductFrequencyOptedInSelector", "makeDiscountedProductPriceSelector", "Price_default", "connect", "makeApi", "store", "enable", "setStore", "ConnectedWhen", "ConnectedText", "ConnectedIncentiveText", "ConnectedBenefitMessages", "ConnectedOffer", "ConnectedSelectFrequency", "ConnectedOptoutButton", "ConnectedOptinToggle", "ConnectedOptinStatus", "ConnectedOptinButton", "ConnectedOptinSelect", "ConnectedUpsellButton", "ConnectedFrequencyStatus", "Modal", "Select", "Tooltip", "ConnectedUpsellModal", "ConnectedNextUpcomingOrder", "Price_default", "ConnectedPrepaidToggle", "ConnectedPrepaidData", "ConnectedPrepaidButton", "ConnectedPrepaidSelect", "ConnectedSubscriptionButton", "isReady", "offers", "e", "setEnvironment", "m", "setMerchantId", "authUrl", "setAuthUrl", "settings", "receiveMerchantSettings", "productIds", "getProductsForPurchasePost", "checkout", "fn", "set", "configuration", "setConfig", "locale", "setLocale", "messages", "setBenefitMessages", "tagName", "content", "configOption", "addTemplate", "templates", "setTemplates", "_publicPath", "merchantId", "env", "storeInstance", "platform_default", "products", "state", "sessionId", "product", "requestOffer", "RECEIVE_PRODUCT_PLANS", "merchantSettings", "_a", "h", "__name", "optedin", "__name", "state", "action", "LOCAL_STORAGE_CLEAR", "LOCAL_STORAGE_CHANGE", "OPTIN_PRODUCT", "PRODUCT_CHANGE_FREQUENCY", "prepaidShipments", "oldone", "rest", "getMatchingProductIfExists", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "payload", "newState", "OPTOUT_PRODUCT", "a", "isSameProduct", "PRODUCT_HAS_CHANGED", "product", "CONVERT_ONE_TIME", "CHECKOUT", "optedout", "nextUpcomingOrder", "type", "RECEIVE_ORDERS", "RECEIVE_ORDER_ITEMS", "it", "CREATE_ONE_TIME", "autoshipEligible", "RECEIVE_OFFER", "inStock", "REQUEST_OFFER", "eligibilityGroups", "mapIncentive", "incentive", "incentiveDisplay", "incentiveDisplayEnhanced", "i", "enhanced", "INCENTIVE_STANDARD_TYPES", "incentives", "obj", "uniqueProductId", "productId", "incentiveObj", "initial", "ongoing", "frequency", "safeProductId", "auth", "AUTHORIZE", "UNAUTHORIZED", "merchantId", "SET_MERCHANT_ID", "authUrl", "SET_AUTH_URL", "offer", "offerId", "sessionId", "CREATED_SESSION_ID", "productOffer", "key", "acc", "object", "firstOrderPlaceDate", "SET_FIRST_ORDER_PLACE_DATE", "productToSubscribe", "SET_PRODUCT_TO_SUBSCRIBE", "environment", "SET_ENVIRONMENT_LOCAL", "SET_ENVIRONMENT_STAGING", "ENV_STAGING", "SET_ENVIRONMENT_DEV", "ENV_DEV", "SET_ENVIRONMENT_PROD", "ENV_PROD", "locale", "SET_LOCALE", "config", "SET_CONFIG", "stringifyFrequency", "RECEIVE_MERCHANT_SETTINGS", "previewStandardOffer", "SET_PREVIEW_STANDARD_OFFER", "previewUpsellOffer", "SET_PREVIEW_UPSELL_OFFER", "autoshipByDefault", "__name", "state", "action", "RECEIVE_OFFER", "defaultFrequencies", "templates", "SET_TEMPLATES", "ADD_TEMPLATE", "productPlans", "RECEIVE_PRODUCT_PLANS", "getObjectStructuredProductPlans", "prepaidShipmentsSelected", "CART_PRODUCT_KEY_HAS_CHANGED", "preservedPrepaidShipments", "stateWithoutOldCartProductKey", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "price", "_action", "benefitMessages", "SET_BENEFIT_MESSAGES", "reducer_default", "combineReducers", "optedin", "optedout", "nextUpcomingOrder", "autoshipEligible", "inStock", "eligibilityGroups", "incentives", "frequency", "auth", "merchantId", "authUrl", "offer", "offerId", "experimentsReducer", "sessionId", "productOffer", "firstOrderPlaceDate", "productToSubscribe", "environment", "locale", "config", "previewStandardOffer", "previewUpsellOffer", "isPrepaidAllocation", "__name", "allocation", "_a", "_b", "option", "getPrepaidShipmentsNumberFromOptions", "options", "shipmentAmountArray", "getAllocationFrequency", "getAllocationRegularPrice", "currency", "money", "getAllocationSubscriptionPrice", "prepaidShipmentsPerBilling", "pricePerShipment", "getPrepaidPercentage", "getAllocationDiscountRate", "_c", "prepaidPercentageSavings", "percentage", "formatted_discount", "getAllocationNumberOfShipments", "addPrepaidPriceAndSavings", "productPlan", "payAsYouGoPlan", "prepaidSaving", "payAsYouGoAdjustment", "payAsYouGoPercentage", "mapSellingPlanToDiscount", "sellingPlans", "plan", "getPayAsYouGoSellingPlan", "sellingPlanAllocationsReducer", "acc", "cur", "getSellingPlans", "product", "allGroups", "group", "selling_plan", "config", "__name", "state", "action", "_a", "SETUP_PRODUCT", "product", "currency", "configToAdd", "productFrequencies", "acc", "variant", "reduceSellingPlansToFrequencies", "updatedProductFrequencies", "prepaidSellingPlans", "getPrepaidSellingPlans", "RECEIVE_OFFER", "offerEl", "defaultFrequency", "productId", "safeProductId", "currentProductFrequencies", "getUpdatedDefaultFrequency", "RECEIVE_MERCHANT_SETTINGS", "getFrequencies", "productSellingPlanGroups", "_b", "sellingPlanGroup", "getPayAsYouGoSellingPlanGroup", "frequencies", "sellingPlansToFrequencies", "frequenciesEveryPeriod", "sellingPlansToEveryPeriod", "frequenciesText", "isOgFrequency", "mapFrequencyToSellingPlan", "getFirstSellingPlan", "sellingPlanGroups", "sellingPlanGroupIdsForProduct", "allocation", "applicableSellingPlanGroups", "group", "offerElementDefaultFrequency", "sellingPlan", "prepaidSellingPlanGroups", "cur", "sellingPlanInfo", "sellingPlanObject", "getPrepaidShipments", "config_default", "overrideLineKey", "__name", "state", "productId", "newValue", "keys", "it", "acc", "cur", "getDefaultSellingPlan", "sellingPlans", "frequenciesEveryPeriod", "defaultFrequency", "isOgFrequency", "hasShopifySellingPlans", "sellingPlan", "mapFrequencyToSellingPlan", "getFirstSellingPlan", "mapExistingOptinsFromOfferResponse", "offerEl", "frequencyConfig", "reduceNewOptinsFromOfferResponse", "autoship", "autoship_by_default", "default_frequencies", "in_stock", "eligibility_groups", "existingOptins", "prepaidSellingPlans", "id", "_a", "getOptInDefaultFrequency", "ELIGIBILITY_GROUPS", "prepaidPlan", "getDefaultPrepaidOption", "PREPAID_PLACEHOLDER", "psdf", "frequency", "productOrVariantInStockReducer", "reduceProductCartLine", "safeProductId", "autoshipEligible", "action", "SETUP_CART", "cart", "SETUP_PRODUCT", "product", "applicableSellingPlanGroups", "getPayAsYouGoSellingPlanGroups", "ogSellingPlanIds", "group", "_b", "isAutoshipEligible", "SET_PREVIEW_STANDARD_OFFER", "inStock", "REQUEST_OFFER", "offer", "_action", "getOptedInItem", "cartItem", "prepaidShipments", "getPrepaidShipments", "item", "optedin", "RECEIVE_OFFER", "payload", "newOptins", "sellingPlanGroup", "getPayAsYouGoSellingPlanGroup", "getPrepaidSellingPlans", "frequencies", "sellingPlansToFrequencies", "sellingPlansToEveryPeriod", "curr", "prepaidSellingPlansForVariant", "numberShipments", "i", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "newState", "oldone", "rest", "getMatchingProductIfExists", "price", "productOffer", "productPlans", "currency", "getSellingPlans", "accumulator", "current", "sellingPlanAllocationsReducer", "reducer", "combineReducers", "auth", "authUrl", "autoshipByDefault", "config_default", "defaultFrequencies", "eligibilityGroups", "environment", "firstOrderPlaceDate", "incentives", "locale", "merchantId", "nextUpcomingOrder", "offerId", "experimentsReducer", "optedout", "previewStandardOffer", "previewUpsellOffer", "productToSubscribe", "sessionId", "templates", "prepaidShipmentsSelected", "benefitMessages", "shopifyReducer", "reducer_default", "import_lodash", "import_throttle_debounce", "updateTrackingInputs", "product_id", "name", "value", "store2FormElementSelector", "store1FormElementSelector", "cartAddFormElements", "cartAddFormElement", "parent", "input", "__name", "getTrackingKey", "addDefaultToSubTracking", "action", "store", "_a", "_b", "_c", "_d", "productId", "key", "location", "variation", "frequency", "getSubscribedFrequency", "inputValue", "OPTIN_PRODUCT", "shopifyTrackingMiddleware", "next", "OPTOUT_PRODUCT", "PRODUCT_CHANGE_FREQUENCY", "offerElement", "trackingEvent", "getTrackingEvent", "RECEIVE_OFFER", "_a", "_b", "SHOPIFY_ROOT", "CART_PAGE_URL", "CART_JS_URL", "CART_CHANGE_URL", "CART_UPDATE_URL", "PRODUCTS_URL", "OFFER_ATTRIBUTE_NAME", "DEFAULT_SHOPIFY_CART_AJAX_SECTIONS", "makeSyncProductId", "__name", "offer", "form", "id", "getCurrency", "windowCurrency", "getCart", "setupPdp", "store", "handle", "guessProductHandle", "product", "currency", "getProduct", "payload", "SETUP_PRODUCT", "err", "ref", "syncProductId", "e", "it", "acc", "cur", "memoize", "setupCart", "cart", "items", "cartPayload", "SETUP_CART", "productAsCartLine", "synchronizeCartOptin", "action", "offerElement", "selling_plan", "getSubscribedFrequency", "trackingEvent", "getTrackingEvent", "sectionsToUpdate", "key", "offerIx", "item", "qty", "productId", "safeProductId", "offerIdAttribute", "getOfferIdAttribute", "attributes", "changeRes", "el", "newCart", "newKey", "line", "CART_PRODUCT_KEY_HAS_CHANGED", "newCartPayload", "cartUpdateEvent", "CART_UPDATED_EVENT", "sections", "sectionElement", "sectionId", "sectionRawHtml", "product_id", "getTrackingKey", "location", "variation", "value", "REQUEST_OFFER", "OPTOUT_PRODUCT", "OPTIN_PRODUCT", "PRODUCT_CHANGE_FREQUENCY", "optin", "makeSubscribedSelector", "state", "isShopifyDiscountFunctionInUseSelector", "synchronizeSellingPlan", "productIdInput", "sellingPlanId", "getOrCreateHidden", "shopifyMiddleware", "next", "PRODUCT_CHANGE_PREPAID_SHIPMENTS", "RECEIVE_OFFER", "SHOPIFY_OG_AUTH_ENDPOINT", "SHOPIFY_OG_AUTH_BEGIN", "SHOPIFY_OG_AUTH_END", "parseIntegrationTempAuth", "__name", "raw", "id", "timestamp", "signature", "email", "authorizeShopifyCustomer", "store", "_a", "merchantId", "resolveEnvAndMerchant", "script", "getMainJs", "customer", "val", "getOrCreateAuthCookie", "sig_field", "ts", "sig", "authorize", "clearCookie", "unauthorized", "fetchOGSignature", "data", "beginningIndex", "err", "ogAuthCookie", "getCookieValue", "customerId", "ogToday", "binarySignature", "value", "_a", "store", "makeStore", "platform_default", "shopifyReducer", "shopifyMiddleware", "reducer_default", "shopifyTrackingMiddleware", "offers", "makeApi", "isReady", "addOptinChangedCallback", "addTemplate", "clear", "config", "disableOptinChangedCallbacks", "getOptins", "getProductsForPurchasePost", "initialize", "previewMode", "register", "resolveSettings", "setAuthUrl", "setBenefitMessages", "setEnvironment", "setLocale", "setMerchantId", "setPublicPath", "setTemplates", "setupCart", "setupProduct", "setupProducts", "autoInit", "__name", "autoInitializeOffers", "src_default", "offers", "_a", "platform_default", "onReady", "authorizeShopifyCustomer"]
|
|
7
7
|
}
|