UNPKG

@eastsideco/escshopify

Version:

WIP JS library for Shopify, containing a variety of useful functionality.

1,488 lines (1,487 loc) 201 kB
{ "type": "File", "start": 0, "end": 2163, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 93, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 2163, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 93, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 24, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 24 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 11, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 11 } }, "local": { "type": "Identifier", "start": 7, "end": 11, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 11 }, "identifierName": "Evee" }, "name": "Evee" } } ], "source": { "type": "StringLiteral", "start": 17, "end": 23, "loc": { "start": { "line": 1, "column": 17 }, "end": { "line": 1, "column": 23 } }, "extra": { "rawValue": "evee", "raw": "'evee'" }, "value": "evee" } }, { "type": "ImportDeclaration", "start": 25, "end": 55, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 30 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 32, "end": 38, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 13 } }, "local": { "type": "Identifier", "start": 32, "end": 38, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 13 }, "identifierName": "config" }, "name": "config" } } ], "source": { "type": "StringLiteral", "start": 44, "end": 54, "loc": { "start": { "line": 2, "column": 19 }, "end": { "line": 2, "column": 29 } }, "extra": { "rawValue": "./config", "raw": "'./config'" }, "value": "./config" } }, { "type": "ImportDeclaration", "start": 56, "end": 84, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 28 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 63, "end": 68, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 12 } }, "local": { "type": "Identifier", "start": 63, "end": 68, "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 12 }, "identifierName": "state" }, "name": "state" } } ], "source": { "type": "StringLiteral", "start": 74, "end": 83, "loc": { "start": { "line": 3, "column": 18 }, "end": { "line": 3, "column": 27 } }, "extra": { "rawValue": "./state", "raw": "'./state'" }, "value": "./state" } }, { "type": "ImportDeclaration", "start": 85, "end": 107, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 22 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 92, "end": 95, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 10 } }, "local": { "type": "Identifier", "start": 92, "end": 95, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 10 }, "identifierName": "log" }, "name": "log" } } ], "source": { "type": "StringLiteral", "start": 101, "end": 106, "loc": { "start": { "line": 4, "column": 16 }, "end": { "line": 4, "column": 21 } }, "extra": { "rawValue": "log", "raw": "'log'" }, "value": "log" } }, { "type": "VariableDeclaration", "start": 109, "end": 136, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", "start": 115, "end": 135, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 26 } }, "id": { "type": "Identifier", "start": 115, "end": 118, "loc": { "start": { "line": 6, "column": 6 }, "end": { "line": 6, "column": 9 }, "identifierName": "TAG" }, "name": "TAG" }, "init": { "type": "StringLiteral", "start": 121, "end": 135, "loc": { "start": { "line": 6, "column": 12 }, "end": { "line": 6, "column": 26 } }, "extra": { "rawValue": "EasyCurrency", "raw": "'EasyCurrency'" }, "value": "EasyCurrency" } } ], "kind": "const", "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Plugin for automatic currency conversion, tax handling, etc.\n * @private\n ", "start": 138, "end": 221, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 11, "column": 3 } } } ] }, { "type": "ExportDefaultDeclaration", "start": 222, "end": 2162, "loc": { "start": { "line": 12, "column": 0 }, "end": { "line": 92, "column": 1 } }, "declaration": { "type": "ClassDeclaration", "start": 237, "end": 2162, "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 92, "column": 1 } }, "id": { "type": "Identifier", "start": 243, "end": 255, "loc": { "start": { "line": 12, "column": 21 }, "end": { "line": 12, "column": 33 }, "identifierName": "EasyCurrency" }, "name": "EasyCurrency", "leadingComments": null }, "superClass": { "type": "Identifier", "start": 264, "end": 268, "loc": { "start": { "line": 12, "column": 42 }, "end": { "line": 12, "column": 46 }, "identifierName": "Evee" }, "name": "Evee" }, "body": { "type": "ClassBody", "start": 269, "end": 2162, "loc": { "start": { "line": 12, "column": 47 }, "end": { "line": 92, "column": 1 } }, "body": [ { "type": "ClassMethod", "start": 349, "end": 660, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 23, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 349, "end": 360, "loc": { "start": { "line": 14, "column": 4 }, "end": { "line": 14, "column": 15 }, "identifierName": "constructor" }, "name": "constructor", "leadingComments": null }, "kind": "constructor", "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 363, "end": 660, "loc": { "start": { "line": 14, "column": 18 }, "end": { "line": 23, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 373, "end": 381, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 16 } }, "expression": { "type": "CallExpression", "start": 373, "end": 380, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 15 } }, "callee": { "type": "Super", "start": 373, "end": 378, "loc": { "start": { "line": 15, "column": 8 }, "end": { "line": 15, "column": 13 } } }, "arguments": [] }, "trailingComments": [ { "type": "CommentBlock", "value": "* @type {src/easycurrency/config.js~Config} ", "start": 391, "end": 439, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 56 } } } ] }, { "type": "ExpressionStatement", "start": 448, "end": 470, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 30 } }, "expression": { "type": "AssignmentExpression", "start": 448, "end": 469, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 29 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 448, "end": 460, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 20 } }, "object": { "type": "ThisExpression", "start": 448, "end": 452, "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 453, "end": 460, "loc": { "start": { "line": 18, "column": 13 }, "end": { "line": 18, "column": 20 }, "identifierName": "_config" }, "name": "_config" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 463, "end": 469, "loc": { "start": { "line": 18, "column": 23 }, "end": { "line": 18, "column": 29 }, "identifierName": "config" }, "name": "config" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "* @type {src/easycurrency/config.js~Config} ", "start": 391, "end": 439, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 56 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "* @type {src/easycurrency/resolver.js~CurrencyResolver} ", "start": 479, "end": 539, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 68 } } } ] }, { "type": "ExpressionStatement", "start": 548, "end": 570, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 30 } }, "expression": { "type": "AssignmentExpression", "start": 548, "end": 569, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 29 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 548, "end": 562, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 22 } }, "object": { "type": "ThisExpression", "start": 548, "end": 552, "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 553, "end": 562, "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 22 }, "identifierName": "_resolver" }, "name": "_resolver" }, "computed": false, "leadingComments": null }, "right": { "type": "NullLiteral", "start": 565, "end": 569, "loc": { "start": { "line": 20, "column": 25 }, "end": { "line": 20, "column": 29 } } }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "* @type {src/easycurrency/resolver.js~CurrencyResolver} ", "start": 479, "end": 539, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 68 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "* @type {src/easycurrency/state.js~State} ", "start": 579, "end": 625, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 54 } } } ] }, { "type": "ExpressionStatement", "start": 634, "end": 654, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 28 } }, "expression": { "type": "AssignmentExpression", "start": 634, "end": 653, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 27 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 634, "end": 645, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 19 } }, "object": { "type": "ThisExpression", "start": 634, "end": 638, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 12 } }, "leadingComments": null }, "property": { "type": "Identifier", "start": 639, "end": 645, "loc": { "start": { "line": 22, "column": 13 }, "end": { "line": 22, "column": 19 }, "identifierName": "_state" }, "name": "_state" }, "computed": false, "leadingComments": null }, "right": { "type": "Identifier", "start": 648, "end": 653, "loc": { "start": { "line": 22, "column": 22 }, "end": { "line": 22, "column": 27 }, "identifierName": "state" }, "name": "state" }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "* @type {src/easycurrency/state.js~State} ", "start": 579, "end": 625, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 54 } } } ] } ], "directives": [], "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", "value": "* This is a singleton class - do not create instances directly. ", "start": 275, "end": 344, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 73 } } } ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Start running EasyCurrency on the current page.\n ", "start": 667, "end": 733, "loc": { "start": { "line": 26, "column": 4 }, "end": { "line": 28, "column": 7 } } } ] }, { "type": "ClassMethod", "start": 738, "end": 986, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 36, "column": 5 } }, "static": false, "computed": false, "key": { "type": "Identifier", "start": 738, "end": 748, "loc": { "start": { "line": 29, "column": 4 }, "end": { "line": 29, "column": 14 }, "identifierName": "initialize" }, "name": "initialize", "leadingComments": null }, "kind": "method", "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 749, "end": 755, "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 21 }, "identifierName": "config" }, "name": "config" } ], "body": { "type": "BlockStatement", "start": 757, "end": 986, "loc": { "start": { "line": 29, "column": 23 }, "end": { "line": 36, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 767, "end": 817, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 58 } }, "expression": { "type": "CallExpression", "start": 767, "end": 816, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 57 } }, "callee": { "type": "MemberExpression", "start": 767, "end": 776, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 17 } }, "object": { "type": "Identifier", "start": 767, "end": 770, "loc": { "start": { "line": 30, "column": 8 }, "end": { "line": 30, "column": 11 }, "identifierName": "log" }, "name": "log" }, "property": { "type": "Identifier", "start": 771, "end": 776, "loc": { "start": { "line": 30, "column": 12 }, "end": { "line": 30, "column": 17 }, "identifierName": "debug" }, "name": "debug" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 777, "end": 780, "loc": { "start": { "line": 30, "column": 18 }, "end": { "line": 30, "column": 21 }, "identifierName": "TAG" }, "name": "TAG" }, { "type": "StringLiteral", "start": 782, "end": 807, "loc": { "start": { "line": 30, "column": 23 }, "end": { "line": 30, "column": 48 } }, "extra": { "rawValue": "Initialized with config", "raw": "'Initialized with config'" }, "value": "Initialized with config" }, { "type": "Identifier", "start": 809, "end": 815, "loc": { "start": { "line": 30, "column": 50 }, "end": { "line": 30, "column": 56 }, "identifierName": "config" }, "name": "config" } ] } }, { "type": "IfStatement", "start": 826, "end": 917, "loc": { "start": { "line": 31, "column": 8 }, "end": { "line": 33, "column": 9 } }, "test": { "type": "Identifier", "start": 830, "end": 836, "loc": { "start": { "line": 31, "column": 12 }, "end": { "line": 31, "column": 18 }, "identifierName": "config" }, "name": "config" }, "consequent": { "type": "BlockStatement", "start": 838, "end": 917, "loc": { "start": { "line": 31, "column": 20 }, "end": { "line": 33, "column": 9 } }, "body": [ { "type": "ExpressionStatement", "start": 852, "end": 907, "loc": { "start": { "line": 32, "column": 12 }, "end": { "line": 32, "column": 67 } }, "expression": { "type": "AssignmentExpression", "start": 852, "end": 906, "loc": { "start": { "line": 32, "column": 12 }, "end": { "line": 32, "column": 66 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 852, "end": 864, "loc": { "start": { "line": 32, "column": 12 }, "end": { "line": 32, "column": 24 } }, "object": { "type": "ThisExpression", "start": 852, "end": 856, "loc": { "start": { "line": 32, "column": 12 }, "end": { "line": 32, "column": 16 } } }, "property": { "type": "Identifier", "start": 857, "end": 864, "loc": { "start": { "line": 32, "column": 17 }, "end": { "line": 32, "column": 24 }, "identifierName": "_config" }, "name": "_config" }, "computed": false }, "right": { "type": "CallExpression", "start": 867, "end": 906, "loc": { "start": { "line": 32, "column": 27 }, "end": { "line": 32, "column": 66 } }, "callee": { "type": "MemberExpression", "start": 867, "end": 880, "loc": { "start": { "line": 32, "column": 27 }, "end": { "line": 32, "column": 40 } }, "object": { "type": "Identifier", "start": 867, "end": 873, "loc": { "start": { "line": 32, "column": 27 }, "end": { "line": 32, "column": 33 }, "identifierName": "Object" }, "name": "Object" }, "property": { "type": "Identifier", "start": 874, "end": 880, "loc": { "start": { "line": 32, "column": 34 }, "end": { "line": 32, "column": 40 }, "identifierName": "assign" }, "name": "assign" }, "computed": false }, "arguments": [ { "type": "ObjectExpression", "start": 881, "end": 883, "loc": { "start": { "line": 32, "column": 41 }, "end": { "line": 32, "column": 43 } }, "properties": [] }, { "type": "MemberExpression", "start": 885, "end": 897, "loc": { "start": { "line": 32, "column": 45 }, "end": { "line": 32, "column": 57 } }, "object": { "type": "ThisExpression", "start": 885, "end": 889, "loc": { "start": { "line": 32, "column": 45 }, "end": { "line": 32, "column": 49 } } }, "property": { "type": "Identifier", "start": 890, "end": 897, "loc": { "start": { "line": 32, "column": 50 }, "end": { "line": 32, "column": 57 }, "identifierName": "_config" }, "name": "_config" }, "computed": false }, { "type": "Identifier", "start": 899, "end": 905, "loc": { "start": { "line": 32, "column": 59 },